Improved getting_started feature.

This commit is contained in:
Martin Edenhofer 2012-04-11 08:34:56 +02:00
parent ecea57baba
commit 870df3af0f
3 changed files with 21 additions and 21 deletions

View file

@ -10,9 +10,6 @@ class Index extends App.Controller
constructor: -> constructor: ->
super super
# check authentication
# return if !@authenticate()
# set title # set title
@title 'Get Started' @title 'Get Started'
@navupdate '#get_started' @navupdate '#get_started'
@ -41,14 +38,16 @@ class Index extends App.Controller
# load group collection # load group collection
@loadCollection( type: 'Group', data: data.groups ) @loadCollection( type: 'Group', data: data.groups )
# load role collection
@loadCollection( type: 'Role', data: data.roles )
# render page # render page
@render() @render()
) )
render: -> render: ->
# check authentication, redirect to login if master user already exists
if !@master_user && !@authenticate()
@navigate '#login'
@html App.view('getting_started')( @html App.view('getting_started')(
form_agent: @formGen( model: App.User, required: 'invite_agent' ), form_agent: @formGen( model: App.User, required: 'invite_agent' ),
form_master: @formGen( model: App.User, required: 'signup' ), form_master: @formGen( model: App.User, required: 'signup' ),
@ -91,7 +90,6 @@ class Index extends App.Controller
# send email # send email
# clear form # clear form
# @fetch()
auth = new App.Auth auth = new App.Auth
auth.login( auth.login(
data: { data: {
@ -110,6 +108,7 @@ class Index extends App.Controller
@log 'login:success', data @log 'login:success', data
if @master_user if @master_user
# login check # login check
auth = new App.Auth auth = new App.Auth
auth.loginCheck() auth.loginCheck()
@ -127,5 +126,4 @@ class Index extends App.Controller
# @navigate '#getting_started' # @navigate '#getting_started'
# @fetch() # @fetch()
Config.Routes['getting_started'] = Index Config.Routes['getting_started'] = Index

View file

@ -1,8 +1,17 @@
<div class="hero-unit"> <div class="hero-unit">
<h1>Getting started!<small></small></h1>
<h1>Getting started!<small></small></h1>
<div class="container"> <div class="container">
<div class="row">
<div class="span12">
<ol>
<li>Create Admin</li>
<li>Invite Agents</li>
<li>Configure Channels</li>
</ol>
</div>
</div>
<div class="row"> <div class="row">
<% if @master_user: %> <% if @master_user: %>
<div class="span6 master_user"> <div class="span6 master_user">

View file

@ -11,18 +11,11 @@ class GettingStartedController < ApplicationController
# get all groups # get all groups
@groups = Group.where( :active => true ) @groups = Group.where( :active => true )
@roles = Role.where( :active => true )
# return result # return result
respond_to do |format|
format.json {
render :json => { render :json => {
:master_user => master_user, :master_user => master_user,
:groups => @groups, :groups => @groups,
:roles => @roles,
}
} }
end end
end
end end