Add language switcher as component
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
App.SuppliersSwitcherComponent = Ember.Component.extend
|
||||
classNames: ['suppliers-switcher-container']
|
||||
suppliers: (-> @get('targetObject.store').all 'supplier').property()
|
||||
other_suppliers: ( -> @get('suppliers').rejectBy 'id', @get('targetObject.controllers.application.supplier.id')).property('suppliers.@each')
|
||||
actions:
|
||||
switchTo: (locale)->
|
||||
setLocale locale
|
||||
@set 'current_locale', locale
|
||||
@get('targetObject.store').all("page").invoke 'reload'
|
||||
switchTo: (supplier)->
|
||||
window.location = Routes.switch_to_suppliers_supplier_path(supplier.get('id'))
|
||||
@@ -5,8 +5,6 @@ App.SettingsController = Ember.ObjectController.extend
|
||||
countries: (-> window.countries ).property()
|
||||
saving: false
|
||||
editIensProfile: (-> @get('model.country') is 'Netherlands' ).property('model.country')
|
||||
suppliers: (-> @store.all 'supplier').property()
|
||||
other_suppliers: ( -> @get('suppliers').rejectBy 'id', @get('controllers.application.supplier.id')).property('suppliers.@each')
|
||||
actions:
|
||||
saveSettings: ->
|
||||
@set 'saving', true
|
||||
@@ -14,5 +12,3 @@ App.SettingsController = Ember.ObjectController.extend
|
||||
@set 'saving', false
|
||||
$('.top-menu .supplier-name').text @get('model.name')
|
||||
@transitionToRoute 'index'
|
||||
switchToSupplier: (supplier)->
|
||||
window.location = Routes.switch_to_suppliers_supplier_path(supplier.get('id'))
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
if other_suppliers
|
||||
ul.button-group.stack-for-small.round
|
||||
each supplier in other_suppliers
|
||||
li: a.warning.button{action "switchTo" supplier}= t 'suppliers_switcher.switch_to_button' supplier
|
||||
@@ -45,8 +45,4 @@ if editIensProfile
|
||||
else
|
||||
button.button.submit-supplier-settings{action 'saveSettings'}=t 'settings.save'
|
||||
|
||||
|
||||
if other_suppliers
|
||||
.row: .small-12.columns: ul.button-group.stack-for-small.round
|
||||
each supplier in other_suppliers
|
||||
li: a.warning.button{action "switchToSupplier" supplier}= t 'settings.switch_to_supplier' supplier
|
||||
.row: .small-12.columns= suppliers-switcher
|
||||
|
||||
@@ -125,7 +125,6 @@ en:
|
||||
reviews:
|
||||
title: Reviews
|
||||
explanation: Fill in your Iens id. You can find this id in the web location of your page
|
||||
switch_to_supplier: Switch to %{name}
|
||||
product_category:
|
||||
# week days depricated
|
||||
week_days:
|
||||
@@ -209,3 +208,5 @@ en:
|
||||
save_button: Save
|
||||
destroy_button: Destroy
|
||||
destroy_confirmation: Are you sure?
|
||||
suppliers_switcher:
|
||||
switch_to_button: Switch to %{name}
|
||||
|
||||
@@ -124,7 +124,6 @@ nl:
|
||||
reviews:
|
||||
title: Reviews
|
||||
explanation: Vul hier je iens id in. Deze kan je halen uit de url van je iens pagina
|
||||
switch_to_supplier: Switch to %{name}
|
||||
product_category:
|
||||
week_days:
|
||||
abbreviation:
|
||||
@@ -212,3 +211,5 @@ nl:
|
||||
save_button: Save
|
||||
destroy_button: Verwijder
|
||||
destroy_confirmation: 'Weet je zeker dat je de ${models.employee_shift} wilt verwijderen?'
|
||||
suppliers_switcher:
|
||||
switch_to_button: Switch to %{name}
|
||||
|
||||
Reference in New Issue
Block a user