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 ->
|
||||
if $(this).data("locale") == locale
|
||||
$(this).show()
|
||||
App.Globalize.highlight_locale($(this))
|
||||
$(".js-globalize-locale option:selected").removeAttr("selected");
|
||||
return
|
||||
|
||||
|
||||
@@ -30,6 +30,10 @@ module GlobalizeHelper
|
||||
globalize_locale == locale ? "highlight" : ""
|
||||
end
|
||||
|
||||
def highlight_current?(locale)
|
||||
I18n.locale == locale ? 'highlight' : ''
|
||||
end
|
||||
|
||||
def show_delete?(locale)
|
||||
I18n.locale == locale ? '' : 'display: none'
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span>
|
||||
<%= link_to name_for_locale(locale), "#",
|
||||
style: css_to_display_translation?(@milestone, locale),
|
||||
class: "js-globalize-locale-link",
|
||||
class: "js-globalize-locale-link #{highlight_current?(locale)}",
|
||||
data: { locale: locale },
|
||||
remote: true %>
|
||||
<%= link_to t("admin.milestones.form.remove_language"), "#",
|
||||
|
||||
Reference in New Issue
Block a user