End of day commit
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
App.SettingsController = Ember.Controller.extend
|
||||
needs: ['application']
|
||||
supplier: Ember.computed.alias 'globals.current_supplier'
|
||||
# model: (-> @get('controllers.application.supplier')).property('controllers.application.supplier')
|
||||
time_zones: (-> window.time_zones ).property()
|
||||
countries: (-> window.countries ).property()
|
||||
saving: false
|
||||
editIensProfile: (-> @get('model.country') is 'Netherlands' ).property('model.country')
|
||||
editIensProfile: (-> @get('supplier.country') is 'Netherlands' ).property('supplier.country')
|
||||
actions:
|
||||
saveSettings: ->
|
||||
@set 'saving', true
|
||||
@get('model').save().then (supplier) =>
|
||||
@get('supplier').save().then (supplier) =>
|
||||
@set 'saving', false
|
||||
$('.top-menu .supplier-name').text @get('model.name')
|
||||
$('.top-menu .supplier-name').text @get('supplier.name')
|
||||
@transitionToRoute 'index'
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
App.SettingsRoute = Ember.Route.extend
|
||||
model: -> @get('globals.current_supplier')
|
||||
a: 3
|
||||
#model: -> @get('globals.current_supplier')
|
||||
#model: Ember.computed.alias 'globals.current_supplier'
|
||||
# setupController: (controller, model)->
|
||||
# #controller.set 'model', controller.get('controllers.application.supplier')
|
||||
# controller.set 'model', model.supplier
|
||||
|
||||
@@ -8,5 +8,5 @@ App.ApplicationStore = DS.Store
|
||||
#Ember.String.pluralize(Ember.String.decamelize(type))
|
||||
App.ApplicationAdapter = DS.ActiveModelAdapter.extend
|
||||
namespace: 'supplier'
|
||||
#headers:
|
||||
#"Accept": "application/json, text/javascript; q=0.01"
|
||||
headers:
|
||||
"Accept": "application/json, text/javascript; q=0.01"
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
.row: .small-12.columns: h2=t 'settings.title'
|
||||
.form-row
|
||||
.form-label: label=t 'attributes.supplier.name'
|
||||
.form-field= input value=controller.model.name classNames="supplier-name"
|
||||
.form-field= input value=supplier.name classNames="supplier-name"
|
||||
.form-row
|
||||
.form-label: label=t 'attributes.supplier.email'
|
||||
.form-field= input value=controller.model.email type="email" classNames="supplier-email"
|
||||
.form-field= input value=supplier.email type="email" classNames="supplier-email"
|
||||
/input.location_picker name="location" type="text" valueBinding="location"
|
||||
/.form-row
|
||||
.location_picker_map
|
||||
= image_tag 'supplier/settings/location-balloon.png'
|
||||
/.form-row
|
||||
.form-label: label=t 'attributes.supplier.time_zone'
|
||||
.form-field: Ember.Select content=time_zones optionValuePath="content.name" optionLabelPath="content.formatted" valueBinding="controller.model.time_zone"
|
||||
.form-field: Ember.Select content=time_zones optionValuePath="content.name" optionLabelPath="content.formatted" valueBinding="supplier.time_zone"
|
||||
.form-row
|
||||
.form-label: label=t 'attributes.supplier.address'
|
||||
.form-field.full
|
||||
.row
|
||||
.large-8.medium-8.columns= input value=controller.model.address
|
||||
.large-8.medium-8.columns= input value=supplier.address
|
||||
.large-1.show-for-large-up.columns
|
||||
.large-2.medium-2.small-3.columns= number-field numericValue=controller.model.house_number
|
||||
.large-1.medium-2.small-2.columns= input value=controller.model.house_number_addition
|
||||
.large-2.medium-2.small-3.columns= number-field numericValue=supplier.house_number
|
||||
.large-1.medium-2.small-2.columns= input value=supplier.house_number_addition
|
||||
.form-row
|
||||
.form-label: label=t 'attributes.supplier.postal_code'
|
||||
.form-field= input value=controller.model.postal_code
|
||||
.form-field= input value=supplier.postal_code
|
||||
.form-row
|
||||
.form-label: label=t 'attributes.supplier.city'
|
||||
.form-field= input value=controller.model.city
|
||||
.form-field= input value=supplier.city
|
||||
.form-row
|
||||
.form-label: label=t 'attributes.supplier.country'
|
||||
.form-field: view "select" content=countries optionValuePath="content.name" optionLabelPath="content.name" value=controller.model.country
|
||||
.form-field: view "select" content=countries optionValuePath="content.name" optionLabelPath="content.name" value=supplier.country
|
||||
if editIensProfile
|
||||
.form-row
|
||||
.form-label: label=t 'attributes.supplier.iens_profile'
|
||||
.form-field
|
||||
= number-field numericValue=controller.model.iens_profile
|
||||
= number-field numericValue=supplier.iens_profile
|
||||
= image_tag 'supplier/settings/iens-example.png'
|
||||
span=t "settings.reviews.explanation"
|
||||
.row: .small-12.columns= language-switcher
|
||||
|
||||
@@ -19,6 +19,7 @@ Ember.Application.initializer
|
||||
Globals = Ember.Object.extend
|
||||
list: null
|
||||
notice: ''
|
||||
join_request_sent: false
|
||||
Ember.Application.initializer
|
||||
name: 'Globals'
|
||||
initialize: (container, application)->
|
||||
|
||||
@@ -2,4 +2,4 @@ App.ActiveListController = Ember.Controller.extend
|
||||
#orders: (->
|
||||
#@get('list.orders')
|
||||
#).property('list.orders')
|
||||
list: (-> @get('controllers.application.list') ).property('controllers.application.list')
|
||||
list: (-> @get('globals.list') ).property('globals.list')
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
App.ApplicationController = Ember.Controller.extend
|
||||
needs: ['product_orders']
|
||||
join_request_sent: false
|
||||
#notice: ''
|
||||
actions:
|
||||
confirmCancel: ->
|
||||
@@ -62,13 +61,14 @@ App.ApplicationController = Ember.Controller.extend
|
||||
requestor_id = data.id.substr(3)
|
||||
if requestor_id is Qstorage.getItem('user_id')
|
||||
@set 'globals.notice', t('join_request.requestor.join_request_rejected')
|
||||
@set 'join_request_sent', false
|
||||
@set 'globals.join_request_sent', false
|
||||
|
||||
join_request_approved: ->
|
||||
return if @get('list.id')
|
||||
@setCurrentList ->
|
||||
@transitionToRoute('active_list').then =>
|
||||
@set 'globals.notice', t('join_request.requestor.join_request_approved')
|
||||
@set 'globals.join_request_sent', false
|
||||
|
||||
list_changed_table: ->
|
||||
@setCurrentList()
|
||||
@@ -79,7 +79,7 @@ App.ApplicationController = Ember.Controller.extend
|
||||
new_order: (data)->
|
||||
# return if @store.all('order').findProperty('id', data.order.id)
|
||||
@store.pushPayload data
|
||||
@store.findById('list', data.list.id).then (list)=> @set 'controllers.application.list', list
|
||||
@store.findById('list', data.list.id).then (list)=> @set 'globals.list', list
|
||||
# @store.findById('order', data.order.id).then (order)->
|
||||
# list = order.get('list')
|
||||
# list.get('orders').addObject(order)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
App.JoinRequestsController = Ember.Controller.extend
|
||||
join_requests: (-> @get('controllers.application.list.join_requests') ).property('controllers.application.list.join_requests')
|
||||
join_requests: (-> @get('globals.list.join_requests') ).property('globals.list.join_requests')
|
||||
actions:
|
||||
rejectRequest: (join_request)->
|
||||
Ember.$.post("#{$data_host}/user/reject_join_request", user_id: join_request.get('user.id')).then (response)->
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@App.modals.BaseController = Ember.Controller.extend
|
||||
alert_message: ""
|
||||
#modal_options: Ember.Object.create(closeOnOverlay: true, closeOnModalClick: false)
|
||||
title: (->
|
||||
# return title if directly set by options
|
||||
return @get('modal_options.title') if @get('modal_options.title')
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
@App.modals.ConfirmController = @App.modals.BaseController.extend
|
||||
body: Ember.computed 'modal_options.body', -> @get('modal_options.body')
|
||||
@@ -12,14 +12,14 @@ App.ProductOrdersController = Ember.Controller.extend
|
||||
# @get('product_orders').invoke 'eraseRecord'
|
||||
orderProducts: ->
|
||||
# table = @get('controllers.table.model')
|
||||
# list = @get('controllers.application.list')
|
||||
# list = @get('globals.list')
|
||||
# order = @store.createRecord('order', list: list, table: table)
|
||||
# new_product_orders = @store.all('product_order').filterProperty('order', null)
|
||||
# order.get('product_orders').pushObjects(new_product_orders)
|
||||
#
|
||||
# order.save().then (response)=>
|
||||
# new_product_orders.invoke 'eraseRecord'
|
||||
# if @get('controllers.application.list')
|
||||
# if @get('globals.list')
|
||||
# @transitionToRoute 'active_list'
|
||||
# else
|
||||
# # Get list info from the server
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
App.TableController = Ember.Controller.extend
|
||||
join_request_sent: (-> @get('controllers.application.join_request_sent')).property('controllers.application.join_request_sent')
|
||||
tableCanTakeOrders: (->
|
||||
return false unless @get('supplier.can_take_orders')
|
||||
list = @get('globals.list')
|
||||
@@ -10,14 +9,14 @@ App.TableController = Ember.Controller.extend
|
||||
else
|
||||
# no list and open supplier
|
||||
if @get('model.occupied') then false else true
|
||||
).property('controllers.application.list.id', 'supplier.can_take_orders', 'model.occupied', 'model.id', 'controllers.application.list.table.id')
|
||||
).property('globals.list.id', 'supplier.can_take_orders', 'model.occupied', 'model.id', 'globals.list.table.id')
|
||||
supplier: Ember.computed 'model.supplier', -> @get('model.supplier')
|
||||
showJoinButton: (->
|
||||
return false unless @get('supplier.can_take_orders')
|
||||
return false if @get('controllers.application.list') # if you already have an active list, do not join another
|
||||
return false if @get('globals.list') # if you already have an active list, do not join another
|
||||
if @get('model.occupied') then true else false # no point in joining tables that are not occupied
|
||||
).property('controllers.application.list.id', 'supplier.can_take_orders', 'model.occupied', 'model.id', 'controllers.application.list.table.id')
|
||||
).property('globals.list.id', 'supplier.can_take_orders', 'model.occupied', 'model.id', 'globals.list.table.id')
|
||||
actions:
|
||||
joinOccupiedTable: ->
|
||||
Ember.$.post("#{$data_host}/user/join_occupied_table.json", table_id: @get('model.id'))
|
||||
@set 'controllers.application.join_request_sent', true # keeps the button deactivated
|
||||
@set 'globals.join_request_sent', true # keeps the button deactivated
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
App.ActiveListRoute = Ember.Route.extend App.ResetScroll
|
||||
#model: ->
|
||||
#@get('controllers.application.list')
|
||||
#@get('globals.list')
|
||||
#afterModel: ->
|
||||
#controller = @controllerFor('application')
|
||||
#table_id = controller.get('list.table.id')
|
||||
|
||||
@@ -55,7 +55,7 @@ App.ApplicationRoute = Ember.Route.extend
|
||||
defaultModalOptions =
|
||||
closeOnOverlay: true
|
||||
closeOnModalClick: false
|
||||
controller.set 'modal_options', $.extend(defaultModalOptions, options)
|
||||
controller.set 'modal_options', Ember.Object.create($.extend(defaultModalOptions, options))
|
||||
@render "modals/#{modalName}",
|
||||
into: 'application'
|
||||
outlet: 'modal'
|
||||
@@ -68,11 +68,8 @@ App.ApplicationRoute = Ember.Route.extend
|
||||
parentView: 'application'
|
||||
|
||||
confirm: (options = {})->
|
||||
@send 'openModal', 'confirm',
|
||||
model: Ember.Object.create(body: options.body)
|
||||
title: options.title
|
||||
cancel: options.cancel
|
||||
ok: options.ok
|
||||
options.model ||= Ember.Object.create()
|
||||
@send 'openModal', 'confirm', options
|
||||
sendFeedback: (feedback, callback)->
|
||||
return unless feedback
|
||||
$.post $user_feedback_path, feedback: feedback, callback
|
||||
@@ -124,8 +121,8 @@ App.ApplicationRoute = Ember.Route.extend
|
||||
else
|
||||
## Offer to move table
|
||||
@send 'confirm',
|
||||
title: t('move_table.confirmation_title')
|
||||
body: t('move_table.confirmation_body')
|
||||
title: t('move_table.confirmation_title', res.table)
|
||||
body: t('move_table.confirmation_body', res.table)
|
||||
ok: =>
|
||||
Ember.$.post "#{$data_host}/user/move_table.json", table_id: table._id, (res2)=>
|
||||
if res2.occupied
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
span.supplier-name= supplier.name
|
||||
span.table-number
|
||||
' #
|
||||
= number
|
||||
= model.number
|
||||
if showJoinButton
|
||||
if join_request_sent
|
||||
if globals.join_request_sent
|
||||
button.disabled
|
||||
span.fa.fa-spinner.fa-spin.fa-lg
|
||||
span=t 'join_request.requestor.waiting_for_approval'
|
||||
|
||||
@@ -9,5 +9,4 @@
|
||||
|
||||
$.extend($translations.en, <%= I18n.t('user', locale: :en).to_json %>);
|
||||
$.extend($translations.nl, <%= I18n.t('user', locale: :nl).to_json %>);
|
||||
|
||||
setLocale()
|
||||
|
||||
Reference in New Issue
Block a user