Highlight current locale when changing locale from select
When the locale changes the corresponding tab is highlighted automatically. When a language is added to the milestone, the tab is highlighted automatically.
This commit is contained in:
@@ -4,6 +4,7 @@ App.Globalize =
|
|||||||
$(".js-globalize-locale-link").each ->
|
$(".js-globalize-locale-link").each ->
|
||||||
if $(this).data("locale") == locale
|
if $(this).data("locale") == locale
|
||||||
$(this).show()
|
$(this).show()
|
||||||
|
App.Globalize.highlight_locale($(this))
|
||||||
$(".js-globalize-locale option:selected").removeAttr("selected");
|
$(".js-globalize-locale option:selected").removeAttr("selected");
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ module GlobalizeHelper
|
|||||||
globalize_locale == locale ? "highlight" : ""
|
globalize_locale == locale ? "highlight" : ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def highlight_current?(locale)
|
||||||
|
I18n.locale == locale ? 'highlight' : ''
|
||||||
|
end
|
||||||
|
|
||||||
def show_delete?(locale)
|
def show_delete?(locale)
|
||||||
I18n.locale == locale ? '' : 'display: none'
|
I18n.locale == locale ? '' : 'display: none'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<span>
|
<span>
|
||||||
<%= link_to name_for_locale(locale), "#",
|
<%= link_to name_for_locale(locale), "#",
|
||||||
style: css_to_display_translation?(@milestone, locale),
|
style: css_to_display_translation?(@milestone, locale),
|
||||||
class: "js-globalize-locale-link",
|
class: "js-globalize-locale-link #{highlight_current?(locale)}",
|
||||||
data: { locale: locale },
|
data: { locale: locale },
|
||||||
remote: true %>
|
remote: true %>
|
||||||
<%= link_to t("admin.milestones.form.remove_language"), "#",
|
<%= link_to t("admin.milestones.form.remove_language"), "#",
|
||||||
|
|||||||
Reference in New Issue
Block a user