Flash message improvements
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
App.FlashMessageComponent = Ember.Component.extend
|
||||||
|
layoutName: 'flash_message'
|
||||||
|
classNames: ['flash-message']
|
||||||
|
classNameBindings: ['message:active']
|
||||||
|
message: Ember.computed.alias 'globals.flash_message'
|
||||||
|
inactivator: (->
|
||||||
|
if @get('message')
|
||||||
|
Ember.run.later((=> @set 'message', ''), 4000)
|
||||||
|
).observes('message')
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
App.ApplicationController = Ember.Controller.extend
|
App.ApplicationController = Ember.Controller.extend
|
||||||
flash_message: ''
|
|
||||||
#init: ->
|
#init: ->
|
||||||
#success = (supplier)=>
|
#success = (supplier)=>
|
||||||
## A supplier record with id current and with the content of the returned supplier is created
|
## A supplier record with id current and with the content of the returned supplier is created
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Globals = Ember.Object.extend
|
|||||||
current_supplier: null
|
current_supplier: null
|
||||||
isDragging: false
|
isDragging: false
|
||||||
active_section: null
|
active_section: null
|
||||||
|
flash_message: ''
|
||||||
App.initializer
|
App.initializer
|
||||||
name: 'injectCurrent'
|
name: 'injectCurrent'
|
||||||
initialize: (container, app)->
|
initialize: (container, app)->
|
||||||
|
|||||||
@@ -79,11 +79,10 @@ App.ApplicationRoute = Ember.Route.extend
|
|||||||
cancel: options.cancel
|
cancel: options.cancel
|
||||||
ok: options.ok
|
ok: options.ok
|
||||||
newOrder: (order_id)->
|
newOrder: (order_id)->
|
||||||
@store.peekRecord('order', order_id).then (order)=>
|
if order = @store.peekRecord('order', order_id)
|
||||||
controller = @controllerFor('application')
|
|
||||||
return if @get('globals.active_section.id') and order.get('section.id') isnt @get('globals.active_section.id')
|
return if @get('globals.active_section.id') and order.get('section.id') isnt @get('globals.active_section.id')
|
||||||
$('body').addClass('new-order')
|
$('body').addClass('new-order')
|
||||||
controller.set 'flash_message', order.get('display_with_table')
|
@set 'globals.flash_message', order.get('display_with_table')
|
||||||
setTimeout (-> $('body').removeClass('new-order')), 4000
|
setTimeout (-> $('body').removeClass('new-order')), 4000
|
||||||
try ion.sound.play('water_droplet')
|
try ion.sound.play('water_droplet')
|
||||||
showDashboardOrders: (section)->
|
showDashboardOrders: (section)->
|
||||||
@@ -109,6 +108,7 @@ App.ApplicationRoute = Ember.Route.extend
|
|||||||
if list = @store.getById('list', data.id)
|
if list = @store.getById('list', data.id)
|
||||||
list.isNeedingHelp()
|
list.isNeedingHelp()
|
||||||
return if @get('globals.active_section.id') and list.get('section.id') isnt @get('globals.active_section.id')
|
return if @get('globals.active_section.id') and list.get('section.id') isnt @get('globals.active_section.id')
|
||||||
|
@set 'globals.flash_message', t('table.needs_help.flash_message', number: list.get('table.number') || -1)
|
||||||
try ion.sound.play 'bell_ring'
|
try ion.sound.play 'bell_ring'
|
||||||
list_needs_payment: (data) ->
|
list_needs_payment: (data) ->
|
||||||
if list = @store.getById('list', data.id)
|
if list = @store.getById('list', data.id)
|
||||||
@@ -117,21 +117,18 @@ App.ApplicationRoute = Ember.Route.extend
|
|||||||
try ion.sound.play 'water_droplet_3'
|
try ion.sound.play 'water_droplet_3'
|
||||||
list_is_paid: (data) -> list.isPaid() if list = @store.getById('list', data.id)
|
list_is_paid: (data) -> list.isPaid() if list = @store.getById('list', data.id)
|
||||||
list_update: (data) ->
|
list_update: (data) ->
|
||||||
if data.new_order_id
|
new_order_id = data.new_order_id
|
||||||
@send 'newOrder', data.new_order_id
|
delete data.new_order_id
|
||||||
@store.pushPayload('list', data)
|
@store.pushPayload(data)
|
||||||
# Fix broken reference. TODO: remove this when single source of
|
@send 'newOrder', new_order_id if new_order_id
|
||||||
# truth is working
|
|
||||||
#@store.peekRecord('list', data.list.id).then (list)->
|
|
||||||
# list.get('table').then (table)->table.set('active_list', list)
|
|
||||||
list_changed_table: (data) -> @store.pushPayload('list', lists: [data.list])
|
list_changed_table: (data) -> @store.pushPayload('list', lists: [data.list])
|
||||||
list_closed: (data) -> list.isClosed() if list = @store.getById('list', data.id)
|
list_closed: (data) -> list.isClosed() if list = @store.peekRecord('list', data.id)
|
||||||
list_helped: (data) -> list.isHelped() if list = @store.getById('list', data.id)
|
list_helped: (data) -> list.isHelped() if list = @store.peekRecord('list', data.id)
|
||||||
remove_list_needs_payment: (data) -> list.set('needs_payment', false) if list = @store.getById('list', data.id)
|
remove_list_needs_payment: (data) -> list.set('needs_payment', false) if list = @store.peekRecord('list', data.id)
|
||||||
order_closed: (data) -> order.isClosed() if order = @store.getById('order', data.id)
|
order_closed: (data) -> order.isClosed() if order = @store.peekRecord('order', data.id)
|
||||||
order_being_processed: (data) -> order.isActive() if order = @store.getById('order', data.id)
|
order_being_processed: (data) -> order.isActive() if order = @store.peekRecord('order', data.id)
|
||||||
order_being_delivered: (data) -> order.isDelivered() if order = @store.getById('order', data.id)
|
order_being_delivered: (data) -> order.isDelivered() if order = @store.peekRecord('order', data.id)
|
||||||
order_cancelled: (data) -> order.isCancelled() if order = @store.getById('order', data.id)
|
order_cancelled: (data) -> order.isCancelled() if order = @store.peekRecord('order', data.id)
|
||||||
orders_in_process_count: (data) -> @set('globals.current_supplier.orders_in_process_count', data.count)
|
orders_in_process_count: (data) -> @set('globals.current_supplier.orders_in_process_count', data.count)
|
||||||
orders_placed_count: (data) -> @set('globals.current_supplier.orders_placed_count', data.count)
|
orders_placed_count: (data) -> @set('globals.current_supplier.orders_placed_count', data.count)
|
||||||
|
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ else
|
|||||||
= partial "global/top_menu"
|
= partial "global/top_menu"
|
||||||
= partial "global/side_menu"
|
= partial "global/side_menu"
|
||||||
.main-section= outlet
|
.main-section= outlet
|
||||||
= view "flash_message"
|
= flash-message
|
||||||
= outlet "modal"
|
= outlet "modal"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
= flash_message
|
= message
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
App.FlashMessageView = Ember.View.extend
|
|
||||||
templateName: 'flash_message'
|
|
||||||
classNames: ['flash-message']
|
|
||||||
classNameBindings: ['message:active']
|
|
||||||
message: (-> @get('controller.flash_message')).property('controller.flash_message')
|
|
||||||
|
|
||||||
inactivator: (->
|
|
||||||
if @get('message')
|
|
||||||
Ember.run.later (=> @set 'controller.flash_message', ''), 4000
|
|
||||||
).observes('message')
|
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
if(!Modernizr.cssanimations){
|
if(!Modernizr.cssanimations){
|
||||||
window.location = "/unsupported-browser";
|
window.location = "/unsupported-browser";
|
||||||
}
|
}
|
||||||
|
|
||||||
var Qstorage = localStorage;
|
var Qstorage = localStorage;
|
||||||
$.extend($translations.en, <%= I18n.t('supplier', locale: :en).to_json %>);
|
$.extend($translations.en, <%= I18n.t('supplier', locale: :en).to_json %>);
|
||||||
$.extend($translations.nl, <%= I18n.t('supplier', locale: :nl).to_json %>);
|
$.extend($translations.nl, <%= I18n.t('supplier', locale: :nl).to_json %>);
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ en:
|
|||||||
sign_out: Sign out
|
sign_out: Sign out
|
||||||
table_number: Table
|
table_number: Table
|
||||||
table:
|
table:
|
||||||
|
needs_help:
|
||||||
|
flash_message: ${models.table} %{number} needs help
|
||||||
print_qr_codes: Print Qr codes
|
print_qr_codes: Print Qr codes
|
||||||
add_tables_first:
|
add_tables_first:
|
||||||
title: Add ${models.plural.table|downcase} first
|
title: Add ${models.plural.table|downcase} first
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ nl:
|
|||||||
sign_out: Afmelden
|
sign_out: Afmelden
|
||||||
table_number: Tafel
|
table_number: Tafel
|
||||||
table:
|
table:
|
||||||
|
needs_help:
|
||||||
|
flash_message: ${models.table} %{number} heeft een vraag
|
||||||
print_qr_codes: Print Qr codes
|
print_qr_codes: Print Qr codes
|
||||||
add_tables_first:
|
add_tables_first:
|
||||||
title: Je moet eerst ${models.plural.table|downcase} toevoegen
|
title: Je moet eerst ${models.plural.table|downcase} toevoegen
|
||||||
|
|||||||
Reference in New Issue
Block a user