Divide UserController into a UserController and a PreferencesController. Divide FeedController into a FeedController and a FeedlistController. Pull up layout and login filter into ApplicationController and override as needed. Ignored new tmp directories.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@376 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2006-12-13 08:31:48 +00:00
parent 1e4f462f21
commit 1d22f08670
25 changed files with 218 additions and 88 deletions

View file

@ -1,8 +1,6 @@
class AdminController < ApplicationController
before_filter :login_required
before_filter :admin_login_required
layout 'standard'
def index
@user_pages, @users = paginate :users, :order => 'login ASC', :per_page => 10

View file

@ -13,8 +13,11 @@ class ApplicationController < ActionController::Base
helper :application
include LoginSystem
layout 'standard'
before_filter :set_session_expiration
before_filter :get_current_user
prepend_before_filter :login_required
after_filter :set_charset

View file

@ -2,6 +2,8 @@ class BackendController < ApplicationController
wsdl_service_name 'Backend'
web_service_api TodoApi
web_service_scaffold :invoke
skip_before_filter :login_required
def new_todo(username, token, context_id, description)
check_token_against_user_word(username, token)

View file

@ -2,10 +2,8 @@ class ContextController < ApplicationController
helper :todo
prepend_before_filter :login_required
before_filter :init, :except => [:create, :destroy, :order]
before_filter :init_todos, :only => :show
layout "standard", :except => :date_preview
def index
list

View file

@ -3,19 +3,14 @@
class FeedController < ApplicationController
helper :feed
session :disabled => true, :except => 'index' # Prevents session control from interfering with feed
layout nil
before_filter :check_token_against_user_word, :except => 'index'
prepend_before_filter :login_required, :only => 'index'
session :disabled => true # Prevents session control from interfering with feed
skip_before_filter :login_required
before_filter :check_token_against_user_word
before_filter :prepare_for_feed, :only => [:rss, :text, :ical]
def index
@page_title = 'TRACKS::Feeds'
init_data_for_sidebar
render :layout => 'standard'
end
# Build an RSS feed
def rss
headers["Content-Type"] = "text/xml; charset=utf-8"

View file

@ -0,0 +1,11 @@
class FeedlistController < ApplicationController
helper :feedlist
def index
@page_title = 'TRACKS::Feeds'
init_data_for_sidebar
render :layout => 'standard'
end
end

View file

@ -1,6 +1,8 @@
class LoginController < ApplicationController
layout 'login'
skip_before_filter :set_session_expiration
skip_before_filter :login_required
open_id_consumer if Tracks::Config.auth_schemes.include?('open_id')
def login

View file

@ -2,7 +2,6 @@ class MobileController < ApplicationController
layout 'mobile'
prepend_before_filter :login_required
before_filter :init, :except => :update
# Plain list of all next actions, paginated 6 per page

View file

@ -1,9 +1,5 @@
class NoteController < ApplicationController
prepend_before_filter :login_required
layout "standard"
def index
@all_notes = @user.notes
@page_title = "TRACKS::All notes"

View file

@ -0,0 +1,25 @@
class PreferencesController < ApplicationController
def index
@page_title = "TRACKS::Preferences"
@prefs = @user.preference
end
def edit
@page_title = "TRACKS::Edit Preferences"
@prefs = @user.preference
render :object => @prefs
end
def update
user_success = @user.update_attributes(params['user'])
prefs_success = @user.preference.update_attributes(params['prefs'])
if user_success && prefs_success
redirect_to :action => 'index'
else
render :action => 'edit'
end
end
end

View file

@ -1,12 +1,9 @@
class ProjectController < ApplicationController
helper :todo
prepend_before_filter :login_required
before_filter :init, :except => [:create, :destroy, :order, :toggle_project_done]
before_filter :init_todos, :only => :show
layout "standard", :except => :date_preview
def index
list
render_action "list"

View file

@ -2,9 +2,8 @@ class TodoController < ApplicationController
helper :todo
prepend_before_filter :login_required
append_before_filter :init, :except => [ :destroy, :completed, :completed_archive, :check_tickler ]
layout "standard", :except => :date_preview
layout 'standard', :except => :date_preview
# Main method for listing tasks
# Set page title, and fill variables with contexts and done and not-done tasks

View file

@ -1,6 +1,5 @@
class UserController < ApplicationController
layout 'standard'
prepend_before_filter :login_required
if Tracks::Config.auth_schemes.include?('open_id')
open_id_consumer
before_filter :begin_open_id_auth, :only => :update_auth_type
@ -68,7 +67,7 @@ class UserController < ApplicationController
def update_password
if do_change_password_for(@user)
redirect_to :controller => 'user', :action => 'preferences'
redirect_to :controller => 'preferences'
else
redirect_to :controller => 'user', :action => 'change_password'
notify :warning, "There was a problem saving the password. Please retry."
@ -97,7 +96,7 @@ class UserController < ApplicationController
@user.auth_type = params[:user][:auth_type]
if @user.save
notify :notice, "Authentication type updated."
redirect_to :controller => 'user', :action => 'preferences'
redirect_to :controller => 'preferences'
else
notify :warning, "There was a problem updating your authentication type: #{ @user.errors.full_messages.join(', ')}"
redirect_to :controller => 'user', :action => 'change_auth_type'