Repository navigation
Add routes section to edit question #3229
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,22 @@ | |
| <h2 class="govuk-heading-m"><%= t("pages.answer_settings") %></h2> | ||
| <%= render PageSettingsSummaryComponent::View.new(draft_question:, errors: question_input.errors) %> | ||
|
|
||
| <% unless is_new_page %> | ||
| <% routes_body_key = | ||
| if page_object.routing_conditions.any? | ||
| "has_routes_html" | ||
| elsif draft_question.answer_type == "selection" && draft_question.answer_settings[:only_one_option] == "true" && draft_question.answer_settings[:selection_options].length <= 10 | ||
| "body_html" | ||
| elsif page_object.has_next_page? | ||
| "skip_body_html" | ||
| end %> | ||
| <% if routes_body_key %> | ||
|
Comment on lines
+56
to
+64
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's quite a lot of logic happening in the view here - it might be worth moving some of it into a controller method or a view component
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (this isn't a blocker, and might make sense as a separate refactor PR after this one is merged) |
||
| <h2 class="govuk-heading-m"><%= t("pages.routes_section.heading") %></h2> | ||
| <p class="govuk-body"><%= t("pages.routes_section.#{routes_body_key}", routes_path: routes_path(form_id: form_object.id, anchor: page_object.page_position_id)) %></p> | ||
| <hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible" /> | ||
| <% end %> | ||
| <% end %> | ||
|
|
||
| <ul class="govuk-list govuk-list--spaced"> | ||
| <li> | ||
| <%= f.govuk_submit t('pages.submit_save'), class: "govuk-!-margin-bottom-3", name: "submit_type", value: "save" %> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.