From 648f7b4d622cb4fe5fcc7ed160c59ad25766f445 Mon Sep 17 00:00:00 2001 From: Mischa The Evil Date: Tue, 3 Aug 2021 03:23:54 +0200 Subject: [PATCH] Issues Show improvements. --- app/helpers/issues_helper.rb | 18 +++++++++--------- app/views/issues/show.html.erb | 24 ++++++++++++++++-------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index b8e1dd414..27f01d7fb 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -126,9 +126,9 @@ module IssuesHelper :project => (issue.project_id != child.project_id)), :class => 'subject') + content_tag('td', h(child.status), :class => 'status') + - content_tag('td', link_to_user(child.assigned_to), :class => 'assigned_to') + - content_tag('td', format_date(child.start_date), :class => 'start_date') + - content_tag('td', format_date(child.due_date), :class => 'due_date') + + content_tag('td', (child.assigned_to ? link_to_user(child.assigned_to) : "-"), :class => 'assigned_to') + + content_tag('td', (child.start_date ? format_date(child.start_date) : "-"), :class => 'start_date') + + content_tag('td', (child.due_date ? format_date(child.due_date) : "-"), :class => 'due_date') + content_tag('td', (if child.disabled_core_fields.include?('done_ratio') '' @@ -228,9 +228,9 @@ module IssuesHelper end.html_safe, :class => 'subject') + content_tag('td', other_issue.status, :class => 'status') + - content_tag('td', link_to_user(other_issue.assigned_to), :class => 'assigned_to') + - content_tag('td', format_date(other_issue.start_date), :class => 'start_date') + - content_tag('td', format_date(other_issue.due_date), :class => 'due_date') + + content_tag('td', (other_issue.assigned_to ? link_to_user(other_issue.assigned_to) : "-"), :class => 'assigned_to') + + content_tag('td', (other_issue.start_date ? format_date(other_issue.start_date) : "-"), :class => 'start_date') + + content_tag('td', (other_issue.start_date ? format_date(other_issue.due_date) : "-"), :class => 'due_date') + content_tag('td', (if other_issue.disabled_core_fields.include?('done_ratio') '' @@ -246,7 +246,7 @@ module IssuesHelper end def issue_estimated_hours_details(issue) - if issue.total_estimated_hours.present? + if issue.total_estimated_hours.present? && issue.total_estimated_hours > 0 if issue.total_estimated_hours == issue.estimated_hours l_hours_short(issue.estimated_hours) else @@ -366,7 +366,7 @@ module IssuesHelper issue_fields_rows do |rows| values.each_with_index do |value, i| m = (i < half ? :left : :right) - rows.send m, custom_field_name_tag(value.custom_field), custom_field_value_tag(value), :class => value.custom_field.css_classes + rows.send m, custom_field_name_tag(value.custom_field), (custom_field_value_tag(value).present? ? custom_field_value_tag(value) : "-"), :class => value.custom_field.css_classes end end end @@ -377,7 +377,7 @@ module IssuesHelper s = ''.html_safe values.each_with_index do |value, i| - attr_value_tag = custom_field_value_tag(value) + attr_value_tag = (custom_field_value_tag(value).present? ? custom_field_value_tag(value) : "-") next if attr_value_tag.blank? content = diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 6b84bdfb3..2c7daae4a 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -60,26 +60,26 @@ end unless @issue.disabled_core_fields.include?('start_date') - rows.right l(:field_start_date), format_date(@issue.start_date), :class => 'start-date' + rows.right l(:field_start_date), (@issue.start_date ? format_date(@issue.start_date) : "-"), :class => 'start-date' end unless @issue.disabled_core_fields.include?('due_date') - rows.right l(:field_due_date), issue_due_date_details(@issue), :class => 'due-date' + rows.right l(:field_due_date), (issue_due_date_details(@issue) ? issue_due_date_details(@issue) : "-"), :class => 'due-date' end unless @issue.disabled_core_fields.include?('done_ratio') rows.right l(:field_done_ratio), progress_bar(@issue.done_ratio, :legend => "#{@issue.done_ratio}%"), :class => 'progress' end unless @issue.disabled_core_fields.include?('estimated_hours') - rows.right l(:field_estimated_hours), issue_estimated_hours_details(@issue), :class => 'estimated-hours' + rows.right l(:field_estimated_hours), (issue_estimated_hours_details(@issue).present? ? issue_estimated_hours_details(@issue) : "-"), :class => 'estimated-hours' end - if User.current.allowed_to?(:view_time_entries, @project) && @issue.total_spent_hours > 0 - rows.right l(:label_spent_time), issue_spent_hours_details(@issue), :class => 'spent-time' + if User.current.allowed_to?(:view_time_entries, @project) + rows.right l(:label_spent_time), (issue_spent_hours_details(@issue).present? ? issue_spent_hours_details(@issue) : "-"), :class => 'spent-time' end end %> <%= render_half_width_custom_fields_rows(@issue) %> <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> -<% if @issue.description? %> +<% if @issue.description? && !@issue.disabled_core_fields.include?('description') %>
@@ -91,15 +91,23 @@ end %> <%= textilizable @issue, :description, :attachments => @issue.attachments %>
+<% elsif !@issue.description? && !@issue.disabled_core_fields.include?('description') %> +
+
+

<%=l(:field_description)%>

+
-
+
+<% else %> <% end %> + +<%= render_full_width_custom_fields_rows(@issue) %> + <% if @issue.attachments.any? %>

<%=l(:label_attachment_plural)%>

<%= link_to_attachments @issue, :thumbnails => true %> <% end %> -<%= render_full_width_custom_fields_rows(@issue) %> - <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> <% if !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %> -- 2.26.0.windows.1