Feature #5201 » issue_5201_tracker_description.patch
app/helpers/issues_helper.rb (working copy) | ||
---|---|---|
188 | 188 |
end |
189 | 189 | |
190 | 190 |
def trackers_options_for_select(issue) |
191 |
trackers = trackers_for_select(issue) |
|
192 |
trackers.collect {|t| [t.name, t.id]} |
|
193 |
end |
|
194 | ||
195 |
def trackers_for_select(issue) |
|
191 | 196 |
trackers = issue.allowed_target_trackers |
192 | 197 |
if issue.new_record? && issue.parent_issue_id.present? |
193 | 198 |
trackers = trackers.reject do |tracker| |
194 | 199 |
issue.tracker_id != tracker.id && tracker.disabled_core_fields.include?('parent_issue_id') |
195 | 200 |
end |
196 | 201 |
end |
197 |
trackers.collect {|t| [t.name, t.id]}
|
|
202 |
trackers |
|
198 | 203 |
end |
199 | 204 | |
200 | 205 |
class IssueFieldsRows |
app/models/tracker.rb (working copy) | ||
---|---|---|
76 | 76 |
'core_fields', |
77 | 77 |
'position', |
78 | 78 |
'custom_field_ids', |
79 |
'project_ids' |
|
79 |
'project_ids', |
|
80 |
'description' |
|
80 | 81 | |
81 | 82 |
def to_s; name end |
82 | 83 |
app/views/issues/_form.html.erb (working copy) | ||
---|---|---|
15 | 15 |
<% end %> |
16 | 16 | |
17 | 17 |
<% if @issue.safe_attribute? 'tracker_id' %> |
18 |
<p><%= f.select :tracker_id, trackers_options_for_select(@issue), {:required => true}, |
|
19 |
:onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %></p> |
|
18 |
<p> |
|
19 |
<%= f.select :tracker_id, trackers_options_for_select(@issue), {:required => true}, |
|
20 |
:onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %> |
|
21 |
<a class="icon icon-help" href="#" id="display_tracker_description"> |
|
22 |
<%=h l(:label_description_for_trackers, default: 'Descriptions for trackers') %> |
|
23 |
</a> |
|
24 |
</p> |
|
20 | 25 |
<% end %> |
21 | 26 | |
27 |
<%= render partial: 'issues/tracker_description', locals: { trackers: trackers_for_select(@issue) } %> |
|
22 | 28 |
<% if @issue.safe_attribute? 'subject' %> |
23 | 29 |
<p><%= f.text_field :subject, :size => 80, :maxlength => 255, :required => true %></p> |
24 | 30 |
<% end %> |
app/views/issues/_tracker_description.html.erb (working copy) | ||
---|---|---|
1 |
<!-- dialog box --> |
|
2 |
<div id="trackers_description_dialog" style="overflow:visible; display: none;"> |
|
3 |
<h3 class="title"><%= l(:label_description_for_trackers, default: 'Descriptions for trackers') %></h3> |
|
4 |
<table class="list trackers odd-even"> |
|
5 |
<thead> |
|
6 |
<th><%= l(:field_description) %></th> |
|
7 |
<th><%= l(:button_apply) %></th> |
|
8 |
</thead> |
|
9 |
<tbody> |
|
10 |
<% trackers.each do |tracker| %> |
|
11 |
<tr class="<%= cycle("odd", "even") %>" name="<%= tracker['id'] %>"> |
|
12 |
<td class="description"> |
|
13 |
<h4><%= tracker['name'] %></h4> |
|
14 |
<%= textilizable(tracker['description']) %> |
|
15 |
</td> |
|
16 |
<td> |
|
17 |
<a href="#" class="icon icon-test" title="<%= l(:button_apply) %>" |
|
18 |
onclick="applyTracker(<%= tracker['id'] %>, false); return false;"></a> |
|
19 |
</td> |
|
20 |
</tr> |
|
21 |
<% end %> |
|
22 |
</tbody> |
|
23 |
</table> |
|
24 |
</div> |
|
25 |
<!-- dialog box --> |
|
26 | ||
27 |
<script type="text/javascript"> |
|
28 |
//<![CDATA[ |
|
29 |
$(document).ready(function () { |
|
30 |
$("#display_tracker_description").click(function (e) { |
|
31 |
e.preventDefault(); |
|
32 |
showModal('trackers_description_dialog', '500px'); |
|
33 |
var selected_tracker_id = $('#issue_tracker_id').val(); |
|
34 |
updateSelect(selected_tracker_id); |
|
35 |
}); |
|
36 |
}); |
|
37 | ||
38 |
function applyTracker(id) { |
|
39 |
var target = $('#issue_tracker_id'); |
|
40 |
target.attr("selected", false); |
|
41 |
target.find('option[value="' + id + '"]').prop('selected', true); |
|
42 |
target.trigger('change'); |
|
43 |
updateSelect(id); |
|
44 |
} |
|
45 | ||
46 |
function updateSelect(id) { |
|
47 |
var target = $("tr[name='" + id + "'] td h4"); |
|
48 |
$('td h4').not(target).removeClass('selected'); |
|
49 |
$(target).addClass('selected'); |
|
50 |
} |
|
51 |
</script> |
|
52 |
app/views/projects/_form.html.erb (working copy) | ||
---|---|---|
53 | 53 |
<fieldset class="box tabular" id="project_trackers"><legend><%=l(:label_tracker_plural)%></legend> |
54 | 54 |
<% @trackers.each do |tracker| %> |
55 | 55 |
<label class="floating"> |
56 |
<%= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.to_a.include?(tracker), :id => nil %> |
|
57 |
<%= tracker %> |
|
56 |
<div class="tooltip_wrapper"> |
|
57 |
<%= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.to_a.include?(tracker), :id => nil %> |
|
58 |
<%= tracker %> |
|
59 |
<div class="tooltip_body"> |
|
60 |
<p class="tooltip_title"><%= tracker.name %></p> |
|
61 |
<%= tracker.description %> |
|
62 |
</div> |
|
63 |
</div> |
|
58 | 64 |
</label> |
59 | 65 |
<% end %> |
60 | 66 |
<%= hidden_field_tag 'project[tracker_ids][]', '' %> |
app/views/projects/show.html.erb (working copy) | ||
---|---|---|
51 | 51 |
<% @trackers.each do |tracker| %> |
52 | 52 |
<tr> |
53 | 53 |
<td class="name"> |
54 |
<%= link_to tracker.name, project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id) %> |
|
54 |
<div class="tooltip_wrapper"> |
|
55 |
<%= link_to tracker.name, project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id ) %> |
|
56 |
<div class="tooltip_body"> |
|
57 |
<p class="tooltip_title"><%= tracker.name %></p> |
|
58 |
<%= tracker.description %> |
|
59 |
</div> |
|
60 |
</div> |
|
55 | 61 |
</td> |
56 | 62 |
<td> |
57 | 63 |
<%= 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) | ||
---|---|---|
10 | 10 |
:required => true %> |
11 | 11 |
</p> |
12 | 12 |
<p><%= f.check_box :is_in_roadmap %></p> |
13 |
<p><%= f.text_area :description, :rows => 4 %></p> |
|
13 | 14 |
<p> |
14 | 15 |
<label><%= l(:field_core_fields) %></label> |
15 | 16 |
<% Tracker::CORE_FIELDS.each do |field| %> |
app/views/trackers/index.html.erb (working copy) | ||
---|---|---|
14 | 14 |
<tbody> |
15 | 15 |
<% for tracker in @trackers %> |
16 | 16 |
<tr> |
17 |
<td class="name"><%= link_to tracker.name, edit_tracker_path(tracker) %></td> |
|
17 |
<td class="name"> |
|
18 |
<div class="tooltip_wrapper"> |
|
19 |
<%= link_to tracker.name, edit_tracker_path(tracker) %> |
|
20 |
<div class="tooltip_body"> |
|
21 |
<p class="tooltip_title"><%= tracker.name %></p> |
|
22 |
<%= tracker.description %> |
|
23 |
</div> |
|
24 |
</div> |
|
25 |
</td> |
|
18 | 26 |
<td> |
19 | 27 |
<% unless tracker.workflow_rules.exists? %> |
20 | 28 |
<span class="icon icon-warning"> |
db/migrate/20170503103500_add_trackers_description.rb (working copy) | ||
---|---|---|
1 |
class AddTrackersDescription < ActiveRecord::Migration |
|
2 |
def self.up |
|
3 |
add_column :trackers, :description, :string |
|
4 |
end |
|
5 | ||
6 |
def self.down |
|
7 |
remove_column :trackers, :description |
|
8 |
end |
|
9 |
end |
public/stylesheets/application.css (working copy) | ||
---|---|---|
1462 | 1462 |
height:1px; |
1463 | 1463 |
overflow:hidden; |
1464 | 1464 |
} |
1465 | ||
1466 |
/*--- Tooltip: Use to display template description -----*/ |
|
1467 |
.tooltip_wrapper { |
|
1468 |
color: #555; |
|
1469 |
display: inline-block; |
|
1470 |
} |
|
1471 | ||
1472 |
/* Hide tooltip body */ |
|
1473 |
.tooltip_wrapper .tooltip_body { |
|
1474 |
display: none; |
|
1475 |
} |
|
1476 | ||
1477 |
.tooltip_body .tooltip_title { |
|
1478 |
color: #979797; |
|
1479 |
font-weight: bold; |
|
1480 |
font-style: italic; |
|
1481 |
border-bottom: 1px solid #e4e4e4; |
|
1482 |
padding: 3px 0 3px 0; |
|
1483 |
margin-bottom: 4px; |
|
1484 |
} |
|
1485 | ||
1486 |
/* Mouse over action */ |
|
1487 |
.tooltip_wrapper:hover { |
|
1488 |
position: relative; |
|
1489 |
color: #333; |
|
1490 |
} |
|
1491 | ||
1492 |
/* tooltip body */ |
|
1493 |
.tooltip_wrapper:hover .tooltip_body { |
|
1494 |
text-align: left; |
|
1495 |
display: block; |
|
1496 |
position: absolute; |
|
1497 |
left: 60px; |
|
1498 |
top: 120%; |
|
1499 |
font-size: 90%; |
|
1500 |
background-color: #ffffff; |
|
1501 |
width: 260px; |
|
1502 |
padding: 8px 10px 12px; |
|
1503 |
border: 1px solid #CCCCCC; |
|
1504 |
z-index: 20000; |
|
1505 |
} |
|
1506 | ||
1507 |
#trackers_description_dialog h4 { |
|
1508 |
color: #979797; |
|
1509 |
font-weight: bold; |
|
1510 |
border-bottom: solid 1px #c0c0c0; |
|
1511 |
} |
|
1512 | ||
1513 |
#trackers_description_dialog h4.selected { |
|
1514 |
color: inherit; |
|
1515 |
font-style: italic; |
|
1516 |
} |
|
1517 | ||
1518 |
#trackers_description_dialog td { |
|
1519 |
padding: 8px 8px; 8px 4px; |
|
1520 |
} |
|
1521 |