Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates text when example report is open #126

Merged
merged 3 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ GEM
json
lograge
railties
lr_common_styles (1.9.3)
lr_common_styles (1.9.4)
bootstrap-sass (~> 3.4.0)
font-awesome-rails (~> 4.7.0.1)
govuk_elements_rails (~> 2.0.0)
Expand Down Expand Up @@ -402,7 +402,7 @@ DEPENDENCIES
json_rails_logger (~> 1.0.0)!
leaflet-rails
libv8-node (>= 16.10.0.0)
lr_common_styles (~> 1.9.3)!
lr_common_styles (~> 1.9, >= 1.9.4)!
minitest-rails-capybara
minitest-reporters
minitest-spec-rails
Expand Down
16 changes: 16 additions & 0 deletions app/assets/javascripts/report_type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
document.addEventListener("DOMContentLoaded", function() {
document.querySelectorAll('details').forEach(function(detail) {
var summary = detail.querySelector('summary');
var span = summary.querySelector('span.summary');

detail.addEventListener('toggle', function() {
var isHidden = !detail.open;
span.textContent = span.textContent.replace(
isHidden ? 'close' : 'view',
isHidden ? 'view' : 'close'
);
});
});
});


10 changes: 5 additions & 5 deletions app/views/report_design/select_report.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
.row
%fieldset.col-sm-12
%ul.list-unstyled
%li
%li{"aria-labelled-by": "average-prices-report"}
.o-form-control
%label.o-form-control--label
= radio_button_tag( step.form_param, step_values[0].value, step_values[0].active?, class: "o-form-control--input" )
= step_values[0].label
%details
%summary
%summary#average-prices-report
%span.summary
Click to view an example of the average prices and volumes report type
%div.panel
= image_tag( "average-prices-report-screenshot.png", alt: "Screenshot of example average prices report " )
%li
%li{"aria-labelled-by": "banded-prices-report"}
.o-form-control
%label.o-form-control--label
= radio_button_tag( step.form_param, step_values[1].value, step_values[1].active?, class: "o-form-control--input" )
= step_values[1].label
%details
%summary
%summary#banded-prices-report
%span.summary
Clck to view an example of the banded prices report type
Click to view an example of the banded prices report type
%div.panel
= image_tag( "banded-prices-report-screenshot.png", alt: "Screenshot of example banded prices report " )

Expand Down