Removed workaround with invalid role_ids. Improved code layout.
This commit is contained in:
parent
54f6c456b7
commit
ab83b577ba
1 changed files with 21 additions and 26 deletions
|
@ -58,7 +58,6 @@ class Index extends App.WizardFullScreen
|
||||||
|
|
||||||
App.Config.set( 'getting_started', Index, 'Routes' )
|
App.Config.set( 'getting_started', Index, 'Routes' )
|
||||||
|
|
||||||
|
|
||||||
class AutoWizard extends App.WizardFullScreen
|
class AutoWizard extends App.WizardFullScreen
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
|
@ -122,9 +121,8 @@ class AutoWizard extends App.WizardFullScreen
|
||||||
renderToken: ->
|
renderToken: ->
|
||||||
@html App.view('getting_started/auto_wizard_enabled')()
|
@html App.view('getting_started/auto_wizard_enabled')()
|
||||||
|
|
||||||
App.Config.set( 'getting_started/auto_wizard', AutoWizard, 'Routes' )
|
App.Config.set('getting_started/auto_wizard', AutoWizard, 'Routes')
|
||||||
App.Config.set( 'getting_started/auto_wizard/:token', AutoWizard, 'Routes' )
|
App.Config.set('getting_started/auto_wizard/:token', AutoWizard, 'Routes')
|
||||||
|
|
||||||
|
|
||||||
class Admin extends App.WizardFullScreen
|
class Admin extends App.WizardFullScreen
|
||||||
events:
|
events:
|
||||||
|
@ -171,7 +169,7 @@ class Admin extends App.WizardFullScreen
|
||||||
return
|
return
|
||||||
|
|
||||||
# load group collection
|
# load group collection
|
||||||
App.Collection.load( type: 'Group', data: data.groups )
|
App.Collection.load(type: 'Group', data: data.groups)
|
||||||
|
|
||||||
# render page
|
# render page
|
||||||
@render()
|
@render()
|
||||||
|
@ -192,7 +190,7 @@ class Admin extends App.WizardFullScreen
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@formDisable(e)
|
@formDisable(e)
|
||||||
@params = @formParam(e.target)
|
@params = @formParam(e.target)
|
||||||
@params.role_ids = [0]
|
@params.role_ids = []
|
||||||
|
|
||||||
user = new App.User
|
user = new App.User
|
||||||
user.load(@params)
|
user.load(@params)
|
||||||
|
@ -202,7 +200,7 @@ class Admin extends App.WizardFullScreen
|
||||||
)
|
)
|
||||||
if errors
|
if errors
|
||||||
@log 'error new', errors
|
@log 'error new', errors
|
||||||
@formValidate( form: e.target, errors: errors )
|
@formValidate(form: e.target, errors: errors)
|
||||||
@formEnable(e)
|
@formEnable(e)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -239,8 +237,7 @@ class Admin extends App.WizardFullScreen
|
||||||
|
|
||||||
@navigate 'getting_started/base'
|
@navigate 'getting_started/base'
|
||||||
|
|
||||||
App.Config.set( 'getting_started/admin', Admin, 'Routes' )
|
App.Config.set('getting_started/admin', Admin, 'Routes')
|
||||||
|
|
||||||
|
|
||||||
class Base extends App.WizardFullScreen
|
class Base extends App.WizardFullScreen
|
||||||
elements:
|
elements:
|
||||||
|
@ -323,8 +320,8 @@ class Base extends App.WizardFullScreen
|
||||||
|
|
||||||
maxSiteInMb = 8
|
maxSiteInMb = 8
|
||||||
if file.size && file.size > 1024 * 1024 * maxSiteInMb
|
if file.size && file.size > 1024 * 1024 * maxSiteInMb
|
||||||
@showAlert( 'logo', App.i18n.translateInline( 'File too big, max. %s MB allowed.', maxSiteInMb ) )
|
@showAlert( 'logo', App.i18n.translateInline('File too big, max. %s MB allowed.', maxSiteInMb ))
|
||||||
@logoPreview.attr( 'src', '' )
|
@logoPreview.attr('src', '')
|
||||||
return
|
return
|
||||||
|
|
||||||
reader.readAsDataURL(file)
|
reader.readAsDataURL(file)
|
||||||
|
@ -375,8 +372,7 @@ class Base extends App.WizardFullScreen
|
||||||
@$("[name=#{field}]").closest('.form-group').addClass('has-error')
|
@$("[name=#{field}]").closest('.form-group').addClass('has-error')
|
||||||
@$("[name=#{field}]").closest('.form-group').find('.alert').removeClass('hide').text( App.i18n.translateInline( message ) )
|
@$("[name=#{field}]").closest('.form-group').find('.alert').removeClass('hide').text( App.i18n.translateInline( message ) )
|
||||||
|
|
||||||
App.Config.set( 'getting_started/base', Base, 'Routes' )
|
App.Config.set('getting_started/base', Base, 'Routes')
|
||||||
|
|
||||||
|
|
||||||
class EmailNotification extends App.WizardFullScreen
|
class EmailNotification extends App.WizardFullScreen
|
||||||
events:
|
events:
|
||||||
|
@ -495,8 +491,7 @@ class EmailNotification extends App.WizardFullScreen
|
||||||
@enable(e)
|
@enable(e)
|
||||||
)
|
)
|
||||||
|
|
||||||
App.Config.set( 'getting_started/email_notification', EmailNotification, 'Routes' )
|
App.Config.set('getting_started/email_notification', EmailNotification, 'Routes')
|
||||||
|
|
||||||
|
|
||||||
class Channel extends App.WizardFullScreen
|
class Channel extends App.WizardFullScreen
|
||||||
constructor: ->
|
constructor: ->
|
||||||
|
@ -547,7 +542,7 @@ class Channel extends App.WizardFullScreen
|
||||||
adapters: @adapters
|
adapters: @adapters
|
||||||
)
|
)
|
||||||
|
|
||||||
App.Config.set( 'getting_started/channel', Channel, 'Routes' )
|
App.Config.set('getting_started/channel', Channel, 'Routes')
|
||||||
|
|
||||||
class ChannelEmailPreConfigured extends App.WizardFullScreen
|
class ChannelEmailPreConfigured extends App.WizardFullScreen
|
||||||
constructor: ->
|
constructor: ->
|
||||||
|
@ -590,7 +585,7 @@ class ChannelEmailPreConfigured extends App.WizardFullScreen
|
||||||
data
|
data
|
||||||
)
|
)
|
||||||
|
|
||||||
App.Config.set( 'getting_started/channel/email_pre_configured', ChannelEmailPreConfigured, 'Routes' )
|
App.Config.set('getting_started/channel/email_pre_configured', ChannelEmailPreConfigured, 'Routes')
|
||||||
|
|
||||||
class ChannelEmail extends App.WizardFullScreen
|
class ChannelEmail extends App.WizardFullScreen
|
||||||
events:
|
events:
|
||||||
|
@ -881,7 +876,7 @@ class ChannelEmail extends App.WizardFullScreen
|
||||||
@showAlert('js-intro', 'Unable to verify sending and receiving. Please check your settings.' )
|
@showAlert('js-intro', 'Unable to verify sending and receiving. Please check your settings.' )
|
||||||
)
|
)
|
||||||
|
|
||||||
App.Config.set( 'getting_started/channel/email', ChannelEmail, 'Routes' )
|
App.Config.set('getting_started/channel/email', ChannelEmail, 'Routes')
|
||||||
|
|
||||||
class Agent extends App.WizardFullScreen
|
class Agent extends App.WizardFullScreen
|
||||||
events:
|
events:
|
||||||
|
@ -916,7 +911,7 @@ class Agent extends App.WizardFullScreen
|
||||||
return
|
return
|
||||||
|
|
||||||
# load group collection
|
# load group collection
|
||||||
App.Collection.load( type: 'Group', data: data.groups )
|
App.Collection.load(type: 'Group', data: data.groups)
|
||||||
|
|
||||||
# render page
|
# render page
|
||||||
@render()
|
@render()
|
||||||
|
@ -937,13 +932,13 @@ class Agent extends App.WizardFullScreen
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@formDisable(e)
|
@formDisable(e)
|
||||||
@params = @formParam(e.target)
|
@params = @formParam(e.target)
|
||||||
@params.role_ids = [0]
|
@params.role_ids = []
|
||||||
|
|
||||||
# set invite flag
|
# set invite flag
|
||||||
@params.invite = true
|
@params.invite = true
|
||||||
|
|
||||||
# find agent role
|
# find agent role
|
||||||
role = App.Role.findByAttribute( 'name', 'Agent' )
|
role = App.Role.findByAttribute('name', 'Agent')
|
||||||
if role
|
if role
|
||||||
@params.role_ids = role.id
|
@params.role_ids = role.id
|
||||||
|
|
||||||
|
@ -955,7 +950,7 @@ class Agent extends App.WizardFullScreen
|
||||||
)
|
)
|
||||||
if errors
|
if errors
|
||||||
@log 'error new', errors
|
@log 'error new', errors
|
||||||
@formValidate( form: e.target, errors: errors )
|
@formValidate(form: e.target, errors: errors)
|
||||||
@formEnable(e)
|
@formEnable(e)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -964,7 +959,7 @@ class Agent extends App.WizardFullScreen
|
||||||
done: (r) =>
|
done: (r) =>
|
||||||
App.Event.trigger 'notify', {
|
App.Event.trigger 'notify', {
|
||||||
type: 'success'
|
type: 'success'
|
||||||
msg: App.i18n.translateContent( 'Invitation sent!' )
|
msg: App.i18n.translateContent('Invitation sent!')
|
||||||
timeout: 3500
|
timeout: 3500
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -975,12 +970,12 @@ class Agent extends App.WizardFullScreen
|
||||||
@formEnable(e)
|
@formEnable(e)
|
||||||
App.Event.trigger 'notify', {
|
App.Event.trigger 'notify', {
|
||||||
type: 'error'
|
type: 'error'
|
||||||
msg: App.i18n.translateContent( details.error_human || 'Can\'t create user!' )
|
msg: App.i18n.translateContent(details.error_human || 'Can\'t create user!')
|
||||||
timeout: 2500
|
timeout: 2500
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
App.Config.set( 'getting_started/agents', Agent, 'Routes' )
|
App.Config.set('getting_started/agents', Agent, 'Routes')
|
||||||
|
|
||||||
class Channel extends App.WizardFullScreen
|
class Channel extends App.WizardFullScreen
|
||||||
constructor: ->
|
constructor: ->
|
||||||
|
@ -1007,4 +1002,4 @@ class Channel extends App.WizardFullScreen
|
||||||
4300
|
4300
|
||||||
)
|
)
|
||||||
|
|
||||||
App.Config.set( 'getting_started/finish', Channel, 'Routes' )
|
App.Config.set('getting_started/finish', Channel, 'Routes')
|
||||||
|
|
Loading…
Reference in a new issue