diff --git a/app/styles/account/settings.sass b/app/styles/account/settings.sass index acee022d6..8751e59ef 100644 --- a/app/styles/account/settings.sass +++ b/app/styles/account/settings.sass @@ -37,44 +37,4 @@ font-size: 12px .form - max-width: 600px - -#wizard-settings-view - #color-settings - float: left - width: 600px - margin-left: 30px - - canvas - float: left - border: 2px solid black - margin: 20px - - .color-group - clear: both - padding-bottom: 10px - margin-bottom: 10px - border-bottom: 1px solid gray - - .name-cell - float: left - width: 100px - padding-top: 2px - - input - margin-right: 10px - position: relative - top: -3px - - .checkbox-cell - float: left - width: 40px - - .slider-cell - margin-bottom: 10px - float: left - width: 120px - - .selector - width: 100px - + max-width: 600px \ No newline at end of file diff --git a/app/styles/account/wizard-settings.sass b/app/styles/account/wizard-settings.sass new file mode 100644 index 000000000..6abd733df --- /dev/null +++ b/app/styles/account/wizard-settings.sass @@ -0,0 +1,42 @@ +#wizard-settings-view + h3#loading + text-align: center + + #color-settings + float: left + width: 600px + margin-left: 30px + + canvas + float: left + border: 2px solid black + margin: 20px + + .color-group + clear: both + padding-bottom: 10px + margin-bottom: 10px + border-bottom: 1px solid gray + + .name-cell + float: left + width: 100px + padding-top: 2px + + input + margin-right: 10px + position: relative + top: -3px + + .checkbox-cell + float: left + width: 40px + + .slider-cell + margin-bottom: 10px + float: left + width: 120px + + .selector + width: 100px + diff --git a/app/templates/modal/wizard_settings.jade b/app/templates/modal/wizard_settings.jade index f6cc63848..21ec05549 100644 --- a/app/templates/modal/wizard_settings.jade +++ b/app/templates/modal/wizard_settings.jade @@ -11,5 +11,10 @@ block modal-body-content #wizard-settings-view +block modal-body-wait-content + h3 Saving... +.progress.progress-striped.active + .progress-bar + block modal-footer-content button.btn.btn-primary.btn-large#wizard-settings-done(type="button") Done diff --git a/app/views/account/wizard_settings_view.coffee b/app/views/account/wizard_settings_view.coffee index 2de7adf20..fb77f992b 100644 --- a/app/views/account/wizard_settings_view.coffee +++ b/app/views/account/wizard_settings_view.coffee @@ -1,12 +1,13 @@ -RootView = require 'views/kinds/RootView' +CocoView = require 'views/kinds/CocoView' template = require 'templates/account/wizard_settings' {me} = require('lib/auth') ThangType = require 'models/ThangType' SpriteBuilder = require 'lib/sprites/SpriteBuilder' -module.exports = class WizardSettingsView extends RootView +module.exports = class WizardSettingsView extends CocoView id: 'wizard-settings-view' template: template + startsLoading: true events: 'change .color-group-checkbox': (e) -> @@ -25,6 +26,7 @@ module.exports = class WizardSettingsView extends RootView @wizardThangType.once 'sync', @initCanvas, @ initCanvas: -> + @startsLoading = false @render() @spriteBuilder = new SpriteBuilder(@wizardThangType) @initStage() @@ -44,6 +46,7 @@ module.exports = class WizardSettingsView extends RootView c afterRender: -> + return if @startsLoading wizardSettings = me.get('wizard') or {} wizardSettings.colorConfig ?= {} diff --git a/app/views/kinds/CocoView.coffee b/app/views/kinds/CocoView.coffee index 081bd0076..a4b70ee2a 100644 --- a/app/views/kinds/CocoView.coffee +++ b/app/views/kinds/CocoView.coffee @@ -129,7 +129,7 @@ module.exports = class CocoView extends Backbone.View # Loading RootViews showLoading: ($el=@$el) -> - $el.find('>').hide() + $el.find('>').addClass('hidden') $el.append($('
') .append('

Loading

') .append('
')) @@ -138,7 +138,7 @@ module.exports = class CocoView extends Backbone.View hideLoading: -> return unless @_lastLoading? @_lastLoading.find('.loading-screen').remove() - @_lastLoading.find('>').show() + @_lastLoading.find('>').removeClass('hidden') @_lastLoading = null # Loading ModalViews diff --git a/app/views/kinds/RootView.coffee b/app/views/kinds/RootView.coffee index daefb695e..910bc6d18 100644 --- a/app/views/kinds/RootView.coffee +++ b/app/views/kinds/RootView.coffee @@ -26,8 +26,8 @@ module.exports = class RootView extends CocoView logoutUser($('#login-email').val()) showWizardSettingsModal: -> - WizardSettingsView = require('views/modal/wizard_settings_modal') - subview = new WizardSettingsView {} + WizardSettingsModal = require('views/modal/wizard_settings_modal') + subview = new WizardSettingsModal {} @openModalView subview showLoading: ($el) -> diff --git a/app/views/modal/wizard_settings_modal.coffee b/app/views/modal/wizard_settings_modal.coffee index bc9570a43..794509521 100644 --- a/app/views/modal/wizard_settings_modal.coffee +++ b/app/views/modal/wizard_settings_modal.coffee @@ -5,7 +5,7 @@ ThangType = require 'models/ThangType' {me} = require 'lib/auth' forms = require('lib/forms') -module.exports = class WizardSettingsView extends View +module.exports = class WizardSettingsModal extends View id: "wizard-settings-modal" template: template closesOnClickOutside: false @@ -23,7 +23,6 @@ module.exports = class WizardSettingsView extends View me.set('name', $('#wizard-settings-name').val()) onWizardSettingsDone: -> - console.log 'saving changes' forms.clearFormAlerts(@$el) res = me.validate() if res? @@ -37,12 +36,10 @@ module.exports = class WizardSettingsView extends View res.error => errors = JSON.parse(res.responseText) - console.log 'resulting error!', errors forms.applyErrorsToForm(@$el, errors) @disableModalInProgress(@$el) - res.success (model, response, options) -> - console.log 'resulting success!' -# @hide() + res.success (model, response, options) => + @hide() @enableModalInProgress(@$el) me.save() \ No newline at end of file