Follow naming conventions for HTML classes and IDs
We use underscores for IDs and hyphens for classes.
This commit is contained in:
@@ -16,7 +16,7 @@ App.Globalize =
|
|||||||
else
|
else
|
||||||
$(this).hide()
|
$(this).hide()
|
||||||
$('.js-delete-language').hide()
|
$('.js-delete-language').hide()
|
||||||
$('#delete-' + locale).show()
|
$('#delete_' + locale).show()
|
||||||
|
|
||||||
highlight_locale: (element) ->
|
highlight_locale: (element) ->
|
||||||
$('.js-globalize-locale-link').removeClass('is-active');
|
$('.js-globalize-locale-link').removeClass('is-active');
|
||||||
@@ -48,7 +48,7 @@ App.Globalize =
|
|||||||
)
|
)
|
||||||
|
|
||||||
destroy_locale_field: (locale) ->
|
destroy_locale_field: (locale) ->
|
||||||
$(".destroy_locale[data-locale=" + locale + "]")
|
$(".destroy-locale[data-locale=" + locale + "]")
|
||||||
|
|
||||||
site_customization_enable_locale_field: (locale) ->
|
site_customization_enable_locale_field: (locale) ->
|
||||||
$("#enabled_translations_" + locale)
|
$("#enabled_translations_" + locale)
|
||||||
@@ -72,7 +72,7 @@ App.Globalize =
|
|||||||
$(this).hide()
|
$(this).hide()
|
||||||
App.Globalize.remove_language(locale)
|
App.Globalize.remove_language(locale)
|
||||||
|
|
||||||
$(".add_fields_container").on "cocoon:after-insert", ->
|
$(".add-fields-container").on "cocoon:after-insert", ->
|
||||||
$.each(
|
$.each(
|
||||||
App.Globalize.enabled_locales(),
|
App.Globalize.enabled_locales(),
|
||||||
(index, locale) -> App.Globalize.enable_locale(locale)
|
(index, locale) -> App.Globalize.enable_locale(locale)
|
||||||
|
|||||||
@@ -12,5 +12,5 @@ App.LegislationAdmin =
|
|||||||
else
|
else
|
||||||
$(this).val("")
|
$(this).val("")
|
||||||
|
|
||||||
$("#nested-question-options").on "cocoon:after-insert", ->
|
$("#nested_question_options").on "cocoon:after-insert", ->
|
||||||
App.Globalize.refresh_visible_translations()
|
App.Globalize.refresh_visible_translations()
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ module TranslatableFormHelper
|
|||||||
@template.content_tag :div, translations_options(translations_form.object, locale) do
|
@template.content_tag :div, translations_options(translations_form.object, locale) do
|
||||||
@template.concat translations_form.hidden_field(
|
@template.concat translations_form.hidden_field(
|
||||||
:_destroy,
|
:_destroy,
|
||||||
class: "destroy_locale",
|
class: "destroy-locale",
|
||||||
data: { locale: locale })
|
data: { locale: locale })
|
||||||
|
|
||||||
@template.concat translations_form.hidden_field(:locale, value: locale)
|
@template.concat translations_form.hidden_field(:locale, value: locale)
|
||||||
@@ -53,7 +53,7 @@ module TranslatableFormHelper
|
|||||||
|
|
||||||
def translations_options(resource, locale)
|
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),
|
style: @template.display_translation_style(resource.globalized_model, locale),
|
||||||
data: { locale: locale }
|
data: { locale: locale }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,12 +30,12 @@
|
|||||||
<%= f.label :question_options, t("admin.legislation.questions.form.question_options") %>
|
<%= f.label :question_options, t("admin.legislation.questions.form.question_options") %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="nested-question-options">
|
<div id="nested_question_options">
|
||||||
<%= f.fields_for :question_options do |ff| %>
|
<%= f.fields_for :question_options do |ff| %>
|
||||||
<%= render 'question_option_fields', f: ff %>
|
<%= render 'question_option_fields', f: ff %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="add_fields_container">
|
<div class="add-fields-container">
|
||||||
<div class="small-12 medium-9 column">
|
<div class="small-12 medium-9 column">
|
||||||
<%= link_to_add_association t("admin.legislation.questions.form.add_option"),
|
<%= link_to_add_association t("admin.legislation.questions.form.add_option"),
|
||||||
f, :question_options, class: "button hollow" %>
|
f, :question_options, class: "button hollow" %>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<% I18n.available_locales.each do |locale| %>
|
<% I18n.available_locales.each do |locale| %>
|
||||||
<%= link_to t("admin.translations.remove_language"), "#",
|
<%= link_to t("admin.translations.remove_language"), "#",
|
||||||
id: "delete-#{locale}",
|
id: "delete_#{locale}",
|
||||||
style: display_translation_style(resource, locale),
|
style: display_translation_style(resource, locale),
|
||||||
class: 'float-right delete js-delete-language',
|
class: 'float-right delete js-delete-language',
|
||||||
data: { locale: locale } %>
|
data: { locale: locale } %>
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ feature 'Admin legislation questions' do
|
|||||||
let(:field_es) { fields_for(:es).first }
|
let(:field_es) { fields_for(:es).first }
|
||||||
|
|
||||||
def fields_for(locale)
|
def fields_for(locale)
|
||||||
within("#nested-question-options") do
|
within("#nested_question_options") do
|
||||||
page.all(
|
page.all(
|
||||||
"[data-locale='#{locale}'] [id^='legislation_question_question_option'][id$='value']"
|
"[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")
|
create(:legislation_question_option, question: question, value: "Original")
|
||||||
|
|
||||||
visit edit_question_url
|
visit edit_question_url
|
||||||
find("#nested-question-options input").set("Changed")
|
find("#nested_question_options input").set("Changed")
|
||||||
click_button "Save changes"
|
click_button "Save changes"
|
||||||
|
|
||||||
expect(page).not_to have_css "#error_explanation"
|
expect(page).not_to have_css "#error_explanation"
|
||||||
@@ -175,11 +175,11 @@ feature 'Admin legislation questions' do
|
|||||||
|
|
||||||
click_on 'Add option'
|
click_on 'Add option'
|
||||||
|
|
||||||
find('#nested-question-options input').set('Option 1')
|
find('#nested_question_options input').set('Option 1')
|
||||||
|
|
||||||
click_link "Español"
|
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"
|
click_button "Save changes"
|
||||||
visit edit_question_url
|
visit edit_question_url
|
||||||
@@ -198,11 +198,11 @@ feature 'Admin legislation questions' do
|
|||||||
|
|
||||||
click_on 'Add option'
|
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"
|
click_link "English"
|
||||||
|
|
||||||
find('#nested-question-options input').set('Option 1')
|
find('#nested_question_options input').set('Option 1')
|
||||||
|
|
||||||
click_button "Save changes"
|
click_button "Save changes"
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ feature 'Cards' do
|
|||||||
click_link "Edit"
|
click_link "Edit"
|
||||||
end
|
end
|
||||||
|
|
||||||
within(".translatable_fields") do
|
within(".translatable-fields") do
|
||||||
fill_in "Label (optional)", with: "Card label updated"
|
fill_in "Label (optional)", with: "Card label updated"
|
||||||
fill_in "Title", with: "Card text updated"
|
fill_in "Title", with: "Card text updated"
|
||||||
fill_in "Description", with: "Card description updated"
|
fill_in "Description", with: "Card description updated"
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ def field_for(field, locale, visible: true)
|
|||||||
if translatable_class.name == "I18nContent"
|
if translatable_class.name == "I18nContent"
|
||||||
"contents_content_#{translatable.key}values_#{field}_#{locale}"
|
"contents_content_#{translatable.key}values_#{field}_#{locale}"
|
||||||
else
|
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]
|
find("input[id$='_#{field}'], textarea[id$='_#{field}']", visible: visible)[:id]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user