]> source.dussan.org Git - redmine.git/commitdiff
Add CSS class for relation type to related issues list (#37532).
authorGo MAEDA <maeda@farend.jp>
Fri, 5 Aug 2022 00:20:56 +0000 (00:20 +0000)
committerGo MAEDA <maeda@farend.jp>
Fri, 5 Aug 2022 00:20:56 +0000 (00:20 +0000)
Patch by salman mp and Mizuki ISHIKAWA.

git-svn-id: https://svn.redmine.org/redmine/trunk@21757 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/issues_helper.rb
test/helpers/issues_helper_test.rb

index 3881fbe9ec0eb0ecc5e88a9555f68447c5c0b791..de4ca4435cb0cf4b234df06159a9e6b30159ea1f 100644 (file)
@@ -203,7 +203,7 @@ module IssuesHelper
     s = ''.html_safe
     relations.each do |relation|
       other_issue = relation.other_issue(issue)
-      css = "issue hascontextmenu #{other_issue.css_classes}"
+      css = "issue hascontextmenu #{other_issue.css_classes} #{relation.css_classes_for(other_issue)}"
       buttons =
         if manage_relations
           link_to(
index b1ee0eac62e2e5d77ef7f91721dacef668d266db..656f7d081b434c3c76fa16608f49e817ea32e0da 100644 (file)
@@ -406,6 +406,20 @@ class IssuesHelperTest < Redmine::HelperTest
     assert_include '<a href="/issues?issue_id=15%2C16&amp;set_filter=true&amp;status_id=c">1 closed</a>', html
   end
 
+  def test_render_issue_relations
+    issue = Issue.generate!(:status_id => 1)
+    closed_issue = Issue.generate!(:status_id => 5)
+    relation = IssueRelation.create!(:issue_from => closed_issue,
+                                     :issue_to => issue,
+                                     :relation_type => IssueRelation::TYPE_FOLLOWS)
+
+    html = render_issue_relations(issue, [relation])
+    assert_include "<tr id=\"relation-#{relation.id}\" class=\"issue hascontextmenu issue tracker-#{closed_issue.tracker_id} status-#{closed_issue.status_id} priority-#{closed_issue.priority_id} priority-default closed rel-follows\">", html
+
+    html = render_issue_relations(closed_issue, [relation])
+    assert_include "<tr id=\"relation-#{relation.id}\" class=\"issue hascontextmenu issue tracker-#{issue.tracker_id} status-#{issue.status_id} priority-#{issue.priority_id} priority-default rel-precedes\">", html
+  end
+
   def test_render_descendants_stats
     parent = Issue.generate!(:status_id => 1)
     child = Issue.generate!(:parent_issue_id => parent.id, :status_id => 1)