]> source.dussan.org Git - redmine.git/commitdiff
Show open/closed badge on issue page (#33254).
authorGo MAEDA <maeda@farend.jp>
Thu, 23 Apr 2020 10:13:10 +0000 (10:13 +0000)
committerGo MAEDA <maeda@farend.jp>
Thu, 23 Apr 2020 10:13:10 +0000 (10:13 +0000)
Patch by Marius BALTEANU.

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

app/helpers/issue_statuses_helper.rb
app/helpers/issues_helper.rb
app/views/issues/show.html.erb
app/views/versions/index.html.erb
app/views/versions/show.html.erb
public/stylesheets/application.css
test/functional/issues_controller_test.rb

index 86cb872680fe05dfb842ccca171208c66684c036..c57b94233b2e672d4b901ea1a0ca7ff48e388bf3 100644 (file)
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 module IssueStatusesHelper
+  def issue_status_type_badge(status)
+    if status.is_closed?
+      content_tag('span', l(:label_closed_issues), class: 'badge badge-status-closed')
+    else
+      content_tag('span', l(:label_open_issues), class: 'badge badge-status-open')
+    end
+  end
 end
index f212f1a2a245f36f09f087c1417011640322d459..792c5a5082292a0bc75d0e892493c4303863fc75 100644 (file)
@@ -20,6 +20,7 @@
 module IssuesHelper
   include ApplicationHelper
   include Redmine::Export::PDF::IssuesPdfHelper
+  include IssueStatusesHelper
 
   def issue_list(issues, &block)
     ancestors = []
index 7c180a4d36cc0d11364cb58c8dee52cf1f4e63f6..5dcd833ac7b2b69d5d09b49c4c9ad6e0587ff5ea 100644 (file)
@@ -1,6 +1,7 @@
 <%= render :partial => 'action_menu' %>
 
-<h2><%= issue_heading(@issue) %></h2>
+<h2 class="inline-flex"><%= issue_heading(@issue) %></h2>
+<%= issue_status_type_badge(@issue.status) %>
 
 <div class="<%= @issue.css_classes %> details">
   <% if @prev_issue_id || @next_issue_id %>
index afe9b463c238e6e8dfc5242bab21ffc0f73308f6..61fbe05ab2be7aa188fddd937d8b1d0f10ad92d6 100644 (file)
@@ -22,7 +22,7 @@
       </div>
     <% end %>
     <header>
-      <h3 class="icon icon-package version"><%= link_to_version version, :name => version_anchor(version) %></h3>
+      <h3 class="icon icon-package version inline-flex"><%= link_to_version version, :name => version_anchor(version) %></h3>
       <span class="badge badge-status-<%= version.status %>"><%= l("version_status_#{version.status}") %></span>
     </header>
     <%= render :partial => 'versions/overview', :locals => {:version => version} %>
index d73485a8c4088014bb57db5cfa8a726da5ee27ec..0527eae9cc35020269929518548d9e3cdc56a427 100644 (file)
@@ -7,7 +7,7 @@
 </div>
 
 <div id="roadmap" class="<%= @version.css_classes %>">
-  <h2><%= @version.name %></h2>
+  <h2 class="inline-flex"><%= @version.name %></h2>
   <span class="badge badge-status-<%= @version.status %>"><%= l("version_status_#{@version.status}") %></span>
 
 <%= render :partial => 'versions/overview', :locals => {:version => @version} %>
index a7512bd48e28b8c09a3f0714c42039e3e97687a4..9c7baffa3a7114e14cdafb867d8ac21ce1670a48 100644 (file)
@@ -132,6 +132,7 @@ div.modal .box p {margin: 0.3em 0;}
 
 .mobile-show {display: none;}
 .hidden {display: none;}
+.inline-flex {display: inline-flex;}
 
 /***** Links *****/
 a, a:link, a:visited{ color: #169; text-decoration: none; }
@@ -532,6 +533,7 @@ div.issue .attributes .attribute {padding-left:180px; clear:left; min-height: 1.
 div.issue .attributes .attribute .label {width: 170px; margin-left:-180px; font-weight:bold; float:left;  overflow:hidden; text-overflow: ellipsis;}
 div.issue .attribute .value {overflow:auto; text-overflow: ellipsis;}
 div.issue.overdue .due-date .value { color: #c22; }
+body.controller-issues h2.inline-flex {padding-right: 0}
 
 #issue_tree table.issues, #relations table.issues { border: 0; }
 #issue_tree td.checkbox, #relations td.checkbox {display:none;}
@@ -614,7 +616,7 @@ div#roadmap .related-issues td.assigned_to img { padding-left: 4px; padding-righ
 div#roadmap .wiki h1:first-child { display: none; }
 div#roadmap .wiki h1 { font-size: 120%; }
 div#roadmap .wiki h2 { font-size: 110%; }
-div#roadmap h2, div#roadmap h3 { display: inline; padding-right: 0;}
+div#roadmap h2, div#roadmap h3 {padding-right: 0;}
 body.controller-versions.action-show div#roadmap .related-issues {width:70%;}
 
 div#version-summary { float:right; width:28%; margin-left: 16px; margin-bottom: 16px; background-color: #fff; }
index 6853abf1f703dea0cee11bf8bb3365aa75dca5f1..a33605bf999d4e20febf20c27150eb60a0e8edf8 100644 (file)
@@ -2995,6 +2995,20 @@ class IssuesControllerTest < Redmine::ControllerTest
     end
   end
 
+  def test_show_should_display_open_badge_for_open_issue
+    get :show, params: {id: 1}
+
+    assert_response :success
+    assert_select 'span.badge.badge-status-open', text: 'open'
+  end
+
+  def test_show_should_display_closed_badge_for_closed_issue
+    get :show, params: {id: 8}
+
+    assert_response :success
+    assert_select 'span.badge.badge-status-closed', text: 'closed'
+  end
+
   def test_get_new
     @request.session[:user_id] = 2
     get(