JSONAPI stuff
This commit is contained in:
@@ -3,6 +3,14 @@ App.ButtonLanguageSwitcherComponent = Ember.Component.extend
|
||||
layoutName: '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')
|
||||
isCurrent: Ember.computed 'locale', 'globals.locale', ->
|
||||
@get('locale') is @get('globals.locale')
|
||||
#isCurrent: Ember.computed.equal 'locale', 'globals.locale'
|
||||
click: -> @get('controller').send 'switchTo', @get('locale')
|
||||
action: 'switchTo'
|
||||
#TODO: EASY BUBBLE ACTION
|
||||
actions:
|
||||
switchTo: (locale)->
|
||||
setLocale locale
|
||||
@set 'globals.locale', locale
|
||||
@store.peekAll("page").invoke 'reload'
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
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'
|
||||
@set 'globals.locale', locale
|
||||
@store.peekAll("page").invoke 'reload'
|
||||
|
||||
@@ -4,9 +4,5 @@ App.SuppliersSwitcherComponent = Ember.Component.extend
|
||||
other_suppliers: Ember.computed 'suppliers.[]',
|
||||
-> @get('suppliers').rejectBy 'id', @get('globals.current_supplier.id')
|
||||
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'))
|
||||
|
||||
@@ -4,6 +4,7 @@ Globals = Ember.Object.extend
|
||||
isDragging: false
|
||||
active_section: null
|
||||
flash_message: ''
|
||||
locale: Qstorage.getItem('locale')
|
||||
App.initializer
|
||||
name: 'injectCurrent'
|
||||
initialize: (container, app)->
|
||||
@@ -14,3 +15,5 @@ App.initializer
|
||||
app.inject 'component', 'globals', 'global:variables'
|
||||
app.inject 'view', 'globals', 'global:variables'
|
||||
app.inject 'route', 'globals', 'global:variables'
|
||||
|
||||
app.inject 'component', 'store', 'service:store'
|
||||
|
||||
@@ -11,6 +11,8 @@ App.ApplicationRoute = Ember.Route.extend
|
||||
id: employee_object.id
|
||||
type: 'employee'
|
||||
attributes: employee_object
|
||||
#@supplier = @store.push 'supplier' supplier_object
|
||||
#@employee = @store.push 'employee' employee_object
|
||||
#@product_categories = @store.findAll 'product_category'
|
||||
#@sections = @store.findAll 'section'
|
||||
#Ember.RSVP.all([@product_categories, @sections]).then (results)=>
|
||||
|
||||
@@ -40,7 +40,6 @@ $ ->
|
||||
|
||||
setupTranslations()
|
||||
|
||||
|
||||
$('[data-boolean]').each ->
|
||||
$(@).addClass(if $(@).data('boolean') then 'boolean-true' else 'boolean-false')
|
||||
|
||||
|
||||
@@ -27,5 +27,6 @@ App.Product = DS.Model.extend
|
||||
else
|
||||
@store.createRecord 'product_order',
|
||||
product: this
|
||||
product_name: @get('name')
|
||||
price: @get('price')
|
||||
product_variant: options.product_variant
|
||||
|
||||
@@ -2,4 +2,5 @@ class OrderSerializer < Qwaiter::Serializer
|
||||
attributes :state, :list_id, :section_id, :table_id #, :price
|
||||
|
||||
has_many :product_orders
|
||||
|
||||
end
|
||||
|
||||
@@ -12,5 +12,7 @@ class Users::ListSerializer < Qwaiter::UserBaseSerializer
|
||||
def include_orders?
|
||||
@_include_linkages.any?{|link| link =~ /orders/}
|
||||
end
|
||||
|
||||
related_link_for :orders, :table
|
||||
#belongs_to :table
|
||||
end
|
||||
|
||||
@@ -2,8 +2,4 @@ class Users::SupplierSerializer < Qwaiter::UserBaseSerializer
|
||||
#self.root = :supplier
|
||||
attributes :open, :name
|
||||
has_many :product_categories, serializer: Users::ProductCategorySerializer
|
||||
#def extended_version
|
||||
# false
|
||||
#end
|
||||
|
||||
end
|
||||
|
||||
@@ -7,6 +7,7 @@ class Users::TableSerializer < Qwaiter::UserBaseSerializer
|
||||
#object.active_list_id || object.active_list.try(:id)
|
||||
#end
|
||||
|
||||
related_link_for :supplier
|
||||
#def list
|
||||
#object.active_list
|
||||
#end
|
||||
|
||||
Reference in New Issue
Block a user