Change Translatable impl to keep track of enabled locales

This commit is contained in:
Marko Lovic
2018-08-06 16:21:53 +02:00
committed by Javi Martín
parent cb716e07d7
commit 4603a30f95
4 changed files with 28 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
App.Globalize =
display_locale: (locale) ->
App.Globalize.enable_locale(locale)
$(".js-globalize-locale-link").each ->
if $(this).data("locale") == locale
$(this).show()
@@ -27,7 +28,13 @@ App.Globalize =
next = $(".js-globalize-locale-link:visible").first()
App.Globalize.highlight_locale(next)
App.Globalize.display_translations(next.data("locale"))
$("#delete_translations_" + locale).val(1)
App.Globalize.disable_locale(locale)
enable_locale: (locale) ->
$("#enabled_translations_" + locale).val(1)
disable_locale: (locale) ->
$("#enabled_translations_" + locale).val(0)
initialize: ->
$('.js-globalize-locale').on 'change', ->