Small code cleanup.

This commit is contained in:
Martin Edenhofer 2014-10-05 20:33:43 +02:00
parent d8cec02fd8
commit 7a2e2cd1d2

View file

@ -39,7 +39,7 @@ class Index extends App.ControllerContent
) )
render: -> render: ->
console.log('RENDER 1')
# check authentication, redirect to login if master user already exists # check authentication, redirect to login if master user already exists
if !@master_user && !@authenticate() if !@master_user && !@authenticate()
@navigate '#login' @navigate '#login'
@ -51,13 +51,13 @@ class Index extends App.ControllerContent
new App.ControllerForm( new App.ControllerForm(
el: @el.find('#form-master') el: @el.find('#form-master')
model: App.User model: App.User
required: 'signup' screen: 'signup'
autofocus: true autofocus: true
) )
new App.ControllerForm( new App.ControllerForm(
el: @el.find('#form-agent') el: @el.find('#form-agent')
model: App.User model: App.User
required: 'invite_agent' screen: 'invite_agent'
autofocus: true autofocus: true
) )
@ -94,8 +94,7 @@ class Index extends App.ControllerContent
# save user # save user
user.save( user.save(
done: (r) => done: =>
if @master_user if @master_user
@master_user = false @master_user = false
App.Auth.login( App.Auth.login(
@ -106,7 +105,7 @@ class Index extends App.ControllerContent
success: @relogin success: @relogin
# error: @error, # error: @error,
) )
@Config.set('system_init_done', true)
App.Event.trigger 'notify', { App.Event.trigger 'notify', {
type: 'success' type: 'success'
msg: App.i18n.translateContent( 'Welcome to %s!', @Config.get('product_name') ) msg: App.i18n.translateContent( 'Welcome to %s!', @Config.get('product_name') )
@ -123,8 +122,8 @@ class Index extends App.ControllerContent
# rerender page # rerender page
@render() @render()
fail: (data) ->
fail: (data) ->
App.Event.trigger 'notify', { App.Event.trigger 'notify', {
type: 'error' type: 'error'
msg: App.i18n.translateContent( 'Can\'t create user!' ) msg: App.i18n.translateContent( 'Can\'t create user!' )