Feature #5201 » issue_5201_tracker_description.patch
| app/helpers/issues_helper.rb (working copy) | ||
|---|---|---|
|
end
|
||
|
def trackers_options_for_select(issue)
|
||
|
trackers = trackers_for_select(issue)
|
||
|
trackers.collect {|t| [t.name, t.id]}
|
||
|
end
|
||
|
def trackers_for_select(issue)
|
||
|
trackers = issue.allowed_target_trackers
|
||
|
if issue.new_record? && issue.parent_issue_id.present?
|
||
|
trackers = trackers.reject do |tracker|
|
||
|
issue.tracker_id != tracker.id && tracker.disabled_core_fields.include?('parent_issue_id')
|
||
|
end
|
||
|
end
|
||
|
trackers.collect {|t| [t.name, t.id]}
|
||
|
trackers
|
||
|
end
|
||
|
class IssueFieldsRows
|
||
| app/models/tracker.rb (working copy) | ||
|---|---|---|
|
'core_fields',
|
||
|
'position',
|
||
|
'custom_field_ids',
|
||
|
'project_ids'
|
||
|
'project_ids',
|
||
|
'description'
|
||
|
def to_s; name end
|
||
| app/views/issues/_form.html.erb (working copy) | ||
|---|---|---|
|
<% end %>
|
||
|
<% if @issue.safe_attribute? 'tracker_id' %>
|
||
|
<p><%= f.select :tracker_id, trackers_options_for_select(@issue), {:required => true},
|
||
|
:onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %></p>
|
||
|
<p>
|
||
|
<%= f.select :tracker_id, trackers_options_for_select(@issue), {:required => true},
|
||
|
:onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %>
|
||
|
<a class="icon icon-help" href="#" id="display_tracker_description">
|
||
|
<%=h l(:label_description_for_trackers, default: 'Descriptions for trackers') %>
|
||
|
</a>
|
||
|
</p>
|
||
|
<% end %>
|
||
|
<%= render partial: 'issues/tracker_description', locals: { trackers: trackers_for_select(@issue) } %>
|
||
|
<% if @issue.safe_attribute? 'subject' %>
|
||
|
<p><%= f.text_field :subject, :size => 80, :maxlength => 255, :required => true %></p>
|
||
|
<% end %>
|
||
| app/views/issues/_tracker_description.html.erb (working copy) | ||
|---|---|---|
|
<!-- dialog box -->
|
||
|
<div id="trackers_description_dialog" style="overflow:visible; display: none;">
|
||
|
<h3 class="title"><%= l(:label_description_for_trackers, default: 'Descriptions for trackers') %></h3>
|
||
|
<table class="list trackers odd-even">
|
||
|
<thead>
|
||
|
<th><%= l(:field_description) %></th>
|
||
|
<th><%= l(:button_apply) %></th>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<% trackers.each do |tracker| %>
|
||
|
<tr class="<%= cycle("odd", "even") %>" name="<%= tracker['id'] %>">
|
||
|
<td class="description">
|
||
|
<h4><%= tracker['name'] %></h4>
|
||
|
<%= textilizable(tracker['description']) %>
|
||
|
</td>
|
||
|
<td>
|
||
|
<a href="#" class="icon icon-test" title="<%= l(:button_apply) %>"
|
||
|
onclick="applyTracker(<%= tracker['id'] %>, false); return false;"></a>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<% end %>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
<!-- dialog box -->
|
||
|
<script type="text/javascript">
|
||
|
//<![CDATA[
|
||
|
$(document).ready(function () {
|
||
|
$("#display_tracker_description").click(function (e) {
|
||
|
e.preventDefault();
|
||
|
showModal('trackers_description_dialog', '500px');
|
||
|
var selected_tracker_id = $('#issue_tracker_id').val();
|
||
|
updateSelect(selected_tracker_id);
|
||
|
});
|
||
|
});
|
||
|
function applyTracker(id) {
|
||
|
var target = $('#issue_tracker_id');
|
||
|
target.attr("selected", false);
|
||
|
target.find('option[value="' + id + '"]').prop('selected', true);
|
||
|
target.trigger('change');
|
||
|
updateSelect(id);
|
||
|
}
|
||
|
function updateSelect(id) {
|
||
|
var target = $("tr[name='" + id + "'] td h4");
|
||
|
$('td h4').not(target).removeClass('selected');
|
||
|
$(target).addClass('selected');
|
||
|
}
|
||
|
</script>
|
||
| app/views/projects/_form.html.erb (working copy) | ||
|---|---|---|
|
<fieldset class="box tabular" id="project_trackers"><legend><%=l(:label_tracker_plural)%></legend>
|
||
|
<% @trackers.each do |tracker| %>
|
||
|
<label class="floating">
|
||
|
<%= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.to_a.include?(tracker), :id => nil %>
|
||
|
<%= tracker %>
|
||
|
<div class="tooltip_wrapper">
|
||
|
<%= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.to_a.include?(tracker), :id => nil %>
|
||
|
<%= tracker %>
|
||
|
<div class="tooltip_body">
|
||
|
<p class="tooltip_title"><%= tracker.name %></p>
|
||
|
<%= tracker.description %>
|
||
|
</div>
|
||
|
</div>
|
||
|
</label>
|
||
|
<% end %>
|
||
|
<%= hidden_field_tag 'project[tracker_ids][]', '' %>
|
||
| app/views/projects/show.html.erb (working copy) | ||
|---|---|---|
|
<% @trackers.each do |tracker| %>
|
||
|
<tr>
|
||
|
<td class="name">
|
||
|
<%= link_to tracker.name, project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id) %>
|
||
|
<div class="tooltip_wrapper">
|
||
|
<%= link_to tracker.name, project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id ) %>
|
||
|
<div class="tooltip_body">
|
||
|
<p class="tooltip_title"><%= tracker.name %></p>
|
||
|
<%= tracker.description %>
|
||
|
</div>
|
||
|
</div>
|
||
|
</td>
|
||
|
<td>
|
||
|
<%= link_to @open_issues_by_tracker[tracker].to_i, project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id) %>
|
||
| app/views/trackers/_form.html.erb (working copy) | ||
|---|---|---|
|
:required => true %>
|
||
|
</p>
|
||
|
<p><%= f.check_box :is_in_roadmap %></p>
|
||
|
<p><%= f.text_area :description, :rows => 4 %></p>
|
||
|
<p>
|
||
|
<label><%= l(:field_core_fields) %></label>
|
||
|
<% Tracker::CORE_FIELDS.each do |field| %>
|
||
| app/views/trackers/index.html.erb (working copy) | ||
|---|---|---|
|
<tbody>
|
||
|
<% for tracker in @trackers %>
|
||
|
<tr>
|
||
|
<td class="name"><%= link_to tracker.name, edit_tracker_path(tracker) %></td>
|
||
|
<td class="name">
|
||
|
<div class="tooltip_wrapper">
|
||
|
<%= link_to tracker.name, edit_tracker_path(tracker) %>
|
||
|
<div class="tooltip_body">
|
||
|
<p class="tooltip_title"><%= tracker.name %></p>
|
||
|
<%= tracker.description %>
|
||
|
</div>
|
||
|
</div>
|
||
|
</td>
|
||
|
<td>
|
||
|
<% unless tracker.workflow_rules.exists? %>
|
||
|
<span class="icon icon-warning">
|
||
| db/migrate/20170503103500_add_trackers_description.rb (working copy) | ||
|---|---|---|
|
class AddTrackersDescription < ActiveRecord::Migration
|
||
|
def self.up
|
||
|
add_column :trackers, :description, :string
|
||
|
end
|
||
|
def self.down
|
||
|
remove_column :trackers, :description
|
||
|
end
|
||
|
end
|
||
| public/stylesheets/application.css (working copy) | ||
|---|---|---|
|
height:1px;
|
||
|
overflow:hidden;
|
||
|
}
|
||
|
/*--- Tooltip: Use to display template description -----*/
|
||
|
.tooltip_wrapper {
|
||
|
color: #555;
|
||
|
display: inline-block;
|
||
|
}
|
||
|
/* Hide tooltip body */
|
||
|
.tooltip_wrapper .tooltip_body {
|
||
|
display: none;
|
||
|
}
|
||
|
.tooltip_body .tooltip_title {
|
||
|
color: #979797;
|
||
|
font-weight: bold;
|
||
|
font-style: italic;
|
||
|
border-bottom: 1px solid #e4e4e4;
|
||
|
padding: 3px 0 3px 0;
|
||
|
margin-bottom: 4px;
|
||
|
}
|
||
|
/* Mouse over action */
|
||
|
.tooltip_wrapper:hover {
|
||
|
position: relative;
|
||
|
color: #333;
|
||
|
}
|
||
|
/* tooltip body */
|
||
|
.tooltip_wrapper:hover .tooltip_body {
|
||
|
text-align: left;
|
||
|
display: block;
|
||
|
position: absolute;
|
||
|
left: 60px;
|
||
|
top: 120%;
|
||
|
font-size: 90%;
|
||
|
background-color: #ffffff;
|
||
|
width: 260px;
|
||
|
padding: 8px 10px 12px;
|
||
|
border: 1px solid #CCCCCC;
|
||
|
z-index: 20000;
|
||
|
}
|
||
|
#trackers_description_dialog h4 {
|
||
|
color: #979797;
|
||
|
font-weight: bold;
|
||
|
border-bottom: solid 1px #c0c0c0;
|
||
|
}
|
||
|
#trackers_description_dialog h4.selected {
|
||
|
color: inherit;
|
||
|
font-style: italic;
|
||
|
}
|
||
|
#trackers_description_dialog td {
|
||
|
padding: 8px 8px; 8px 4px;
|
||
|
}
|
||