@@ -16,6 +16,8 | |||
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | class IssueRelationsController < ApplicationController |
|
19 | helper :issues | |
|
20 | ||
|
19 | 21 | before_action :find_issue, :authorize, :only => [:index, :create] |
|
20 | 22 | before_action :find_relation, :only => [:show, :destroy] |
|
21 | 23 |
@@ -106,6 +106,37 module IssuesHelper | |||
|
106 | 106 | s.html_safe |
|
107 | 107 | end |
|
108 | 108 | |
|
109 | # Renders the list of related issues on the issue details view | |
|
110 | def render_issue_relations(issue, relations) | |
|
111 | manage_relations = User.current.allowed_to?(:manage_issue_relations, issue.project) | |
|
112 | ||
|
113 | s = ''.html_safe | |
|
114 | relations.each do |relation| | |
|
115 | other_issue = relation.other_issue(issue) | |
|
116 | css = "issue hascontextmenu #{other_issue.css_classes}" | |
|
117 | link = manage_relations ? link_to(l(:label_relation_delete), | |
|
118 | relation_path(relation), | |
|
119 | :remote => true, | |
|
120 | :method => :delete, | |
|
121 | :data => {:confirm => l(:text_are_you_sure)}, | |
|
122 | :title => l(:label_relation_delete), | |
|
123 | :class => 'icon-only icon-link-break' | |
|
124 | ) : nil | |
|
125 | ||
|
126 | s << content_tag('tr', | |
|
127 | content_tag('td', check_box_tag("ids[]", other_issue.id, false, :id => nil), :class => 'checkbox') + | |
|
128 | content_tag('td', relation.to_s(@issue) {|other| link_to_issue(other, :project => Setting.cross_project_issue_relations?)}.html_safe, :class => 'subject', :style => 'width: 50%') + | |
|
129 | content_tag('td', other_issue.status, :class => 'status') + | |
|
130 | content_tag('td', other_issue.start_date, :class => 'start_date') + | |
|
131 | content_tag('td', other_issue.due_date, :class => 'due_date') + | |
|
132 | content_tag('td', link, :class => 'buttons'), | |
|
133 | :id => "relation-#{relation.id}", | |
|
134 | :class => css) | |
|
135 | end | |
|
136 | ||
|
137 | content_tag('table', s, :class => 'list issues') | |
|
138 | end | |
|
139 | ||
|
109 | 140 | def issue_estimated_hours_details(issue) |
|
110 | 141 | if issue.total_estimated_hours.present? |
|
111 | 142 | if issue.total_estimated_hours == issue.estimated_hours |
@@ -8,28 +8,7 | |||
|
8 | 8 | |
|
9 | 9 | <% if @relations.present? %> |
|
10 | 10 | <%= form_tag({}, :data => {:cm_url => issues_context_menu_path}) do %> |
|
11 | <table class="list issues"> | |
|
12 | <% @relations.each do |relation| %> | |
|
13 | <% other_issue = relation.other_issue(@issue) -%> | |
|
14 | <tr class="issue hascontextmenu <%= other_issue.css_classes %>" id="relation-<%= relation.id %>"> | |
|
15 | <td class="checkbox"><%= check_box_tag("ids[]", other_issue.id, false, :id => nil) %></td> | |
|
16 | <td class="subject" style="width: 50%"> | |
|
17 | <%= relation.to_s(@issue) {|other| link_to_issue(other, :project => Setting.cross_project_issue_relations?)}.html_safe %> | |
|
18 | </td> | |
|
19 | <td class="status"><%= other_issue.status.name %></td> | |
|
20 | <td class="start_date"><%= format_date(other_issue.start_date) %></td> | |
|
21 | <td class="due_date"><%= format_date(other_issue.due_date) %></td> | |
|
22 | <td class="buttons"><%= link_to(l(:label_relation_delete), | |
|
23 | relation_path(relation), | |
|
24 | :remote => true, | |
|
25 | :method => :delete, | |
|
26 | :data => {:confirm => l(:text_are_you_sure)}, | |
|
27 | :title => l(:label_relation_delete), | |
|
28 | :class => 'icon-only icon-link-break' | |
|
29 | ) if User.current.allowed_to?(:manage_issue_relations, @project) %></td> | |
|
30 | </tr> | |
|
31 | <% end %> | |
|
32 | </table> | |
|
11 | <%= render_issue_relations(@issue, @relations) %> | |
|
33 | 12 | <% end %> |
|
34 | 13 | <% end %> |
|
35 | 14 |
General Comments 0
You need to be logged in to leave comments.
Login now