forked from alphagov/whitehall
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request alphagov#7161 from alphagov/0-world-news-story-js-…
…bugfix Fix a JS error by always rendering the foreign language only field
- Loading branch information
Showing
4 changed files
with
48 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,37 @@ | ||
<% if edition.locale_can_be_changed? %> | ||
<div class="edition-form--locale-fields"> | ||
<%= render "govuk_publishing_components/components/checkboxes", { | ||
name: "edition[create_foreign_language_only]", | ||
id: "edition_create_foreign_language_only", | ||
heading: "Foreign language only #{edition.model_name.human.downcase}", | ||
heading_size: "l", | ||
no_hint_text: true, | ||
error_items: errors_for_input(edition.errors, :create_foreign_language_only), | ||
items: [ | ||
{ | ||
label: "Create a foreign language only #{edition.model_name.human.downcase}", | ||
value: "1", | ||
checked: form.object.primary_locale != "en", | ||
conditional: (render "govuk_publishing_components/components/select", { | ||
id: "edition_primary_locale", | ||
name: "edition[primary_locale]", | ||
label: "Document language", | ||
heading_size: "s", | ||
full_width: true, | ||
allow_blank: true, | ||
errors: errors_for(edition.errors, :primary_locale), | ||
options: ([nil] + options_for_locales(Locale.non_english)).map do |language, value| | ||
{ | ||
text: language, | ||
value: value, | ||
selected: edition.primary_locale == value | ||
} | ||
end | ||
}) | ||
} | ||
] | ||
} %> | ||
<div class="app-view-edit-edition__locale-field <%= "app-view-edit-edition__locale-field--hidden" unless edition.locale_can_be_changed? && (edition.is_a?(Consultation) || edition.is_a?(NewsArticle) && edition.world_news_story?) %>"> | ||
<%= render "govuk_publishing_components/components/checkboxes", { | ||
name: "edition[create_foreign_language_only]", | ||
id: "edition_create_foreign_language_only", | ||
heading: "Foreign language only #{edition.model_name.human.downcase}", | ||
heading_size: "l", | ||
no_hint_text: true, | ||
error_items: errors_for_input(edition.errors, :create_foreign_language_only), | ||
items: [ | ||
{ | ||
label: "Create a foreign language only #{edition.model_name.human.downcase}", | ||
value: "1", | ||
checked: form.object.primary_locale != "en", | ||
conditional: (render "govuk_publishing_components/components/select", { | ||
id: "edition_primary_locale", | ||
name: "edition[primary_locale]", | ||
label: "Document language", | ||
heading_size: "s", | ||
full_width: true, | ||
allow_blank: true, | ||
errors: errors_for(edition.errors, :primary_locale), | ||
options: ([nil] + options_for_locales(Locale.non_english)).map do |language, value| | ||
{ | ||
text: language, | ||
value: value, | ||
selected: edition.primary_locale == value | ||
} | ||
end | ||
}) | ||
} | ||
] | ||
} %> | ||
|
||
<% if edition.is_a?(NewsArticle) %> | ||
<p class="govuk-body govuk-!-font-weight-bold">Warning: News stories without an English version cannot have other translations.</p> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<% if edition.is_a?(NewsArticle) %> | ||
<p class="govuk-body govuk-!-font-weight-bold">Warning: News stories without an English version cannot have other translations.</p> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters