git-svn-id: http://svn.redmine.org/redmine/trunk@15981 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/3.4.0
@@ -16,6 +16,8 @@ | |||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
class IssueRelationsController < ApplicationController | |||
helper :issues | |||
before_action :find_issue, :authorize, :only => [:index, :create] | |||
before_action :find_relation, :only => [:show, :destroy] | |||
@@ -106,6 +106,37 @@ module IssuesHelper | |||
s.html_safe | |||
end | |||
# Renders the list of related issues on the issue details view | |||
def render_issue_relations(issue, relations) | |||
manage_relations = User.current.allowed_to?(:manage_issue_relations, issue.project) | |||
s = ''.html_safe | |||
relations.each do |relation| | |||
other_issue = relation.other_issue(issue) | |||
css = "issue hascontextmenu #{other_issue.css_classes}" | |||
link = manage_relations ? link_to(l(:label_relation_delete), | |||
relation_path(relation), | |||
:remote => true, | |||
:method => :delete, | |||
:data => {:confirm => l(:text_are_you_sure)}, | |||
:title => l(:label_relation_delete), | |||
:class => 'icon-only icon-link-break' | |||
) : nil | |||
s << content_tag('tr', | |||
content_tag('td', check_box_tag("ids[]", other_issue.id, false, :id => nil), :class => 'checkbox') + | |||
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%') + | |||
content_tag('td', other_issue.status, :class => 'status') + | |||
content_tag('td', other_issue.start_date, :class => 'start_date') + | |||
content_tag('td', other_issue.due_date, :class => 'due_date') + | |||
content_tag('td', link, :class => 'buttons'), | |||
:id => "relation-#{relation.id}", | |||
:class => css) | |||
end | |||
content_tag('table', s, :class => 'list issues') | |||
end | |||
def issue_estimated_hours_details(issue) | |||
if issue.total_estimated_hours.present? | |||
if issue.total_estimated_hours == issue.estimated_hours |
@@ -8,28 +8,7 @@ | |||
<% if @relations.present? %> | |||
<%= form_tag({}, :data => {:cm_url => issues_context_menu_path}) do %> | |||
<table class="list issues"> | |||
<% @relations.each do |relation| %> | |||
<% other_issue = relation.other_issue(@issue) -%> | |||
<tr class="issue hascontextmenu <%= other_issue.css_classes %>" id="relation-<%= relation.id %>"> | |||
<td class="checkbox"><%= check_box_tag("ids[]", other_issue.id, false, :id => nil) %></td> | |||
<td class="subject" style="width: 50%"> | |||
<%= relation.to_s(@issue) {|other| link_to_issue(other, :project => Setting.cross_project_issue_relations?)}.html_safe %> | |||
</td> | |||
<td class="status"><%= other_issue.status.name %></td> | |||
<td class="start_date"><%= format_date(other_issue.start_date) %></td> | |||
<td class="due_date"><%= format_date(other_issue.due_date) %></td> | |||
<td class="buttons"><%= link_to(l(:label_relation_delete), | |||
relation_path(relation), | |||
:remote => true, | |||
:method => :delete, | |||
:data => {:confirm => l(:text_are_you_sure)}, | |||
:title => l(:label_relation_delete), | |||
:class => 'icon-only icon-link-break' | |||
) if User.current.allowed_to?(:manage_issue_relations, @project) %></td> | |||
</tr> | |||
<% end %> | |||
</table> | |||
<%= render_issue_relations(@issue, @relations) %> | |||
<% end %> | |||
<% end %> | |||