Rework the language switcher for current language support
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
App.LanguageSwitcherComponent = Ember.Component.extend
|
||||
classNames: ['language-switcher-container']
|
||||
locales: (-> ['en', 'nl']).property()
|
||||
current_locale: (-> Qstorage.getItem('locale') ).property()
|
||||
actions:
|
||||
switchTo: (locale)->
|
||||
setLocale locale
|
||||
@set 'current_locale', locale
|
||||
@get('targetObject.store').all("page").invoke 'reload'
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
Ember.Handlebars.helper 'isCurrentLocale', (locale, options)->
|
||||
if locale is 'nl'
|
||||
options.fn @
|
||||
else
|
||||
options.inverse @
|
||||
+1
@@ -0,0 +1 @@
|
||||
= flag locale
|
||||
@@ -1,2 +1,2 @@
|
||||
each locale in locales
|
||||
a.language-switch-button{ action "switchTo" locale}= flag locale
|
||||
view language-switcher-button locale=locale
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
App.LanguageSwitcherButtonView = Ember.View.extend
|
||||
tagName: 'a'
|
||||
templateName: 'components/language-switcher-button'
|
||||
classNameBindings: ['isCurrent:current']
|
||||
classNames: ['language-switch-button']
|
||||
isCurrent: Ember.computed 'locale', 'controller.current_locale', ->
|
||||
@get('locale') is @get('controller.current_locale')
|
||||
click: -> @get('controller').send 'switchTo', @get('locale')
|
||||
@@ -3,3 +3,4 @@ $qbrown: #853d15
|
||||
$qbrown-active: lighten($qbrown, 20%)
|
||||
$wood: image-url('textures/theme1.jpg')
|
||||
$background-brown: #57351f
|
||||
$current-color: #fc3
|
||||
|
||||
@@ -3,3 +3,8 @@
|
||||
+button($bg: $secondary-color, $padding: $button-tny)
|
||||
margin: 0
|
||||
margin-right: 8px
|
||||
&.current
|
||||
+button($bg: $current-color, $padding: $button-tny)
|
||||
margin: 0
|
||||
margin-right: 8px
|
||||
border: 1px solid #333
|
||||
|
||||
@@ -64,6 +64,10 @@ en:
|
||||
location: Location
|
||||
time_zone: Time zone
|
||||
iens_profile: Iens profile id
|
||||
address: Addres
|
||||
postal_code: Postal code
|
||||
city: City
|
||||
country: Country
|
||||
table:
|
||||
number: Number
|
||||
from_number: From number
|
||||
|
||||
Reference in New Issue
Block a user