End of day commit

This commit is contained in:
2015-08-10 19:39:06 +02:00
parent 3aef45a94e
commit e1b5ffcd06
30 changed files with 108 additions and 97 deletions
+3 -3
View File
@@ -14,7 +14,7 @@ gem 'slim-rails'
# Gems used only for assets and not required # Gems used only for assets and not required
# in production environments by default. # in production environments by default.
gem 'active_model_serializers', '0.9.0' # explicitly outside assets gem 'active_model_serializers', '~> 0.9.3' # explicitly outside assets
group :assets do group :assets do
gem 'jquery-rails' gem 'jquery-rails'
gem 'jquery-ui-rails' gem 'jquery-ui-rails'
@@ -35,8 +35,8 @@ group :assets do
gem 'uglifier', '>= 1.0.3' gem 'uglifier', '>= 1.0.3'
gem 'ember-rails' gem 'ember-rails'
gem 'ember-source', '~> 1.13.0' #gem 'ember-source', '~> 1.13.0'
gem 'emblem-rails' #gem 'emblem-rails'
gem 'ember-validations-rails' gem 'ember-validations-rails'
gem 'ember-emblem-template' gem 'ember-emblem-template'
+19 -28
View File
@@ -54,13 +54,13 @@ GEM
erubis (~> 2.7.0) erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
active-model-adapter-source (1.13.5) active-model-adapter-source (1.13.6)
ember-data-source (>= 1.13, < 3.0) ember-data-source (>= 1.13, < 3.0)
active_attr (0.8.5) active_attr (0.8.5)
activemodel (>= 3.0.2, < 5.0) activemodel (>= 3.0.2, < 5.0)
activesupport (>= 3.0.2, < 5.0) activesupport (>= 3.0.2, < 5.0)
active_decorator (0.5.3) active_decorator (0.5.3)
active_model_serializers (0.9.0) active_model_serializers (0.9.3)
activemodel (>= 3.2) activemodel (>= 3.2)
activejob (4.2.3) activejob (4.2.3)
activesupport (= 4.2.3) activesupport (= 4.2.3)
@@ -79,15 +79,12 @@ GEM
thread_safe (~> 0.3, >= 0.3.4) thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
addressable (2.3.8) addressable (2.3.8)
airbrussh (0.6.0) airbrussh (0.7.0)
sshkit (>= 1.6.1, != 1.7.0) sshkit (>= 1.6.1, != 1.7.0)
arel (6.0.2) arel (6.0.3)
barber (0.9.1) barber (0.9.1)
ember-source (>= 1.0, < 2) ember-source (>= 1.0, < 2)
execjs (>= 1.2, < 3) execjs (>= 1.2, < 3)
barber-emblem (0.1.2)
barber (>= 0.4.1)
emblem-source
bcrypt (3.1.10) bcrypt (3.1.10)
binding_of_caller (0.7.2) binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
@@ -121,7 +118,7 @@ GEM
capybara-screenshot (1.0.11) capybara-screenshot (1.0.11)
capybara (>= 1.0, < 3) capybara (>= 1.0, < 3)
launchy launchy
celluloid (0.16.0) celluloid (0.16.1)
timers (~> 4.0.0) timers (~> 4.0.0)
childprocess (0.5.6) childprocess (0.5.6)
ffi (~> 1.0, >= 1.0.11) ffi (~> 1.0, >= 1.0.11)
@@ -151,7 +148,7 @@ GEM
crack (0.4.2) crack (0.4.2)
safe_yaml (~> 1.0.0) safe_yaml (~> 1.0.0)
debug_inspector (0.0.2) debug_inspector (0.0.2)
devise (3.5.1) devise (3.5.2)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5) railties (>= 3.2.6, < 5)
@@ -173,7 +170,7 @@ GEM
eventmachine (>= 1.0.0.beta.4) eventmachine (>= 1.0.0.beta.4)
email_validator (1.6.0) email_validator (1.6.0)
activemodel activemodel
ember-data-source (1.13.6) ember-data-source (1.13.8)
ember-source (>= 1.8, < 3.0) ember-source (>= 1.8, < 3.0)
ember-emblem-template (0.2.2) ember-emblem-template (0.2.2)
barber (>= 0.9.0) barber (>= 0.9.0)
@@ -190,15 +187,11 @@ GEM
ember-source (>= 1.8.0) ember-source (>= 1.8.0)
jquery-rails (>= 1.0.17) jquery-rails (>= 1.0.17)
railties (>= 3.1) railties (>= 3.1)
ember-source (1.13.5) ember-source (1.13.7)
ember-validations-rails (1.0.0) ember-validations-rails (1.0.0)
railties railties
emblem-rails (0.2.2)
barber-emblem (~> 0.1.1)
ember-rails (>= 0.14.0)
emblem-source (0.4.0)
erubis (2.7.0) erubis (2.7.0)
eventmachine (1.0.7) eventmachine (1.0.8)
execjs (2.5.2) execjs (2.5.2)
factory_girl (4.5.0) factory_girl (4.5.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
@@ -219,7 +212,7 @@ GEM
eventmachine (>= 0.12.0) eventmachine (>= 0.12.0)
websocket-driver (>= 0.5.1) websocket-driver (>= 0.5.1)
ffi (1.9.10) ffi (1.9.10)
font-awesome-rails (4.3.0.0) font-awesome-rails (4.4.0.0)
railties (>= 3.2, < 5.0) railties (>= 3.2, < 5.0)
foreman (0.78.0) foreman (0.78.0)
thor (~> 0.19.1) thor (~> 0.19.1)
@@ -231,7 +224,7 @@ GEM
ruby-progressbar (~> 1.4) ruby-progressbar (~> 1.4)
gherkin (2.12.2) gherkin (2.12.2)
multi_json (~> 1.3) multi_json (~> 1.3)
globalid (0.3.5) globalid (0.3.6)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
hashie (3.4.2) hashie (3.4.2)
hike (1.2.3) hike (1.2.3)
@@ -247,7 +240,7 @@ GEM
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
jquery-ui-rails (5.0.5) jquery-ui-rails (5.0.5)
railties (>= 3.2.16) railties (>= 3.2.16)
js-routes (1.0.1) js-routes (1.1.0)
railties (>= 3.2) railties (>= 3.2)
sprockets-rails sprockets-rails
json (1.8.3) json (1.8.3)
@@ -265,9 +258,9 @@ GEM
mime-types (>= 1.16, < 3) mime-types (>= 1.16, < 3)
method_source (0.8.2) method_source (0.8.2)
mime-types (2.6.1) mime-types (2.6.1)
mini_magick (4.2.7) mini_magick (4.2.10)
mini_portile (0.6.2) mini_portile (0.6.2)
minitest (5.7.0) minitest (5.8.0)
multi_json (1.11.2) multi_json (1.11.2)
multi_xml (0.5.5) multi_xml (0.5.5)
multipart-post (2.0.0) multipart-post (2.0.0)
@@ -309,7 +302,7 @@ GEM
slop (~> 3.4) slop (~> 3.4)
pry-rails (0.3.4) pry-rails (0.3.4)
pry (>= 0.9.10) pry (>= 0.9.10)
puma (2.12.2) puma (2.12.3)
quiet_assets (1.1.0) quiet_assets (1.1.0)
railties (>= 3.1, < 5.0) railties (>= 3.1, < 5.0)
rack (1.6.4) rack (1.6.4)
@@ -327,7 +320,7 @@ GEM
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.2.3) railties (= 4.2.3)
sprockets-rails sprockets-rails
rails-assets-ember-qunit (0.4.6) rails-assets-ember-qunit (0.4.9)
rails-assets-qunit (1.18.0) rails-assets-qunit (1.18.0)
rails-deprecated_sanitizer (1.0.3) rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha) activesupport (>= 4.2.0.alpha)
@@ -385,7 +378,7 @@ GEM
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
tilt (~> 1.1) tilt (~> 1.1)
selenium-webdriver (2.46.2) selenium-webdriver (2.47.1)
childprocess (~> 0.5) childprocess (~> 0.5)
multi_json (~> 1.0) multi_json (~> 1.0)
rubyzip (~> 1.0) rubyzip (~> 1.0)
@@ -431,7 +424,7 @@ GEM
tilt (1.4.1) tilt (1.4.1)
timers (4.0.1) timers (4.0.1)
hitimes hitimes
tinymce-rails (4.2.2) tinymce-rails (4.2.3)
railties (>= 3.1.1) railties (>= 3.1.1)
turnip (1.3.1) turnip (1.3.1)
gherkin (>= 2.5) gherkin (>= 2.5)
@@ -468,7 +461,7 @@ DEPENDENCIES
ace-rails-ap ace-rails-ap
active_attr active_attr
active_decorator active_decorator
active_model_serializers (= 0.9.0) active_model_serializers (~> 0.9.3)
airbrussh airbrussh
bourbon bourbon
cancancan cancancan
@@ -486,9 +479,7 @@ DEPENDENCIES
devise_simply_stored! devise_simply_stored!
ember-emblem-template ember-emblem-template
ember-rails ember-rails
ember-source (~> 1.13.0)
ember-validations-rails ember-validations-rails
emblem-rails
factory_girl_rails factory_girl_rails
faye faye
font-awesome-rails font-awesome-rails
@@ -1,14 +1,15 @@
App.SettingsController = Ember.Controller.extend App.SettingsController = Ember.Controller.extend
needs: ['application'] needs: ['application']
supplier: Ember.computed.alias 'globals.current_supplier'
# model: (-> @get('controllers.application.supplier')).property('controllers.application.supplier') # model: (-> @get('controllers.application.supplier')).property('controllers.application.supplier')
time_zones: (-> window.time_zones ).property() time_zones: (-> window.time_zones ).property()
countries: (-> window.countries ).property() countries: (-> window.countries ).property()
saving: false saving: false
editIensProfile: (-> @get('model.country') is 'Netherlands' ).property('model.country') editIensProfile: (-> @get('supplier.country') is 'Netherlands' ).property('supplier.country')
actions: actions:
saveSettings: -> saveSettings: ->
@set 'saving', true @set 'saving', true
@get('model').save().then (supplier) => @get('supplier').save().then (supplier) =>
@set 'saving', false @set 'saving', false
$('.top-menu .supplier-name').text @get('model.name') $('.top-menu .supplier-name').text @get('supplier.name')
@transitionToRoute 'index' @transitionToRoute 'index'
@@ -1,5 +1,7 @@
App.SettingsRoute = Ember.Route.extend 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)-> # setupController: (controller, model)->
# #controller.set 'model', controller.get('controllers.application.supplier') # #controller.set 'model', controller.get('controllers.application.supplier')
# controller.set 'model', model.supplier # controller.set 'model', model.supplier
@@ -8,5 +8,5 @@ App.ApplicationStore = DS.Store
#Ember.String.pluralize(Ember.String.decamelize(type)) #Ember.String.pluralize(Ember.String.decamelize(type))
App.ApplicationAdapter = DS.ActiveModelAdapter.extend App.ApplicationAdapter = DS.ActiveModelAdapter.extend
namespace: 'supplier' namespace: 'supplier'
#headers: headers:
#"Accept": "application/json, text/javascript; q=0.01" "Accept": "application/json, text/javascript; q=0.01"
@@ -1,39 +1,39 @@
.row: .small-12.columns: h2=t 'settings.title' .row: .small-12.columns: h2=t 'settings.title'
.form-row .form-row
.form-label: label=t 'attributes.supplier.name' .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-row
.form-label: label=t 'attributes.supplier.email' .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" /input.location_picker name="location" type="text" valueBinding="location"
/.form-row /.form-row
.location_picker_map .location_picker_map
= image_tag 'supplier/settings/location-balloon.png' = image_tag 'supplier/settings/location-balloon.png'
/.form-row /.form-row
.form-label: label=t 'attributes.supplier.time_zone' .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-row
.form-label: label=t 'attributes.supplier.address' .form-label: label=t 'attributes.supplier.address'
.form-field.full .form-field.full
.row .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 &nbsp; .large-1.show-for-large-up.columns &nbsp;
.large-2.medium-2.small-3.columns= number-field numericValue=controller.model.house_number .large-2.medium-2.small-3.columns= number-field numericValue=supplier.house_number
.large-1.medium-2.small-2.columns= input value=controller.model.house_number_addition .large-1.medium-2.small-2.columns= input value=supplier.house_number_addition
.form-row .form-row
.form-label: label=t 'attributes.supplier.postal_code' .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-row
.form-label: label=t 'attributes.supplier.city' .form-label: label=t 'attributes.supplier.city'
.form-field= input value=controller.model.city .form-field= input value=supplier.city
.form-row .form-row
.form-label: label=t 'attributes.supplier.country' .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 if editIensProfile
.form-row .form-row
.form-label: label=t 'attributes.supplier.iens_profile' .form-label: label=t 'attributes.supplier.iens_profile'
.form-field .form-field
= number-field numericValue=controller.model.iens_profile = number-field numericValue=supplier.iens_profile
= image_tag 'supplier/settings/iens-example.png' = image_tag 'supplier/settings/iens-example.png'
span=t "settings.reviews.explanation" span=t "settings.reviews.explanation"
.row: .small-12.columns= language-switcher .row: .small-12.columns= language-switcher
@@ -19,6 +19,7 @@ Ember.Application.initializer
Globals = Ember.Object.extend Globals = Ember.Object.extend
list: null list: null
notice: '' notice: ''
join_request_sent: false
Ember.Application.initializer Ember.Application.initializer
name: 'Globals' name: 'Globals'
initialize: (container, application)-> initialize: (container, application)->
@@ -2,4 +2,4 @@ App.ActiveListController = Ember.Controller.extend
#orders: (-> #orders: (->
#@get('list.orders') #@get('list.orders')
#).property('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 App.ApplicationController = Ember.Controller.extend
needs: ['product_orders'] needs: ['product_orders']
join_request_sent: false
#notice: '' #notice: ''
actions: actions:
confirmCancel: -> confirmCancel: ->
@@ -62,13 +61,14 @@ App.ApplicationController = Ember.Controller.extend
requestor_id = data.id.substr(3) requestor_id = data.id.substr(3)
if requestor_id is Qstorage.getItem('user_id') if requestor_id is Qstorage.getItem('user_id')
@set 'globals.notice', t('join_request.requestor.join_request_rejected') @set 'globals.notice', t('join_request.requestor.join_request_rejected')
@set 'join_request_sent', false @set 'globals.join_request_sent', false
join_request_approved: -> join_request_approved: ->
return if @get('list.id') return if @get('list.id')
@setCurrentList -> @setCurrentList ->
@transitionToRoute('active_list').then => @transitionToRoute('active_list').then =>
@set 'globals.notice', t('join_request.requestor.join_request_approved') @set 'globals.notice', t('join_request.requestor.join_request_approved')
@set 'globals.join_request_sent', false
list_changed_table: -> list_changed_table: ->
@setCurrentList() @setCurrentList()
@@ -79,7 +79,7 @@ App.ApplicationController = Ember.Controller.extend
new_order: (data)-> new_order: (data)->
# return if @store.all('order').findProperty('id', data.order.id) # return if @store.all('order').findProperty('id', data.order.id)
@store.pushPayload data @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)-> # @store.findById('order', data.order.id).then (order)->
# list = order.get('list') # list = order.get('list')
# list.get('orders').addObject(order) # list.get('orders').addObject(order)
@@ -1,5 +1,5 @@
App.JoinRequestsController = Ember.Controller.extend 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: actions:
rejectRequest: (join_request)-> rejectRequest: (join_request)->
Ember.$.post("#{$data_host}/user/reject_join_request", user_id: join_request.get('user.id')).then (response)-> 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 @App.modals.BaseController = Ember.Controller.extend
alert_message: "" alert_message: ""
#modal_options: Ember.Object.create(closeOnOverlay: true, closeOnModalClick: false)
title: (-> title: (->
# return title if directly set by options # return title if directly set by options
return @get('modal_options.title') if @get('modal_options.title') 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' # @get('product_orders').invoke 'eraseRecord'
orderProducts: -> orderProducts: ->
# table = @get('controllers.table.model') # table = @get('controllers.table.model')
# list = @get('controllers.application.list') # list = @get('globals.list')
# order = @store.createRecord('order', list: list, table: table) # order = @store.createRecord('order', list: list, table: table)
# new_product_orders = @store.all('product_order').filterProperty('order', null) # new_product_orders = @store.all('product_order').filterProperty('order', null)
# order.get('product_orders').pushObjects(new_product_orders) # order.get('product_orders').pushObjects(new_product_orders)
# #
# order.save().then (response)=> # order.save().then (response)=>
# new_product_orders.invoke 'eraseRecord' # new_product_orders.invoke 'eraseRecord'
# if @get('controllers.application.list') # if @get('globals.list')
# @transitionToRoute 'active_list' # @transitionToRoute 'active_list'
# else # else
# # Get list info from the server # # Get list info from the server
@@ -1,5 +1,4 @@
App.TableController = Ember.Controller.extend App.TableController = Ember.Controller.extend
join_request_sent: (-> @get('controllers.application.join_request_sent')).property('controllers.application.join_request_sent')
tableCanTakeOrders: (-> tableCanTakeOrders: (->
return false unless @get('supplier.can_take_orders') return false unless @get('supplier.can_take_orders')
list = @get('globals.list') list = @get('globals.list')
@@ -10,14 +9,14 @@ App.TableController = Ember.Controller.extend
else else
# no list and open supplier # no list and open supplier
if @get('model.occupied') then false else true 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') supplier: Ember.computed 'model.supplier', -> @get('model.supplier')
showJoinButton: (-> showJoinButton: (->
return false unless @get('supplier.can_take_orders') 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 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: actions:
joinOccupiedTable: -> joinOccupiedTable: ->
Ember.$.post("#{$data_host}/user/join_occupied_table.json", table_id: @get('model.id')) 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 App.ActiveListRoute = Ember.Route.extend App.ResetScroll
#model: -> #model: ->
#@get('controllers.application.list') #@get('globals.list')
#afterModel: -> #afterModel: ->
#controller = @controllerFor('application') #controller = @controllerFor('application')
#table_id = controller.get('list.table.id') #table_id = controller.get('list.table.id')
@@ -55,7 +55,7 @@ App.ApplicationRoute = Ember.Route.extend
defaultModalOptions = defaultModalOptions =
closeOnOverlay: true closeOnOverlay: true
closeOnModalClick: false closeOnModalClick: false
controller.set 'modal_options', $.extend(defaultModalOptions, options) controller.set 'modal_options', Ember.Object.create($.extend(defaultModalOptions, options))
@render "modals/#{modalName}", @render "modals/#{modalName}",
into: 'application' into: 'application'
outlet: 'modal' outlet: 'modal'
@@ -68,11 +68,8 @@ App.ApplicationRoute = Ember.Route.extend
parentView: 'application' parentView: 'application'
confirm: (options = {})-> confirm: (options = {})->
@send 'openModal', 'confirm', options.model ||= Ember.Object.create()
model: Ember.Object.create(body: options.body) @send 'openModal', 'confirm', options
title: options.title
cancel: options.cancel
ok: options.ok
sendFeedback: (feedback, callback)-> sendFeedback: (feedback, callback)->
return unless feedback return unless feedback
$.post $user_feedback_path, feedback: feedback, callback $.post $user_feedback_path, feedback: feedback, callback
@@ -124,8 +121,8 @@ App.ApplicationRoute = Ember.Route.extend
else else
## Offer to move table ## Offer to move table
@send 'confirm', @send 'confirm',
title: t('move_table.confirmation_title') title: t('move_table.confirmation_title', res.table)
body: t('move_table.confirmation_body') body: t('move_table.confirmation_body', res.table)
ok: => ok: =>
Ember.$.post "#{$data_host}/user/move_table.json", table_id: table._id, (res2)=> Ember.$.post "#{$data_host}/user/move_table.json", table_id: table._id, (res2)=>
if res2.occupied if res2.occupied
@@ -3,9 +3,9 @@
span.supplier-name= supplier.name span.supplier-name= supplier.name
span.table-number span.table-number
' # ' #
= number = model.number
if showJoinButton if showJoinButton
if join_request_sent if globals.join_request_sent
button.disabled button.disabled
span.fa.fa-spinner.fa-spin.fa-lg span.fa.fa-spinner.fa-spin.fa-lg
span=t 'join_request.requestor.waiting_for_approval' span=t 'join_request.requestor.waiting_for_approval'
@@ -9,5 +9,4 @@
$.extend($translations.en, <%= I18n.t('user', locale: :en).to_json %>); $.extend($translations.en, <%= I18n.t('user', locale: :en).to_json %>);
$.extend($translations.nl, <%= I18n.t('user', locale: :nl).to_json %>); $.extend($translations.nl, <%= I18n.t('user', locale: :nl).to_json %>);
setLocale() setLocale()
+9 -8
View File
@@ -58,15 +58,16 @@ private
I18n.locale = params[:locale].presence.try(:to_sym) || Rails.configuration.i18n.default_locale I18n.locale = params[:locale].presence.try(:to_sym) || Rails.configuration.i18n.default_locale
end end
def _render_with_renderer_json(resource, options) #def _render_with_renderer_json(resource, options)
serializer = build_json_serializer(resource, options) #serializer = build_json_serializer(resource, options)
if serializer #binding.pry
super(serializer, options) #if serializer
else #super(serializer, options)
super #else
end #super
end #end
#end
def layout_by_resource(*args) def layout_by_resource(*args)
#if devise_controller? #if devise_controller?
+1
View File
@@ -44,6 +44,7 @@ class UserController < Users::ApplicationController
res[:occupied] = @table.occupied? res[:occupied] = @table.occupied?
res[:reserved] = @table.reserved? res[:reserved] = @table.reserved?
res[:supplier_closed] = @table.supplier.closed? res[:supplier_closed] = @table.supplier.closed?
res[:table] = @table.attributes
if list.present? if list.present?
res[:other_supplier] = true if list.supplier_id != @table.supplier_id res[:other_supplier] = true if list.supplier_id != @table.supplier_id
res[:current_table_id] = list.table_id res[:current_table_id] = list.table_id
+2 -1
View File
@@ -63,6 +63,7 @@ class User
end end
def avatar def avatar
return '' unless provider.present?
case provider.to_sym case provider.to_sym
when :facebook then "http://graph.facebook.com/#{uid}/picture?type=square" when :facebook then "http://graph.facebook.com/#{uid}/picture?type=square"
when :instagram then auth_data['info'].try(:[], 'image') when :instagram then auth_data['info'].try(:[], 'image')
@@ -85,7 +86,7 @@ class User
# This is the user name as it is shown to other users # This is the user name as it is shown to other users
def friends_name def friends_name
auth_data['info']['nickname'] rescue '' auth_data['info']['nickname'] rescue name.to_s
end end
def has_active_list? def has_active_list?
@@ -1,6 +1,6 @@
class Suppliers::SupplierSerializer < Qwaiter::Serializer class Suppliers::SupplierSerializer < Qwaiter::Serializer
self.root = :supplier self.root = :supplier
attributes :extended_version, :open, :name, :lat, :lng, :time_zone, :address, :house_number, :house_number_addition, :postal_code, :city, :country, attributes :extended_version, :open, :name, :email, :lat, :lng, :time_zone, :address, :house_number, :house_number_addition, :postal_code, :city, :country,
:facebook_promotion_url, :iens_profile, :week_starts_on_monday, :orders_in_process_count, :orders_placed_count :facebook_promotion_url, :iens_profile, :week_starts_on_monday, :orders_in_process_count, :orders_placed_count
def extended_version def extended_version
+2 -2
View File
@@ -70,9 +70,9 @@ en:
cannot_move_to_occupied_table: 'You cannot move to an occupied table' cannot_move_to_occupied_table: 'You cannot move to an occupied table'
moved_to_another_table: 'The table is changed.' moved_to_another_table: 'The table is changed.'
confirmation_title: 'Move to another table?' confirmation_title: 'Move to another table?'
confirmation_body: 'Do you want to move to another table?' confirmation_body: 'Do you want to move to table %{number}?'
confirm: confirm:
cencel: Cancel cancel: Cancel
confirm: 'Yes' confirm: 'Yes'
list_needs_help: list_needs_help:
help_is_on_its_way: 'Help is already on its way' help_is_on_its_way: 'Help is already on its way'
+2 -2
View File
@@ -68,9 +68,9 @@ nl:
cannot_move_to_occupied_table: 'Je kan niet verhuizen naar een tafel die reeds gebruikt wordt.' cannot_move_to_occupied_table: 'Je kan niet verhuizen naar een tafel die reeds gebruikt wordt.'
moved_to_another_table: 'De tafel is gewijzigd.' moved_to_another_table: 'De tafel is gewijzigd.'
confirmation_title: 'Naar een andere tafel verhuizen?' confirmation_title: 'Naar een andere tafel verhuizen?'
confirmation_body: 'Wil je aan een andere tafel gaan zitten?' confirmation_body: 'Wil je verplaatsen naar tafel %{number}?'
confirm: confirm:
cencel: Annuleer cancel: Annuleer
confirm: 'Ja' confirm: 'Ja'
list_needs_help: list_needs_help:
help_is_on_its_way: 'Er wordt al iemand naar je tafel gestuurd' help_is_on_its_way: 'Er wordt al iemand naar je tafel gestuurd'
+6 -6
View File
@@ -3,13 +3,13 @@ module Qwaiter
# attribute :_id, key: :id # attribute :_id, key: :id
attributes :id, :created_at, :updated_at attributes :id, :created_at, :updated_at
# Bug in rails 4.1 serializing symbols in jsonify # Bug in rails 4.1 serializing symbols in jsonify
def to_json(*args) #def to_json(*args)
as_json.to_json(*args) #as_json.to_json(*args)
end #end
def id #def id
object._id #object._id
end #end
end end
end end
@@ -124,7 +124,7 @@ step "the supplier table should have been linked to the first section" do
end end
step "the supplier clicks on the table having the new list in the section view" do step "the supplier clicks on the table having the new list in the section view" do
page.find(".section-table-#{@table.id}").click js_click ".section-table-#{@table.id}"
end end
step "the supplier table actions of the new list should be visible" do step "the supplier table actions of the new list should be visible" do
@@ -3,8 +3,8 @@ step "I provide a new supplier email address" do
end end
step "the supplier submits the supplier settings form" do step "the supplier submits the supplier settings form" do
find('.submit-supplier-settings').click js_click '.submit-supplier-settings'
sleep 1.5 # give application some time #sleep 1.5 # give application some time
end end
step "the supplier email should not have been changed" do step "the supplier email should not have been changed" do
@@ -4,7 +4,7 @@ step "there is another table" do
end end
step "the user should see a popup asking the user if he would like to change table" do step "the user should see a popup asking the user if he would like to change table" do
move_table_body = page.evaluate_script "t('move_table.confirmation_body')" move_table_body = page.evaluate_script "t('move_table.confirmation_body', #{@other_table.attributes.to_json})"
move_table_body.should be_present move_table_body.should be_present
page.should have_content move_table_body page.should have_content move_table_body
end end
+7 -2
View File
@@ -1,7 +1,8 @@
require 'spec_helper' require 'spec_helper'
describe User do describe User do
let(:user){ build :user } let(:user_params){ {} }
let(:user){ build :user, user_params }
describe '#supplier_name' do describe '#supplier_name' do
it "displays the auth data name if available" do it "displays the auth data name if available" do
user.auth_data = {'info' => {'name' => 'Benji setup'}} user.auth_data = {'info' => {'name' => 'Benji setup'}}
@@ -19,8 +20,12 @@ describe User do
user.friends_name.should == 'Benji' user.friends_name.should == 'Benji'
end end
it 'falls back to unkown if not present' do it 'falls back to empty if not present' do
user.friends_name.should == '' user.friends_name.should == ''
end end
it 'falls back to persisted property name if not present through auth data' do
user_params[:name] = "Joe"
user.friends_name.should == 'Joe'
end
end end
end end
+10
View File
@@ -65,6 +65,16 @@ module SpecEmberHelpers
def js_click(selector) def js_click(selector)
find selector find selector
page.execute_script "$('#{selector}').click()" page.execute_script "$('#{selector}').click()"
# Wait for jQuery activity to finish
wait_cycles = 0
active_count = page.evaluate_script '$.active'
while active_count > 0 and wait_cycles < 30
sleep 0.1
active_count = page.evaluate_script '$.active'
wait_cycles += 1
end
raise "There are still active jQuery tasks" if active_count > 0
end end
def js_text(selector) def js_text(selector)