From 46f18ae7ef442f2bae37f1713739a317a1f4565c Mon Sep 17 00:00:00 2001 From: Mischa The Evil Date: Tue, 3 Aug 2021 01:58:12 +0200 Subject: [PATCH] Dirty and untested POC for #35647. --- app/controllers/reports_controller.rb | 10 ++++++-- app/views/reports/_options_form.html.erb | 25 +++++++++++++++++++ app/views/reports/issue_report.html.erb | 18 +++++++------ .../reports/issue_report_details.html.erb | 6 +++-- public/stylesheets/application.css | 2 +- 5 files changed, 49 insertions(+), 12 deletions(-) create mode 100644 app/views/reports/_options_form.html.erb diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index bc9605b6d..1e1a48219 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -22,7 +22,10 @@ class ReportsController < ApplicationController before_action :find_project, :authorize, :find_issue_statuses def issue_report - with_subprojects = Setting.display_subprojects_issues? + @with_subprojects = params[:with_subprojects] || (Setting.display_subprojects_issues? ? 'true' : 'false') + @with_subprojects = 'false' unless %w(true false).include?(@with_subprojects) + with_subprojects = (@with_subprojects == 'true' ? true : false) + @trackers = @project.rolled_up_trackers(with_subprojects).visible @versions = @project.shared_versions.sorted @priorities = IssuePriority.all.reverse @@ -42,7 +45,10 @@ class ReportsController < ApplicationController end def issue_report_details - with_subprojects = Setting.display_subprojects_issues? + @with_subprojects = params[:with_subprojects] || (Setting.display_subprojects_issues? ? 'true' : 'false') + @with_subprojects = 'false' unless %w(true false).include?(@with_subprojects) + with_subprojects = (@with_subprojects == 'true' ? true : false) + case params[:detail] when "tracker" @field = "tracker_id" diff --git a/app/views/reports/_options_form.html.erb b/app/views/reports/_options_form.html.erb new file mode 100644 index 000000000..2d5959635 --- /dev/null +++ b/app/views/reports/_options_form.html.erb @@ -0,0 +1,25 @@ +
+
+ +
+
\ No newline at end of file diff --git a/app/views/reports/issue_report.html.erb b/app/views/reports/issue_report.html.erb index 63d05e6e3..def3cdf0d 100644 --- a/app/views/reports/issue_report.html.erb +++ b/app/views/reports/issue_report.html.erb @@ -1,11 +1,15 @@

<%=l(:label_report_plural)%>

+<% has_subproject = @project.children.any? %> + +<%= render :partial => 'options_form' if has_subproject %> +

<%=l(:field_tracker)%>  <%= link_to l(:label_details), - project_issues_report_details_path(@project, :detail => 'tracker'), + project_issues_report_details_path(@project, :detail => 'tracker', :with_subprojects => @with_subprojects), :class => 'icon-only icon-zoom-in', :title => l(:label_details) %>

@@ -14,7 +18,7 @@

<%=l(:field_priority)%>  <%= link_to l(:label_details), - project_issues_report_details_path(@project, :detail => 'priority'), + project_issues_report_details_path(@project, :detail => 'priority', :with_subprojects => @with_subprojects), :class => 'icon-only icon-zoom-in', :title => l(:label_details) %>

@@ -23,7 +27,7 @@

<%=l(:field_assigned_to)%>  <%= link_to l(:label_details), - project_issues_report_details_path(@project, :detail => 'assigned_to'), + project_issues_report_details_path(@project, :detail => 'assigned_to', :with_subprojects => @with_subprojects), :class => 'icon-only icon-zoom-in', :title => l(:label_details) %>

@@ -32,7 +36,7 @@

<%=l(:field_author)%>  <%= link_to l(:label_details), - project_issues_report_details_path(@project, :detail => 'author'), + project_issues_report_details_path(@project, :detail => 'author', :with_subprojects => @with_subprojects), :class => 'icon-only icon-zoom-in', :title => l(:label_details) %>

@@ -45,13 +49,13 @@

<%=l(:field_version)%>  <%= link_to l(:label_details), - project_issues_report_details_path(@project, :detail => 'version'), + project_issues_report_details_path(@project, :detail => 'version', :with_subprojects => @with_subprojects), :class => 'icon-only icon-zoom-in', :title => l(:label_details) %>

<%= render :partial => 'simple', :locals => { :data => @issues_by_version, :field_name => "fixed_version_id", :rows => @versions } %>
-<% if @project.children.any? %> +<% if has_subproject %>

<%=l(:field_subproject)%>  <%= link_to l(:label_details), @@ -65,7 +69,7 @@

<%=l(:field_category)%>  <%= link_to l(:label_details), - project_issues_report_details_path(@project, :detail => 'category'), + project_issues_report_details_path(@project, :detail => 'category', :with_subprojects => @with_subprojects), :class => 'icon-only icon-zoom-in', :title => l(:label_details) %>

diff --git a/app/views/reports/issue_report_details.html.erb b/app/views/reports/issue_report_details.html.erb index 201ba1b10..34906d6f3 100644 --- a/app/views/reports/issue_report_details.html.erb +++ b/app/views/reports/issue_report_details.html.erb @@ -1,6 +1,8 @@ -

<%= link_to l(:label_report_plural), project_issues_report_path(@project) %> »

+

<%= link_to l(:label_report_plural), project_issues_report_path(@project, :with_subprojects => @with_subprojects) %> »

+ +<%= render :partial => 'options_form' if @project.children.any? %>

<%=@report_title%>

<%= render :partial => 'details', :locals => { :data => @data, :field_name => @field, :rows => @rows } %>
-<%= link_to l(:button_back), project_issues_report_path(@project) %> +<%= link_to l(:button_back), project_issues_report_path(@project, :with_subprojects => @with_subprojects) %> diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index e117bc1d0..6007e8f27 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -391,7 +391,7 @@ table.boards td.last-message {text-align:left;font-size:80%;} div.table-list.boards .table-list-cell.name {width: 30%;} -#query_form_content {font-size:90%;} +#query_form_content, #options_form_content {font-size:90%;} #query_form_with_buttons > p.contextual {font-size:12px; margin:12px 0px;} .query_sort_criteria_count { -- 2.26.0.windows.1