From c440b401ea68dba1564e5f2439aee1d3dc63edd9 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 20 Jan 2013 02:26:36 +0100 Subject: [PATCH] Added notify after update. --- .../app/controllers/getting_started.js.coffee | 45 +++++++++++++------ 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/app/controllers/getting_started.js.coffee b/app/assets/javascripts/app/controllers/getting_started.js.coffee index 96c069021..1f1f86d2f 100644 --- a/app/assets/javascripts/app/controllers/getting_started.js.coffee +++ b/app/assets/javascripts/app/controllers/getting_started.js.coffee @@ -15,7 +15,6 @@ class Index extends App.Controller @navupdate '#get_started' @master_user = 0 -# @render() @fetch() fetch: -> @@ -48,23 +47,22 @@ class Index extends App.Controller @navigate '#login' @html App.view('getting_started')( - master_user: @master_user, + master_user: @master_user ) new App.ControllerForm( - el: @el.find('#form-master'), - model: App.User, - required: 'signup', - autofocus: true, + el: @el.find('#form-master') + model: App.User + required: 'signup' + autofocus: true ) new App.ControllerForm( - el: @el.find('#form-agent'), - model: App.User, - required: 'invite_agent', - autofocus: true, + el: @el.find('#form-agent') + model: App.User + required: 'invite_agent' + autofocus: true ) - if !@master_user @el.find('.agent_user').removeClass('hide') @@ -104,17 +102,36 @@ class Index extends App.Controller @master_user = false App.Auth.login( data: { - username: @params.login, - password: @params.password, + username: @params.login + password: @params.password }, success: @relogin # error: @error, ) + + App.Event.trigger 'notify', { + type: 'success' + msg: App.i18n.translateContent( 'Welcome to %s!', @Config.get('product_name') ) + timeout: 2500 + } + else + App.Event.trigger 'notify', { + type: 'success' + msg: App.i18n.translateContent( 'Invitation sent!' ) + timeout: 2500 + } + # rerender page @render() -# error: => + error: (data) -> + + App.Event.trigger 'notify', { + type: 'error' + msg: App.i18n.translateContent( 'Can\'t create user!' ) + timeout: 2500 + } # @modalHide() )