diff --git a/Gemfile b/Gemfile index a08f5306..3c23bba5 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -gem 'rails', '4.2.0.beta2' +gem 'rails', '4.2.0.beta1' gem 'rack-cors', :require => 'rack/cors' # Bundle edge Rails instead: diff --git a/Gemfile.lock b/Gemfile.lock index c3b141fc..de99b66a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -51,39 +51,37 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.0.beta2) - actionpack (= 4.2.0.beta2) - actionview (= 4.2.0.beta2) - activejob (= 4.2.0.beta2) + actionmailer (4.2.0.beta1) + actionpack (= 4.2.0.beta1) + actionview (= 4.2.0.beta1) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.3) - actionpack (4.2.0.beta2) - actionview (= 4.2.0.beta2) - activesupport (= 4.2.0.beta2) + rails-dom-testing (~> 1.0, >= 1.0.2) + actionpack (4.2.0.beta1) + actionview (= 4.2.0.beta1) + activesupport (= 4.2.0.beta1) rack (~> 1.6.0.beta) rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.3) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - actionview (4.2.0.beta2) - activesupport (= 4.2.0.beta2) + rails-deprecated_sanitizer (~> 1.0, >= 1.0.2) + rails-dom-testing (~> 1.0, >= 1.0.2) + actionview (4.2.0.beta1) + activesupport (= 4.2.0.beta1) builder (~> 3.1) erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.3) - rails-html-sanitizer (~> 1.0, >= 1.0.1) + rails-deprecated_sanitizer (~> 1.0, >= 1.0.2) + rails-dom-testing (~> 1.0, >= 1.0.2) active_decorator (0.3.4) active_model_serializers (0.9.0) activemodel (>= 3.2) - activejob (4.2.0.beta2) - activesupport (= 4.2.0.beta2) - globalid (>= 0.3.0) - activemodel (4.2.0.beta2) - activesupport (= 4.2.0.beta2) + activejob (4.2.0.beta1) + globalid (>= 0.2.3) + activemodel (4.2.0.beta1) + activesupport (= 4.2.0.beta1) builder (~> 3.1) - activerecord (4.2.0.beta2) - activemodel (= 4.2.0.beta2) - activesupport (= 4.2.0.beta2) + activerecord (4.2.0.beta1) + activemodel (= 4.2.0.beta1) + activesupport (= 4.2.0.beta1) arel (>= 6.0.0.beta1, < 6.1) - activesupport (4.2.0.beta2) + activesupport (4.2.0.beta1) i18n (>= 0.7.0.beta1, < 0.8) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) @@ -241,8 +239,6 @@ GEM addressable (~> 2.3) letter_opener (1.2.0) launchy (~> 2.2) - loofah (2.0.1) - nokogiri (>= 1.5.9) mail (2.6.1) mime-types (>= 1.16, < 3) method_source (0.8.2) @@ -293,16 +289,16 @@ GEM rack-cors (0.2.9) rack-test (0.6.2) rack (>= 1.0) - rails (4.2.0.beta2) - actionmailer (= 4.2.0.beta2) - actionpack (= 4.2.0.beta2) - actionview (= 4.2.0.beta2) - activejob (= 4.2.0.beta2) - activemodel (= 4.2.0.beta2) - activerecord (= 4.2.0.beta2) - activesupport (= 4.2.0.beta2) + rails (4.2.0.beta1) + actionmailer (= 4.2.0.beta1) + actionpack (= 4.2.0.beta1) + actionview (= 4.2.0.beta1) + activejob (= 4.2.0.beta1) + activemodel (= 4.2.0.beta1) + activerecord (= 4.2.0.beta1) + activesupport (= 4.2.0.beta1) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.0.beta2) + railties (= 4.2.0.beta1) sprockets-rails (~> 3.0.0.beta1) rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) @@ -310,11 +306,9 @@ GEM activesupport nokogiri (~> 1.6.0) rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.1) - loofah (~> 2.0) - railties (4.2.0.beta2) - actionpack (= 4.2.0.beta2) - activesupport (= 4.2.0.beta2) + railties (4.2.0.beta1) + actionpack (= 4.2.0.beta1) + activesupport (= 4.2.0.beta1) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.3.2) @@ -457,7 +451,7 @@ DEPENDENCIES pry-rails quiet_assets rack-cors - rails (= 4.2.0.beta2) + rails (= 4.2.0.beta1) rqrcode rspec-its rspec-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 3aa9880d..8e3f7368 100644 --- a/app/assets/javascripts/supplier/app/controllers/settings_controller.js.coffee +++ b/app/assets/javascripts/supplier/app/controllers/settings_controller.js.coffee @@ -3,7 +3,9 @@ App.SettingsController = Ember.ObjectController.extend # 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') actions: saveSettings: -> - @get('model').save() + @set 'saving', true + @get('model').save().then (supplier) => @set 'saving', false diff --git a/app/assets/javascripts/supplier/app/models/product_order.js.coffee b/app/assets/javascripts/supplier/app/models/product_order.js.coffee index 8d7001ab..8507bf3b 100644 --- a/app/assets/javascripts/supplier/app/models/product_order.js.coffee +++ b/app/assets/javascripts/supplier/app/models/product_order.js.coffee @@ -2,7 +2,7 @@ attr = DS.attr App.ProductOrder = DS.Model.extend quantity: attr 'number', defaultValue: 1 price: attr 'number' - product: DS.belongsTo('product') + product: DS.belongsTo('product', async: true) order: DS.belongsTo('order') increment: -> @set('quantity', @get('quantity') + 1) diff --git a/app/assets/javascripts/supplier/app/templates/settings.emblem b/app/assets/javascripts/supplier/app/templates/settings.emblem index 99272af7..2210ba88 100644 --- a/app/assets/javascripts/supplier/app/templates/settings.emblem +++ b/app/assets/javascripts/supplier/app/templates/settings.emblem @@ -37,4 +37,9 @@ if editIensProfile = image_tag 'supplier/settings/iens-example.png' span=t "settings.reviews.explanation" .form-row.form-actions - button.button.submit-supplier-settings{action 'saveSettings'}=t 'settings.save' + if saving + button.button.submit-supplier-settings.disabled + = t 'settings.save' + span.fa.fa-lg.fa-spinner.fa-spin + else + button.button.submit-supplier-settings{action 'saveSettings'}=t 'settings.save' diff --git a/app/controllers/supplier_controller.rb b/app/controllers/supplier_controller.rb index ceb60373..a76e63c2 100644 --- a/app/controllers/supplier_controller.rb +++ b/app/controllers/supplier_controller.rb @@ -28,7 +28,7 @@ class SupplierController < ApplicationController end format.json do current_supplier.update_attributes(supplier_params) - render nothing: true + render json: SupplierSupplierSerializer.new(current_supplier).as_json end end end diff --git a/config/couchdb.yml b/config/couchdb.yml index 16e715b7..911a80a8 100644 --- a/config/couchdb.yml +++ b/config/couchdb.yml @@ -6,8 +6,8 @@ test: validation_framework: :active_model #optional #database: "http://mozo:secret@localhost:5984/qwaiter_test" #Testing can only be done as couchdb admin, since it requires creating and destroying the database - #database: "qwaiter_test" - database: "http://admin:secret@localhost:5984/qwaiter_test" + database: "qwaiter_test" + # database: "http://admin:secret@localhost:5984/qwaiter_test" production: validation_framework: :active_model #optional database: qwaiter