Settings saving feedback

This commit is contained in:
2014-10-03 18:07:02 +02:00
parent 1cd5798dee
commit b22f93aec6
7 changed files with 48 additions and 47 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'rails', '4.2.0.beta2' gem 'rails', '4.2.0.beta1'
gem 'rack-cors', :require => 'rack/cors' gem 'rack-cors', :require => 'rack/cors'
# Bundle edge Rails instead: # Bundle edge Rails instead:
+34 -40
View File
@@ -51,39 +51,37 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actionmailer (4.2.0.beta2) actionmailer (4.2.0.beta1)
actionpack (= 4.2.0.beta2) actionpack (= 4.2.0.beta1)
actionview (= 4.2.0.beta2) actionview (= 4.2.0.beta1)
activejob (= 4.2.0.beta2)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.3) rails-dom-testing (~> 1.0, >= 1.0.2)
actionpack (4.2.0.beta2) actionpack (4.2.0.beta1)
actionview (= 4.2.0.beta2) actionview (= 4.2.0.beta1)
activesupport (= 4.2.0.beta2) activesupport (= 4.2.0.beta1)
rack (~> 1.6.0.beta) rack (~> 1.6.0.beta)
rack-test (~> 0.6.2) rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.3) rails-deprecated_sanitizer (~> 1.0, >= 1.0.2)
rails-html-sanitizer (~> 1.0, >= 1.0.1) rails-dom-testing (~> 1.0, >= 1.0.2)
actionview (4.2.0.beta2) actionview (4.2.0.beta1)
activesupport (= 4.2.0.beta2) activesupport (= 4.2.0.beta1)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.3) rails-deprecated_sanitizer (~> 1.0, >= 1.0.2)
rails-html-sanitizer (~> 1.0, >= 1.0.1) rails-dom-testing (~> 1.0, >= 1.0.2)
active_decorator (0.3.4) active_decorator (0.3.4)
active_model_serializers (0.9.0) active_model_serializers (0.9.0)
activemodel (>= 3.2) activemodel (>= 3.2)
activejob (4.2.0.beta2) activejob (4.2.0.beta1)
activesupport (= 4.2.0.beta2) globalid (>= 0.2.3)
globalid (>= 0.3.0) activemodel (4.2.0.beta1)
activemodel (4.2.0.beta2) activesupport (= 4.2.0.beta1)
activesupport (= 4.2.0.beta2)
builder (~> 3.1) builder (~> 3.1)
activerecord (4.2.0.beta2) activerecord (4.2.0.beta1)
activemodel (= 4.2.0.beta2) activemodel (= 4.2.0.beta1)
activesupport (= 4.2.0.beta2) activesupport (= 4.2.0.beta1)
arel (>= 6.0.0.beta1, < 6.1) arel (>= 6.0.0.beta1, < 6.1)
activesupport (4.2.0.beta2) activesupport (4.2.0.beta1)
i18n (>= 0.7.0.beta1, < 0.8) i18n (>= 0.7.0.beta1, < 0.8)
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
@@ -241,8 +239,6 @@ GEM
addressable (~> 2.3) addressable (~> 2.3)
letter_opener (1.2.0) letter_opener (1.2.0)
launchy (~> 2.2) launchy (~> 2.2)
loofah (2.0.1)
nokogiri (>= 1.5.9)
mail (2.6.1) mail (2.6.1)
mime-types (>= 1.16, < 3) mime-types (>= 1.16, < 3)
method_source (0.8.2) method_source (0.8.2)
@@ -293,16 +289,16 @@ GEM
rack-cors (0.2.9) rack-cors (0.2.9)
rack-test (0.6.2) rack-test (0.6.2)
rack (>= 1.0) rack (>= 1.0)
rails (4.2.0.beta2) rails (4.2.0.beta1)
actionmailer (= 4.2.0.beta2) actionmailer (= 4.2.0.beta1)
actionpack (= 4.2.0.beta2) actionpack (= 4.2.0.beta1)
actionview (= 4.2.0.beta2) actionview (= 4.2.0.beta1)
activejob (= 4.2.0.beta2) activejob (= 4.2.0.beta1)
activemodel (= 4.2.0.beta2) activemodel (= 4.2.0.beta1)
activerecord (= 4.2.0.beta2) activerecord (= 4.2.0.beta1)
activesupport (= 4.2.0.beta2) activesupport (= 4.2.0.beta1)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.2.0.beta2) railties (= 4.2.0.beta1)
sprockets-rails (~> 3.0.0.beta1) sprockets-rails (~> 3.0.0.beta1)
rails-deprecated_sanitizer (1.0.3) rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha) activesupport (>= 4.2.0.alpha)
@@ -310,11 +306,9 @@ GEM
activesupport activesupport
nokogiri (~> 1.6.0) nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1) rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.1) railties (4.2.0.beta1)
loofah (~> 2.0) actionpack (= 4.2.0.beta1)
railties (4.2.0.beta2) activesupport (= 4.2.0.beta1)
actionpack (= 4.2.0.beta2)
activesupport (= 4.2.0.beta2)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rake (10.3.2) rake (10.3.2)
@@ -457,7 +451,7 @@ DEPENDENCIES
pry-rails pry-rails
quiet_assets quiet_assets
rack-cors rack-cors
rails (= 4.2.0.beta2) rails (= 4.2.0.beta1)
rqrcode rqrcode
rspec-its rspec-its
rspec-rails rspec-rails
@@ -3,7 +3,9 @@ App.SettingsController = Ember.ObjectController.extend
# 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
editIensProfile: (-> @get('model.country') is 'Netherlands' ).property('model.country') editIensProfile: (-> @get('model.country') is 'Netherlands' ).property('model.country')
actions: actions:
saveSettings: -> saveSettings: ->
@get('model').save() @set 'saving', true
@get('model').save().then (supplier) => @set 'saving', false
@@ -2,7 +2,7 @@ attr = DS.attr
App.ProductOrder = DS.Model.extend App.ProductOrder = DS.Model.extend
quantity: attr 'number', defaultValue: 1 quantity: attr 'number', defaultValue: 1
price: attr 'number' price: attr 'number'
product: DS.belongsTo('product') product: DS.belongsTo('product', async: true)
order: DS.belongsTo('order') order: DS.belongsTo('order')
increment: -> increment: ->
@set('quantity', @get('quantity') + 1) @set('quantity', @get('quantity') + 1)
@@ -37,4 +37,9 @@ if editIensProfile
= image_tag 'supplier/settings/iens-example.png' = image_tag 'supplier/settings/iens-example.png'
span=t "settings.reviews.explanation" span=t "settings.reviews.explanation"
.form-row.form-actions .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'
+1 -1
View File
@@ -28,7 +28,7 @@ class SupplierController < ApplicationController
end end
format.json do format.json do
current_supplier.update_attributes(supplier_params) current_supplier.update_attributes(supplier_params)
render nothing: true render json: SupplierSupplierSerializer.new(current_supplier).as_json
end end
end end
end end
+2 -2
View File
@@ -6,8 +6,8 @@ test:
validation_framework: :active_model #optional validation_framework: :active_model #optional
#database: "http://mozo:secret@localhost:5984/qwaiter_test" #database: "http://mozo:secret@localhost:5984/qwaiter_test"
#Testing can only be done as couchdb admin, since it requires creating and destroying the database #Testing can only be done as couchdb admin, since it requires creating and destroying the database
#database: "qwaiter_test" database: "qwaiter_test"
database: "http://admin:secret@localhost:5984/qwaiter_test" # database: "http://admin:secret@localhost:5984/qwaiter_test"
production: production:
validation_framework: :active_model #optional validation_framework: :active_model #optional
database: qwaiter database: qwaiter