diff --git a/app/assets/javascripts/globalize.js.coffee b/app/assets/javascripts/globalize.js.coffee index 01ea9ec61..02c46ff94 100644 --- a/app/assets/javascripts/globalize.js.coffee +++ b/app/assets/javascripts/globalize.js.coffee @@ -16,7 +16,7 @@ App.Globalize = else $(this).hide() $('.js-delete-language').hide() - $('#delete-' + locale).show() + $('#delete_' + locale).show() highlight_locale: (element) -> $('.js-globalize-locale-link').removeClass('is-active'); @@ -48,7 +48,7 @@ App.Globalize = ) destroy_locale_field: (locale) -> - $(".destroy_locale[data-locale=" + locale + "]") + $(".destroy-locale[data-locale=" + locale + "]") site_customization_enable_locale_field: (locale) -> $("#enabled_translations_" + locale) @@ -72,7 +72,7 @@ App.Globalize = $(this).hide() App.Globalize.remove_language(locale) - $(".add_fields_container").on "cocoon:after-insert", -> + $(".add-fields-container").on "cocoon:after-insert", -> $.each( App.Globalize.enabled_locales(), (index, locale) -> App.Globalize.enable_locale(locale) diff --git a/app/assets/javascripts/legislation_admin.js.coffee b/app/assets/javascripts/legislation_admin.js.coffee index f7f9ea17a..5aa19f083 100644 --- a/app/assets/javascripts/legislation_admin.js.coffee +++ b/app/assets/javascripts/legislation_admin.js.coffee @@ -12,5 +12,5 @@ App.LegislationAdmin = else $(this).val("") - $("#nested-question-options").on "cocoon:after-insert", -> + $("#nested_question_options").on "cocoon:after-insert", -> App.Globalize.refresh_visible_translations() diff --git a/app/helpers/translatable_form_helper.rb b/app/helpers/translatable_form_helper.rb index f4b79e0f5..5c9575ab6 100644 --- a/app/helpers/translatable_form_helper.rb +++ b/app/helpers/translatable_form_helper.rb @@ -13,7 +13,7 @@ module TranslatableFormHelper @template.content_tag :div, translations_options(translations_form.object, locale) do @template.concat translations_form.hidden_field( :_destroy, - class: "destroy_locale", + class: "destroy-locale", data: { locale: locale }) @template.concat translations_form.hidden_field(:locale, value: locale) @@ -53,7 +53,7 @@ module TranslatableFormHelper def translations_options(resource, locale) { - class: "translatable_fields js-globalize-attribute", + class: "translatable-fields js-globalize-attribute", style: @template.display_translation_style(resource.globalized_model, locale), data: { locale: locale } } diff --git a/app/views/admin/legislation/questions/_form.html.erb b/app/views/admin/legislation/questions/_form.html.erb index 91a8951ad..6bfe3f54c 100644 --- a/app/views/admin/legislation/questions/_form.html.erb +++ b/app/views/admin/legislation/questions/_form.html.erb @@ -30,12 +30,12 @@ <%= f.label :question_options, t("admin.legislation.questions.form.question_options") %> -
+
<%= f.fields_for :question_options do |ff| %> <%= render 'question_option_fields', f: ff %> <% end %> -
+
<%= link_to_add_association t("admin.legislation.questions.form.add_option"), f, :question_options, class: "button hollow" %> diff --git a/app/views/admin/shared/_common_globalize_locales.html.erb b/app/views/admin/shared/_common_globalize_locales.html.erb index d9aac8376..a51fa1432 100644 --- a/app/views/admin/shared/_common_globalize_locales.html.erb +++ b/app/views/admin/shared/_common_globalize_locales.html.erb @@ -1,6 +1,6 @@ <% I18n.available_locales.each do |locale| %> <%= link_to t("admin.translations.remove_language"), "#", - id: "delete-#{locale}", + id: "delete_#{locale}", style: display_translation_style(resource, locale), class: 'float-right delete js-delete-language', data: { locale: locale } %> diff --git a/spec/features/admin/legislation/questions_spec.rb b/spec/features/admin/legislation/questions_spec.rb index e0df289b6..adff3c3eb 100644 --- a/spec/features/admin/legislation/questions_spec.rb +++ b/spec/features/admin/legislation/questions_spec.rb @@ -124,7 +124,7 @@ feature 'Admin legislation questions' do let(:field_es) { fields_for(:es).first } def fields_for(locale) - within("#nested-question-options") do + within("#nested_question_options") do page.all( "[data-locale='#{locale}'] [id^='legislation_question_question_option'][id$='value']" ) @@ -135,7 +135,7 @@ feature 'Admin legislation questions' do create(:legislation_question_option, question: question, value: "Original") visit edit_question_url - find("#nested-question-options input").set("Changed") + find("#nested_question_options input").set("Changed") click_button "Save changes" expect(page).not_to have_css "#error_explanation" @@ -175,11 +175,11 @@ feature 'Admin legislation questions' do click_on 'Add option' - find('#nested-question-options input').set('Option 1') + find('#nested_question_options input').set('Option 1') click_link "Español" - find('#nested-question-options input').set('Opción 1') + find('#nested_question_options input').set('Opción 1') click_button "Save changes" visit edit_question_url @@ -198,11 +198,11 @@ feature 'Admin legislation questions' do click_on 'Add option' - find('#nested-question-options input').set('Opción 1') + find('#nested_question_options input').set('Opción 1') click_link "English" - find('#nested-question-options input').set('Option 1') + find('#nested_question_options input').set('Option 1') click_button "Save changes" diff --git a/spec/features/admin/widgets/cards_spec.rb b/spec/features/admin/widgets/cards_spec.rb index 3b67caab1..97571bf32 100644 --- a/spec/features/admin/widgets/cards_spec.rb +++ b/spec/features/admin/widgets/cards_spec.rb @@ -64,7 +64,7 @@ feature 'Cards' do click_link "Edit" end - within(".translatable_fields") do + within(".translatable-fields") do fill_in "Label (optional)", with: "Card label updated" fill_in "Title", with: "Card text updated" fill_in "Description", with: "Card description updated" diff --git a/spec/shared/features/translatable.rb b/spec/shared/features/translatable.rb index 8e1334bbd..bd485334a 100644 --- a/spec/shared/features/translatable.rb +++ b/spec/shared/features/translatable.rb @@ -267,7 +267,7 @@ def field_for(field, locale, visible: true) if translatable_class.name == "I18nContent" "contents_content_#{translatable.key}values_#{field}_#{locale}" else - within(".translatable_fields[data-locale='#{locale}']") do + within(".translatable-fields[data-locale='#{locale}']") do find("input[id$='_#{field}'], textarea[id$='_#{field}']", visible: visible)[:id] end end