diff --git a/Gemfile b/Gemfile index 2f48132d..0d1a638d 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gem 'slim-rails' # Gems used only for assets and not required # 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 gem 'jquery-rails' gem 'jquery-ui-rails' @@ -35,8 +35,8 @@ group :assets do gem 'uglifier', '>= 1.0.3' gem 'ember-rails' - gem 'ember-source', '~> 1.13.0' - gem 'emblem-rails' + #gem 'ember-source', '~> 1.13.0' + #gem 'emblem-rails' gem 'ember-validations-rails' gem 'ember-emblem-template' diff --git a/Gemfile.lock b/Gemfile.lock index 264349ce..31d4414a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,13 +54,13 @@ GEM erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) 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) active_attr (0.8.5) activemodel (>= 3.0.2, < 5.0) activesupport (>= 3.0.2, < 5.0) active_decorator (0.5.3) - active_model_serializers (0.9.0) + active_model_serializers (0.9.3) activemodel (>= 3.2) activejob (4.2.3) activesupport (= 4.2.3) @@ -79,15 +79,12 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.3.8) - airbrussh (0.6.0) + airbrussh (0.7.0) sshkit (>= 1.6.1, != 1.7.0) - arel (6.0.2) + arel (6.0.3) barber (0.9.1) ember-source (>= 1.0, < 2) execjs (>= 1.2, < 3) - barber-emblem (0.1.2) - barber (>= 0.4.1) - emblem-source bcrypt (3.1.10) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) @@ -121,7 +118,7 @@ GEM capybara-screenshot (1.0.11) capybara (>= 1.0, < 3) launchy - celluloid (0.16.0) + celluloid (0.16.1) timers (~> 4.0.0) childprocess (0.5.6) ffi (~> 1.0, >= 1.0.11) @@ -151,7 +148,7 @@ GEM crack (0.4.2) safe_yaml (~> 1.0.0) debug_inspector (0.0.2) - devise (3.5.1) + devise (3.5.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) @@ -173,7 +170,7 @@ GEM eventmachine (>= 1.0.0.beta.4) email_validator (1.6.0) activemodel - ember-data-source (1.13.6) + ember-data-source (1.13.8) ember-source (>= 1.8, < 3.0) ember-emblem-template (0.2.2) barber (>= 0.9.0) @@ -190,15 +187,11 @@ GEM ember-source (>= 1.8.0) jquery-rails (>= 1.0.17) railties (>= 3.1) - ember-source (1.13.5) + ember-source (1.13.7) ember-validations-rails (1.0.0) 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) - eventmachine (1.0.7) + eventmachine (1.0.8) execjs (2.5.2) factory_girl (4.5.0) activesupport (>= 3.0.0) @@ -219,7 +212,7 @@ GEM eventmachine (>= 0.12.0) websocket-driver (>= 0.5.1) ffi (1.9.10) - font-awesome-rails (4.3.0.0) + font-awesome-rails (4.4.0.0) railties (>= 3.2, < 5.0) foreman (0.78.0) thor (~> 0.19.1) @@ -231,7 +224,7 @@ GEM ruby-progressbar (~> 1.4) gherkin (2.12.2) multi_json (~> 1.3) - globalid (0.3.5) + globalid (0.3.6) activesupport (>= 4.1.0) hashie (3.4.2) hike (1.2.3) @@ -247,7 +240,7 @@ GEM thor (>= 0.14, < 2.0) jquery-ui-rails (5.0.5) railties (>= 3.2.16) - js-routes (1.0.1) + js-routes (1.1.0) railties (>= 3.2) sprockets-rails json (1.8.3) @@ -265,9 +258,9 @@ GEM mime-types (>= 1.16, < 3) method_source (0.8.2) mime-types (2.6.1) - mini_magick (4.2.7) + mini_magick (4.2.10) mini_portile (0.6.2) - minitest (5.7.0) + minitest (5.8.0) multi_json (1.11.2) multi_xml (0.5.5) multipart-post (2.0.0) @@ -309,7 +302,7 @@ GEM slop (~> 3.4) pry-rails (0.3.4) pry (>= 0.9.10) - puma (2.12.2) + puma (2.12.3) quiet_assets (1.1.0) railties (>= 3.1, < 5.0) rack (1.6.4) @@ -327,7 +320,7 @@ GEM bundler (>= 1.3.0, < 2.0) railties (= 4.2.3) sprockets-rails - rails-assets-ember-qunit (0.4.6) + rails-assets-ember-qunit (0.4.9) rails-assets-qunit (1.18.0) rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) @@ -385,7 +378,7 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (~> 1.1) - selenium-webdriver (2.46.2) + selenium-webdriver (2.47.1) childprocess (~> 0.5) multi_json (~> 1.0) rubyzip (~> 1.0) @@ -431,7 +424,7 @@ GEM tilt (1.4.1) timers (4.0.1) hitimes - tinymce-rails (4.2.2) + tinymce-rails (4.2.3) railties (>= 3.1.1) turnip (1.3.1) gherkin (>= 2.5) @@ -468,7 +461,7 @@ DEPENDENCIES ace-rails-ap active_attr active_decorator - active_model_serializers (= 0.9.0) + active_model_serializers (~> 0.9.3) airbrussh bourbon cancancan @@ -486,9 +479,7 @@ DEPENDENCIES devise_simply_stored! ember-emblem-template ember-rails - ember-source (~> 1.13.0) ember-validations-rails - emblem-rails factory_girl_rails faye font-awesome-rails diff --git a/app/assets/javascripts/supplier/app/controllers/settings_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/settings_controller.js.coffee index e477f6d0..77418803 100644 --- a/app/assets/javascripts/supplier/app/controllers/settings_controller.js.coffee +++ b/app/assets/javascripts/supplier/app/controllers/settings_controller.js.coffee @@ -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' diff --git a/app/assets/javascripts/supplier/app/routes/settings_route.js.coffee b/app/assets/javascripts/supplier/app/routes/settings_route.js.coffee index 145b55f0..c6dfad7f 100644 --- a/app/assets/javascripts/supplier/app/routes/settings_route.js.coffee +++ b/app/assets/javascripts/supplier/app/routes/settings_route.js.coffee @@ -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 diff --git a/app/assets/javascripts/supplier/app/store.js.coffee b/app/assets/javascripts/supplier/app/store.js.coffee index f5d5f423..6400d6d7 100644 --- a/app/assets/javascripts/supplier/app/store.js.coffee +++ b/app/assets/javascripts/supplier/app/store.js.coffee @@ -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" diff --git a/app/assets/javascripts/supplier/app/templates/settings.emblem b/app/assets/javascripts/supplier/app/templates/settings.emblem index c652187e..ec8aa252 100644 --- a/app/assets/javascripts/supplier/app/templates/settings.emblem +++ b/app/assets/javascripts/supplier/app/templates/settings.emblem @@ -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 diff --git a/app/assets/javascripts/user/app/app.js.coffee b/app/assets/javascripts/user/app/app.js.coffee index 63ed8fc2..7e78a59b 100644 --- a/app/assets/javascripts/user/app/app.js.coffee +++ b/app/assets/javascripts/user/app/app.js.coffee @@ -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)-> diff --git a/app/assets/javascripts/user/app/controllers/active_list_controller.js.coffee b/app/assets/javascripts/user/app/controllers/active_list_controller.js.coffee index b98aef1a..dba75e96 100644 --- a/app/assets/javascripts/user/app/controllers/active_list_controller.js.coffee +++ b/app/assets/javascripts/user/app/controllers/active_list_controller.js.coffee @@ -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') diff --git a/app/assets/javascripts/user/app/controllers/application_controller.js.coffee b/app/assets/javascripts/user/app/controllers/application_controller.js.coffee index a57db38b..7fa0c9d4 100644 --- a/app/assets/javascripts/user/app/controllers/application_controller.js.coffee +++ b/app/assets/javascripts/user/app/controllers/application_controller.js.coffee @@ -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) diff --git a/app/assets/javascripts/user/app/controllers/join_requests_controller.js.coffee b/app/assets/javascripts/user/app/controllers/join_requests_controller.js.coffee index d4b9b3c3..a470c38c 100644 --- a/app/assets/javascripts/user/app/controllers/join_requests_controller.js.coffee +++ b/app/assets/javascripts/user/app/controllers/join_requests_controller.js.coffee @@ -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)-> diff --git a/app/assets/javascripts/user/app/controllers/modals/base_controller.js.coffee b/app/assets/javascripts/user/app/controllers/modals/base_controller.js.coffee index c2f746cf..3a44d1da 100644 --- a/app/assets/javascripts/user/app/controllers/modals/base_controller.js.coffee +++ b/app/assets/javascripts/user/app/controllers/modals/base_controller.js.coffee @@ -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') diff --git a/app/assets/javascripts/user/app/controllers/modals/confirm.js.coffee b/app/assets/javascripts/user/app/controllers/modals/confirm.js.coffee new file mode 100644 index 00000000..4c910d94 --- /dev/null +++ b/app/assets/javascripts/user/app/controllers/modals/confirm.js.coffee @@ -0,0 +1,2 @@ +@App.modals.ConfirmController = @App.modals.BaseController.extend + body: Ember.computed 'modal_options.body', -> @get('modal_options.body') diff --git a/app/assets/javascripts/user/app/controllers/product_orders_controller.js.coffee b/app/assets/javascripts/user/app/controllers/product_orders_controller.js.coffee index 85584056..29c55579 100644 --- a/app/assets/javascripts/user/app/controllers/product_orders_controller.js.coffee +++ b/app/assets/javascripts/user/app/controllers/product_orders_controller.js.coffee @@ -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 diff --git a/app/assets/javascripts/user/app/controllers/table_controller.js.coffee b/app/assets/javascripts/user/app/controllers/table_controller.js.coffee index e9fe4d2c..cca13b90 100644 --- a/app/assets/javascripts/user/app/controllers/table_controller.js.coffee +++ b/app/assets/javascripts/user/app/controllers/table_controller.js.coffee @@ -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 diff --git a/app/assets/javascripts/user/app/routes/active_list_route.js.coffee b/app/assets/javascripts/user/app/routes/active_list_route.js.coffee index 2881aa4b..8c74f9e6 100644 --- a/app/assets/javascripts/user/app/routes/active_list_route.js.coffee +++ b/app/assets/javascripts/user/app/routes/active_list_route.js.coffee @@ -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') diff --git a/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb b/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb index 9d272c15..7ef70a39 100644 --- a/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb +++ b/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb @@ -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 diff --git a/app/assets/javascripts/user/app/templates/table.emblem b/app/assets/javascripts/user/app/templates/table.emblem index 07b14f61..4a025d41 100644 --- a/app/assets/javascripts/user/app/templates/table.emblem +++ b/app/assets/javascripts/user/app/templates/table.emblem @@ -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' diff --git a/app/assets/javascripts/user/flat/application.js.coffee.erb b/app/assets/javascripts/user/flat/application.js.coffee.erb index 65d67168..69160a2c 100644 --- a/app/assets/javascripts/user/flat/application.js.coffee.erb +++ b/app/assets/javascripts/user/flat/application.js.coffee.erb @@ -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() diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 20838568..1a2777ac 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -58,15 +58,16 @@ private I18n.locale = params[:locale].presence.try(:to_sym) || Rails.configuration.i18n.default_locale end - def _render_with_renderer_json(resource, options) - serializer = build_json_serializer(resource, options) + #def _render_with_renderer_json(resource, options) + #serializer = build_json_serializer(resource, options) - if serializer - super(serializer, options) - else - super - end - end + #binding.pry + #if serializer + #super(serializer, options) + #else + #super + #end + #end def layout_by_resource(*args) #if devise_controller? diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 5e943729..8002a809 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -44,6 +44,7 @@ class UserController < Users::ApplicationController res[:occupied] = @table.occupied? res[:reserved] = @table.reserved? res[:supplier_closed] = @table.supplier.closed? + res[:table] = @table.attributes if list.present? res[:other_supplier] = true if list.supplier_id != @table.supplier_id res[:current_table_id] = list.table_id diff --git a/app/models/user.rb b/app/models/user.rb index 11f38fca..d09ca01e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -63,6 +63,7 @@ class User end def avatar + return '' unless provider.present? case provider.to_sym when :facebook then "http://graph.facebook.com/#{uid}/picture?type=square" 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 def friends_name - auth_data['info']['nickname'] rescue '' + auth_data['info']['nickname'] rescue name.to_s end def has_active_list? diff --git a/app/serializers/suppliers/supplier_serializer.rb b/app/serializers/suppliers/supplier_serializer.rb index 96cbf1a8..0c3e9417 100644 --- a/app/serializers/suppliers/supplier_serializer.rb +++ b/app/serializers/suppliers/supplier_serializer.rb @@ -1,6 +1,6 @@ class Suppliers::SupplierSerializer < Qwaiter::Serializer 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 def extended_version diff --git a/config/locales/user.en.yml b/config/locales/user.en.yml index 1cb94541..5bf79cc3 100644 --- a/config/locales/user.en.yml +++ b/config/locales/user.en.yml @@ -70,9 +70,9 @@ en: cannot_move_to_occupied_table: 'You cannot move to an occupied table' moved_to_another_table: 'The table is changed.' 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: - cencel: Cancel + cancel: Cancel confirm: 'Yes' list_needs_help: help_is_on_its_way: 'Help is already on its way' diff --git a/config/locales/user.nl.yml b/config/locales/user.nl.yml index 7680fc55..5fe5dbc1 100644 --- a/config/locales/user.nl.yml +++ b/config/locales/user.nl.yml @@ -68,9 +68,9 @@ nl: cannot_move_to_occupied_table: 'Je kan niet verhuizen naar een tafel die reeds gebruikt wordt.' moved_to_another_table: 'De tafel is gewijzigd.' 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: - cencel: Annuleer + cancel: Annuleer confirm: 'Ja' list_needs_help: help_is_on_its_way: 'Er wordt al iemand naar je tafel gestuurd' diff --git a/lib/qwaiter/serializer.rb b/lib/qwaiter/serializer.rb index 904ac162..94698a9b 100644 --- a/lib/qwaiter/serializer.rb +++ b/lib/qwaiter/serializer.rb @@ -3,13 +3,13 @@ module Qwaiter # attribute :_id, key: :id attributes :id, :created_at, :updated_at # Bug in rails 4.1 serializing symbols in jsonify - def to_json(*args) - as_json.to_json(*args) - end + #def to_json(*args) + #as_json.to_json(*args) + #end - def id - object._id - end + #def id + #object._id + #end end end diff --git a/spec/acceptance_steps/suppliers/section_view_steps.rb b/spec/acceptance_steps/suppliers/section_view_steps.rb index 0ea50af5..d3fd6390 100644 --- a/spec/acceptance_steps/suppliers/section_view_steps.rb +++ b/spec/acceptance_steps/suppliers/section_view_steps.rb @@ -124,7 +124,7 @@ step "the supplier table should have been linked to the first section" do end 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 step "the supplier table actions of the new list should be visible" do diff --git a/spec/acceptance_steps/suppliers/settings_steps.rb b/spec/acceptance_steps/suppliers/settings_steps.rb index 4a263f10..d077ea9d 100644 --- a/spec/acceptance_steps/suppliers/settings_steps.rb +++ b/spec/acceptance_steps/suppliers/settings_steps.rb @@ -3,8 +3,8 @@ step "I provide a new supplier email address" do end step "the supplier submits the supplier settings form" do - find('.submit-supplier-settings').click - sleep 1.5 # give application some time + js_click '.submit-supplier-settings' + #sleep 1.5 # give application some time end step "the supplier email should not have been changed" do diff --git a/spec/acceptance_steps/users/changing_table_steps.rb b/spec/acceptance_steps/users/changing_table_steps.rb index 5f0bf9ba..175bdbfc 100644 --- a/spec/acceptance_steps/users/changing_table_steps.rb +++ b/spec/acceptance_steps/users/changing_table_steps.rb @@ -4,7 +4,7 @@ step "there is another table" do end 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 page.should have_content move_table_body end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index b4cafba5..eb1aa231 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,7 +1,8 @@ require 'spec_helper' describe User do - let(:user){ build :user } + let(:user_params){ {} } + let(:user){ build :user, user_params } describe '#supplier_name' do it "displays the auth data name if available" do user.auth_data = {'info' => {'name' => 'Benji setup'}} @@ -19,8 +20,12 @@ describe User do user.friends_name.should == 'Benji' end - it 'falls back to unkown if not present' do + it 'falls back to empty if not present' do user.friends_name.should == '' 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 diff --git a/spec/support/ember_helpers.rb b/spec/support/ember_helpers.rb index 8ca6c770..cf18cb9f 100644 --- a/spec/support/ember_helpers.rb +++ b/spec/support/ember_helpers.rb @@ -65,6 +65,16 @@ module SpecEmberHelpers def js_click(selector) find selector 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 def js_text(selector)