Skip to content

Commit

Permalink
Extract partials for exports
Browse files Browse the repository at this point in the history
The exports/index.html.haml was getting tall enough post-level B
exports to not be able to see the structure, so break it into four:

- fund_exports (External Income, Budget etc for each fund)
- level B (programme-level exports)
- ad-hoc
- partner organisation exports
  • Loading branch information
rgarner committed Jan 24, 2025
1 parent 6fd054b commit 22d897f
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 106 deletions.
27 changes: 27 additions & 0 deletions app/views/exports/_ad_hoc_exports.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
%h1.govuk-heading-m
Ad-hoc exports

%table.govuk-table
%thead.govuk-table__head
%tr.govuk-table__row
%th.govuk-table__header{scope: "col"}
Purpose
%th.govuk-table__header{scope: "col"}
= t("table.export.header.format")
%th.govuk-table__header{scope: "col"}
= t("table.header.default.actions")
%tbody.govuk-table__body
%tr.govuk-table__row
%td.govuk-table__cell
Activities continuing under GB-GOV-26
%td.govuk-table__cell
CSV
%td.govuk-table__cell
= a11y_action_link("Download", continuing_activities_exports_path(format: "csv"))
%tr.govuk-table__row
%td.govuk-table__cell
Activities not continuing under GB-GOV-26
%td.govuk-table__cell
CSV
%td.govuk-table__cell
= a11y_action_link("Download", non_continuing_activities_exports_path(format: "csv"))
40 changes: 40 additions & 0 deletions app/views/exports/_fund_exports.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
%table.govuk-table
%thead.govuk-table__head
%tr.govuk-table__row
%th.govuk-table__header{scope: "col"}
= t("table.export.header.fund")
%th.govuk-table__header{scope: "col"}
= t("table.export.header.format")
%th.govuk-table__header{scope: "col"}
= t("table.header.default.actions")
%tbody.govuk-table__body
- @funds.each do |fund|
%tr.govuk-table__row
%td.govuk-table__cell
= t("table.export.external_income.name", fund: fund.name)
%td.govuk-table__cell
CSV
%td.govuk-table__cell
= a11y_action_link("Download", external_income_exports_path(fund_id: fund.id, format: "csv"), t("table.export.external_income.name", fund: fund.name), ["govuk-link--no-visited-state"])
- @funds.each do |fund|
%tr.govuk-table__row
%td.govuk-table__cell
= t("table.export.budgets.name", fund: fund.name)
%td.govuk-table__cell
CSV
%td.govuk-table__cell
= a11y_action_link("Download", budgets_exports_path(fund_id: fund.id, format: "csv"), t("table.export.budgets.name", fund: fund.name), ["govuk-link--no-visited-state"])
- @funds.each do |fund|
%tr.govuk-table__row
%td.govuk-table__cell
= t("table.export.spending_breakdown.name", fund: fund.name)
%td.govuk-table__cell
CSV
%td.govuk-table__cell
- if fund.activity.spending_breakdown_filename
= a11y_action_link("Download", spending_breakdown_download_export_path(fund.id), t("table.export.spending_breakdown.name", fund: fund.name), ["govuk-link--no-visited-state"])
= "(last generated at #{l(fund.activity.spending_breakdown_generated_at, format: :detailed)})"
%br
= a11y_action_link("Request new", spending_breakdown_exports_path(fund_id: fund.id), t("table.export.spending_breakdown.name", fund: fund.name), ["govuk-link--no-visited-state"])
- else
= a11y_action_link("Request", spending_breakdown_exports_path(fund_id: fund.id), t("table.export.spending_breakdown.name", fund: fund.name), ["govuk-link--no-visited-state"])
21 changes: 21 additions & 0 deletions app/views/exports/_level_b_exports.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
%h1.govuk-heading-m
Level B exports

%table.govuk-table
%thead.govuk-table__head
%tr.govuk-table__row
%th.govuk-table__header{scope: "col"}
Fund
%th.govuk-table__header{scope: "col"}
= t("table.export.header.format")
%th.govuk-table__header{scope: "col"}
= t("table.header.default.actions")
%tbody.govuk-table__body
- @funds.each do |fund|
%tr.govuk-table__row
%td.govuk-table__cell
= t("table.export.level_b.name", fund: fund.name)
%td.govuk-table__cell
CSV
%td.govuk-table__cell
= a11y_action_link("Download", level_b_exports_path(fund_id: fund.id, format: "csv"), t("table.export.level_b.name", fund: fund.name), ["govuk-link--no-visited-state"])
18 changes: 18 additions & 0 deletions app/views/exports/_partner_organisation_exports.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
%h1.govuk-heading-m
= t("page_content.export.organisations.title")

%table.govuk-table
%thead.govuk-table__head
%tr.govuk-table__row
%th.govuk-table__header{scope: "col"}
= t("table.header.organisation.name")
%th.govuk-table__header{scope: "col"}
= t("table.header.default.actions")

%tbody.govuk-table__body
- @organisations.each do |organisation|
%tr.govuk-table__row
%td.govuk-table__cell
= organisation.name
%td.govuk-table__cell
= a11y_action_link("View exports", exports_organisation_path(organisation), "for #{organisation.name}", ["govuk-link--no-visited-state"])
110 changes: 4 additions & 106 deletions app/views/exports/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,113 +9,11 @@
.govuk-grid-row.activity-page
.govuk-grid-column-full

%table.govuk-table
%thead.govuk-table__head
%tr.govuk-table__row
%th.govuk-table__header{scope: "col"}
= t("table.export.header.fund")
%th.govuk-table__header{scope: "col"}
= t("table.export.header.format")
%th.govuk-table__header{scope: "col"}
= t("table.header.default.actions")
%tbody.govuk-table__body
- @funds.each do |fund|
%tr.govuk-table__row
%td.govuk-table__cell
= t("table.export.external_income.name", fund: fund.name)
%td.govuk-table__cell
CSV
%td.govuk-table__cell
= a11y_action_link("Download", external_income_exports_path(fund_id: fund.id, format: "csv"), t("table.export.external_income.name", fund: fund.name), ["govuk-link--no-visited-state"])
- @funds.each do |fund|
%tr.govuk-table__row
%td.govuk-table__cell
= t("table.export.budgets.name", fund: fund.name)
%td.govuk-table__cell
CSV
%td.govuk-table__cell
= a11y_action_link("Download", budgets_exports_path(fund_id: fund.id, format: "csv"), t("table.export.budgets.name", fund: fund.name), ["govuk-link--no-visited-state"])
- @funds.each do |fund|
%tr.govuk-table__row
%td.govuk-table__cell
= t("table.export.spending_breakdown.name", fund: fund.name)
%td.govuk-table__cell
CSV
%td.govuk-table__cell
- if fund.activity.spending_breakdown_filename
= a11y_action_link("Download", spending_breakdown_download_export_path(fund.id), t("table.export.spending_breakdown.name", fund: fund.name), ["govuk-link--no-visited-state"])
= "(last generated at #{l(fund.activity.spending_breakdown_generated_at, format: :detailed)})"
%br
= a11y_action_link("Request new", spending_breakdown_exports_path(fund_id: fund.id), t("table.export.spending_breakdown.name", fund: fund.name), ["govuk-link--no-visited-state"])
- else
= a11y_action_link("Request", spending_breakdown_exports_path(fund_id: fund.id), t("table.export.spending_breakdown.name", fund: fund.name), ["govuk-link--no-visited-state"])
= render partial: "fund_exports"

- if ROLLOUT.active?(:level_b_exports, current_user)
%h1.govuk-heading-m
Level B exports
= render partial: "level_b_exports"

%table.govuk-table
%thead.govuk-table__head
%tr.govuk-table__row
%th.govuk-table__header{scope: "col"}
Fund
%th.govuk-table__header{scope: "col"}
= t("table.export.header.format")
%th.govuk-table__header{scope: "col"}
= t("table.header.default.actions")
%tbody.govuk-table__body
- @funds.each do |fund|
%tr.govuk-table__row
%td.govuk-table__cell
= t("table.export.level_b.name", fund: fund.name)
%td.govuk-table__cell
CSV
%td.govuk-table__cell
= a11y_action_link("Download", level_b_exports_path(fund_id: fund.id, format: "csv"), t("table.export.level_b.name", fund: fund.name), ["govuk-link--no-visited-state"])
= render partial: "ad_hoc_exports"

%h1.govuk-heading-m
Ad-hoc exports

%table.govuk-table
%thead.govuk-table__head
%tr.govuk-table__row
%th.govuk-table__header{scope: "col"}
Purpose
%th.govuk-table__header{scope: "col"}
= t("table.export.header.format")
%th.govuk-table__header{scope: "col"}
= t("table.header.default.actions")
%tbody.govuk-table__body
%tr.govuk-table__row
%td.govuk-table__cell
Activities continuing under GB-GOV-26
%td.govuk-table__cell
CSV
%td.govuk-table__cell
= a11y_action_link("Download", continuing_activities_exports_path(format: "csv"))
%tr.govuk-table__row
%td.govuk-table__cell
Activities not continuing under GB-GOV-26
%td.govuk-table__cell
CSV
%td.govuk-table__cell
= a11y_action_link("Download", non_continuing_activities_exports_path(format: "csv"))

%h1.govuk-heading-m
= t("page_content.export.organisations.title")

%table.govuk-table
%thead.govuk-table__head
%tr.govuk-table__row
%th.govuk-table__header{scope: "col"}
= t("table.header.organisation.name")
%th.govuk-table__header{scope: "col"}
= t("table.header.default.actions")

%tbody.govuk-table__body
- @organisations.each do |organisation|
%tr.govuk-table__row
%td.govuk-table__cell
= organisation.name
%td.govuk-table__cell
= a11y_action_link("View exports", exports_organisation_path(organisation), "for #{organisation.name}", ["govuk-link--no-visited-state"])
= render partial: "partner_organisation_exports"

0 comments on commit 22d897f

Please sign in to comment.