From 870df3af0f9756c00dd63a8e6a370689dffe4401 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 11 Apr 2012 08:34:56 +0200 Subject: [PATCH] Improved getting_started feature. --- .../app/controllers/getting_started.js.coffee | 14 ++++++-------- .../javascripts/app/views/getting_started.jst.eco | 13 +++++++++++-- app/controllers/getting_started_controller.rb | 15 ++++----------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/assets/javascripts/app/controllers/getting_started.js.coffee b/app/assets/javascripts/app/controllers/getting_started.js.coffee index 93d1e9544..00d4578f7 100644 --- a/app/assets/javascripts/app/controllers/getting_started.js.coffee +++ b/app/assets/javascripts/app/controllers/getting_started.js.coffee @@ -10,9 +10,6 @@ class Index extends App.Controller constructor: -> super - # check authentication -# return if !@authenticate() - # set title @title 'Get Started' @navupdate '#get_started' @@ -41,14 +38,16 @@ class Index extends App.Controller # load group collection @loadCollection( type: 'Group', data: data.groups ) - # load role collection - @loadCollection( type: 'Role', data: data.roles ) - # render page @render() ) render: -> + + # check authentication, redirect to login if master user already exists + if !@master_user && !@authenticate() + @navigate '#login' + @html App.view('getting_started')( form_agent: @formGen( model: App.User, required: 'invite_agent' ), form_master: @formGen( model: App.User, required: 'signup' ), @@ -91,7 +90,6 @@ class Index extends App.Controller # send email # clear form -# @fetch() auth = new App.Auth auth.login( data: { @@ -110,6 +108,7 @@ class Index extends App.Controller @log 'login:success', data if @master_user + # login check auth = new App.Auth auth.loginCheck() @@ -127,5 +126,4 @@ class Index extends App.Controller # @navigate '#getting_started' # @fetch() - Config.Routes['getting_started'] = Index diff --git a/app/assets/javascripts/app/views/getting_started.jst.eco b/app/assets/javascripts/app/views/getting_started.jst.eco index 561994d4b..b62e5108a 100644 --- a/app/assets/javascripts/app/views/getting_started.jst.eco +++ b/app/assets/javascripts/app/views/getting_started.jst.eco @@ -1,8 +1,17 @@
-

Getting started!

+ +

Getting started!

- +
+
+
    +
  1. Create Admin
  2. +
  3. Invite Agents
  4. +
  5. Configure Channels
  6. +
+
+
<% if @master_user: %>
diff --git a/app/controllers/getting_started_controller.rb b/app/controllers/getting_started_controller.rb index 1fec2cccd..b37624900 100644 --- a/app/controllers/getting_started_controller.rb +++ b/app/controllers/getting_started_controller.rb @@ -11,18 +11,11 @@ class GettingStartedController < ApplicationController # get all groups @groups = Group.where( :active => true ) - @roles = Role.where( :active => true ) # return result - respond_to do |format| - format.json { - render :json => { - :master_user => master_user, - :groups => @groups, - :roles => @roles, - } - } - end + render :json => { + :master_user => master_user, + :groups => @groups, + } end - end \ No newline at end of file