From 3489f08ec5442cbf10bdd19ca0e421cd225f3089 Mon Sep 17 00:00:00 2001 From: Konrad Date: Tue, 25 Oct 2022 00:31:00 +0200 Subject: [PATCH 1/3] Format reports as list, even if only one sub-type available --- app/views/admin/reports/index.html.haml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/views/admin/reports/index.html.haml b/app/views/admin/reports/index.html.haml index 9ec68931fa..04bb24c088 100644 --- a/app/views/admin/reports/index.html.haml +++ b/app/views/admin/reports/index.html.haml @@ -14,7 +14,9 @@ = I18n.t(:name, scope: [:admin, :reports, report_type]) %td - if report_subtypes.empty? - - name = I18n.t(:name, scope: [:admin, :reports, report_type]) - - url = main_app.admin_report_url(report_type: report_type) - = link_to name, url + %ul{style: "margin-left: 12pt"} + %li + - name = I18n.t(:name, scope: [:admin, :reports, report_type]) + - url = main_app.admin_report_url(report_type: report_type) + = link_to name, url = render partial: "report_subtype", locals: { report_subtypes: report_subtypes, report_type: report_type } From e16c8661a2bcbcfe8a02f1a58fd732084ef9d709 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Tue, 25 Oct 2022 15:27:43 +0200 Subject: [PATCH 2/3] Use the same template even if there is no sub_report --- app/views/admin/reports/index.html.haml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/views/admin/reports/index.html.haml b/app/views/admin/reports/index.html.haml index 04bb24c088..9f898717c7 100644 --- a/app/views/admin/reports/index.html.haml +++ b/app/views/admin/reports/index.html.haml @@ -14,9 +14,7 @@ = I18n.t(:name, scope: [:admin, :reports, report_type]) %td - if report_subtypes.empty? - %ul{style: "margin-left: 12pt"} - %li - - name = I18n.t(:name, scope: [:admin, :reports, report_type]) - - url = main_app.admin_report_url(report_type: report_type) - = link_to name, url + - name = I18n.t(:name, scope: [:admin, :reports, report_type]) + - url = main_app.admin_report_url(report_type: report_type) + - report_subtypes = [[name, url]] = render partial: "report_subtype", locals: { report_subtypes: report_subtypes, report_type: report_type } From 9f9d8020c17be251d9d8e4b5403f15a20f6b2846 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Wed, 26 Oct 2022 11:53:25 +1100 Subject: [PATCH 3/3] Fix URL generation for report without subtype The URL is generated in the partial and it just needs to know that there's no subtype. --- app/views/admin/reports/index.html.haml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/admin/reports/index.html.haml b/app/views/admin/reports/index.html.haml index 9f898717c7..da6e461808 100644 --- a/app/views/admin/reports/index.html.haml +++ b/app/views/admin/reports/index.html.haml @@ -15,6 +15,5 @@ %td - if report_subtypes.empty? - name = I18n.t(:name, scope: [:admin, :reports, report_type]) - - url = main_app.admin_report_url(report_type: report_type) - - report_subtypes = [[name, url]] + - report_subtypes = [[name, nil]] = render partial: "report_subtype", locals: { report_subtypes: report_subtypes, report_type: report_type }