Feature #42477 » 0001-Configurable-columns-for-related-and-sub-issues-list.patch
| app/assets/stylesheets/application.css | ||
|---|---|---|
|
table.list table.progress td {padding-right:0px;}
|
||
|
table.list caption { text-align: left; padding: 0.5em 0.5em 0.5em 0; }
|
||
|
table.list tr.overdue td.due_date { color: #c22; }
|
||
|
table.list thead.related-issues th { background-color: inherit; font-size: 11px; border: none; }
|
||
|
#role-permissions-trackers table.list th {white-space:normal;}
|
||
|
.table-list-cell {display: table-cell; vertical-align: top; padding:2px; }
|
||
| app/helpers/issues_helper.rb | ||
|---|---|---|
|
s.html_safe
|
||
|
end
|
||
|
def get_related_issues_columns_for_project(issue)
|
||
|
query = IssueQuery.new project: issue.project
|
||
|
available_columns = query.available_inline_columns
|
||
|
column_names = Setting.related_issues_default_columns
|
||
|
(column_names - %w[tracker subject]).map do |name|
|
||
|
available_columns.find { |f| f.name.to_s == name }
|
||
|
end.compact
|
||
|
end
|
||
|
def render_descendants_tree(issue)
|
||
|
columns_list = get_related_issues_columns_for_project(issue)
|
||
|
manage_relations = User.current.allowed_to?(:manage_subtasks, issue.project)
|
||
|
s = +'<table class="list issues odd-even">'
|
||
|
if Setting.display_related_issues_table_headers?
|
||
|
headers = [l(:field_subject)]
|
||
|
headers += columns_list.map(&:caption)
|
||
|
s << content_tag(:thead, content_tag(:tr, safe_join(headers.map{|h| content_tag :th, h})), class: "related-issues")
|
||
|
end
|
||
|
issue_list(
|
||
|
issue.descendants.visible.
|
||
|
preload(:status, :priority, :tracker,
|
||
| ... | ... | |
|
"".html_safe
|
||
|
end
|
||
|
buttons << link_to_context_menu
|
||
|
s <<
|
||
|
content_tag(
|
||
|
'tr',
|
||
|
content_tag('td', check_box_tag("ids[]", child.id, false, :id => nil),
|
||
|
:class => 'checkbox') +
|
||
|
content_tag('td',
|
||
|
link_to_issue(
|
||
|
child,
|
||
|
: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',
|
||
|
(if child.disabled_core_fields.include?('done_ratio')
|
||
|
''
|
||
|
else
|
||
|
progress_bar(child.done_ratio)
|
||
|
end),
|
||
|
:class=> 'done_ratio') +
|
||
|
content_tag('td', buttons, :class => 'buttons'),
|
||
|
:class => css)
|
||
|
row_content =
|
||
|
content_tag('td', check_box_tag('ids[]', child.id, false, id: nil), class: 'checkbox') +
|
||
|
content_tag('td', link_to_issue(child, project: (issue.project_id != child.project_id)), class: 'subject')
|
||
|
columns_list.each do |column|
|
||
|
row_content << content_tag('td', column_content(column, child), class: column.css_classes.to_s)
|
||
|
end
|
||
|
row_content << content_tag('td', buttons, class: 'buttons')
|
||
|
s << content_tag('tr', row_content, class: css, id: "issue-#{child.id}").html_safe
|
||
|
end
|
||
|
s << '</table>'
|
||
|
s.html_safe
|
||
| ... | ... | |
|
# Renders the list of related issues on the issue details view
|
||
|
def render_issue_relations(issue, relations)
|
||
|
columns_list = get_related_issues_columns_for_project(issue)
|
||
|
manage_relations = User.current.allowed_to?(:manage_issue_relations, issue.project)
|
||
|
s = ''.html_safe
|
||
|
if Setting.display_related_issues_table_headers?
|
||
|
headers = [l(:field_subject)]
|
||
|
headers += columns_list.map(&:caption)
|
||
|
s = content_tag :thead, content_tag(:tr, safe_join(headers.map{|h| content_tag :th, h})), class: "related-issues"
|
||
|
end
|
||
|
relations.each do |relation|
|
||
|
other_issue = relation.other_issue(issue)
|
||
|
css = "issue hascontextmenu #{other_issue.css_classes} #{relation.css_classes_for(other_issue)}"
|
||
| ... | ... | |
|
"".html_safe
|
||
|
end
|
||
|
buttons << link_to_context_menu
|
||
|
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) do |other|
|
||
|
link_to_issue(
|
||
|
other,
|
||
|
:project => Setting.cross_project_issue_relations?
|
||
|
)
|
||
|
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',
|
||
|
(if other_issue.disabled_core_fields.include?('done_ratio')
|
||
|
''
|
||
|
else
|
||
|
progress_bar(other_issue.done_ratio)
|
||
|
end),
|
||
|
:class=> 'done_ratio') +
|
||
|
content_tag('td', buttons, :class => 'buttons'),
|
||
|
:id => "relation-#{relation.id}",
|
||
|
:class => css)
|
||
|
subject_content = relation.to_s(@issue) { |other| link_to_issue other, project: Setting.cross_project_issue_relations? }.html_safe
|
||
|
row_content =
|
||
|
content_tag('td', check_box_tag('ids[]', other_issue.id, false, id: nil), class: 'checkbox') +
|
||
|
content_tag('td', subject_content, class: 'subject')
|
||
|
columns_list.each do |column|
|
||
|
row_content << content_tag('td', column_content(column, other_issue), class: column.css_classes.to_s)
|
||
|
end
|
||
|
row_content << content_tag('td', buttons, class: 'buttons')
|
||
|
s << content_tag('tr', row_content, id: "relation-#{relation.id}", class: css)
|
||
|
end
|
||
|
content_tag('table', s, :class => 'list issues odd-even')
|
||
|
end
|
||
| app/views/settings/_issues.html.erb | ||
|---|---|---|
|
</p>
|
||
|
</fieldset>
|
||
|
<fieldset class="box">
|
||
|
<legend><%= l(:setting_related_issues_default_columns) %></legend>
|
||
|
<div id="list-definition">
|
||
|
<div>
|
||
|
<%= render_query_columns_selection(
|
||
|
IssueQuery.new(:column_names => Setting.related_issues_default_columns),
|
||
|
:name => 'settings[related_issues_default_columns]') %>
|
||
|
<%= javascript_tag do %>
|
||
|
$('#available_settings_related_issues_default_columns option[value="tracker"]').remove();
|
||
|
$('#available_settings_related_issues_default_columns option[value="subject"]').remove();
|
||
|
<% end %>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="tabular settings">
|
||
|
<p><%= setting_check_box :display_related_issues_table_headers %></p>
|
||
|
</div>
|
||
|
</fieldset>
|
||
|
<%= submit_tag l(:button_save) %>
|
||
|
<% end %>
|
||
| config/locales/de.yml | ||
|---|---|---|
|
setting_user_format: Benutzer-Anzeigeformat
|
||
|
setting_welcome_text: Willkommenstext
|
||
|
setting_wiki_compression: Wiki-Historie komprimieren
|
||
|
setting_related_issues_default_columns: Standard-Spalten für verknüpfte und untergeordnete Aufgaben
|
||
|
setting_display_related_issues_table_headers: Spaltenüberschriften anzeigen
|
||
|
status_active: aktiv
|
||
|
status_locked: gesperrt
|
||
| config/locales/en.yml | ||
|---|---|---|
|
setting_show_status_changes_in_mail_subject: Show status changes in issue mail notifications subject
|
||
|
setting_project_list_defaults: Projects list defaults
|
||
|
setting_twofa: Two-factor authentication
|
||
|
setting_related_issues_default_columns: Related and sub issues list defaults
|
||
|
setting_display_related_issues_table_headers: Show table headers
|
||
|
permission_add_project: Create project
|
||
|
permission_add_subprojects: Create subprojects
|
||
| config/settings.yml | ||
|---|---|---|
|
issue_list_default_totals:
|
||
|
serialized: true
|
||
|
default: []
|
||
|
related_issues_default_columns:
|
||
|
serialized: true
|
||
|
default:
|
||
|
- status
|
||
|
- assigned_to
|
||
|
- start_date
|
||
|
- due_date
|
||
|
- done_ratio
|
||
|
display_related_issues_table_headers:
|
||
|
default: 0
|
||
|
display_subprojects_issues:
|
||
|
default: 1
|
||
|
time_entry_list_defaults:
|
||
| test/functional/issues_controller_test.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
end
|
||
|
def test_related_issues_columns_setting
|
||
|
with_settings :related_issues_default_columns => ['status', 'total_estimated_hours'], display_related_issues_table_headers: 1 do
|
||
|
Issue.find(1).update!(parent_id: 2)
|
||
|
get :show, params: { id: 2 }
|
||
|
assert_response :success
|
||
|
assert_select 'thead.related-issues th', text: 'Subject'
|
||
|
assert_select 'thead.related-issues th', text: 'Status'
|
||
|
assert_select 'thead.related-issues th', text: 'Total estimated time'
|
||
|
end
|
||
|
end
|
||
|
end
|
||