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
@@ -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
@@ -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)
@@ -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'
+1 -1
View File
@@ -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