diff --git a/tracks/app/controllers/context_controller.rb b/tracks/app/controllers/context_controller.rb index be13381b..af9f0b1b 100644 --- a/tracks/app/controllers/context_controller.rb +++ b/tracks/app/controllers/context_controller.rb @@ -32,7 +32,7 @@ class ContextController < ApplicationController # def new_context context = @user.contexts.build - context.attributes = @params['context'] + context.attributes = params['context'] context.name = deurlize(context.name) if context.save @@ -49,10 +49,10 @@ class ContextController < ApplicationController def add_item self.init @item = @user.todos.build - @item.attributes = @params["todo"] + @item.attributes = params["todo"] if @item.due? - @item.due = Date.strptime(@params["todo"]["due"], @user.preferences["date_format"]) + @item.due = Date.strptime(params["todo"]["due"], @user.preferences["date_format"]) else @item.due = "" end @@ -140,7 +140,7 @@ class ContextController < ApplicationController # def update check_user_set_context - @context.attributes = @params["context"] + @context.attributes = params["context"] @context.name = deurlize(@context.name) if @context.save render_partial 'context_listing', @context @@ -166,7 +166,7 @@ class ContextController < ApplicationController # Methods for changing the sort order of the contexts in the list # def order - @params["list-contexts"].each_with_index do |id, position| + params["list-contexts"].each_with_index do |id, position| if check_user_matches_context_user(id) Context.update(id, :position => position + 1) end @@ -177,10 +177,10 @@ class ContextController < ApplicationController protected def check_user_set_context - if @params["name"] - @context = Context.find_by_name_and_user_id(deurlize(@params["name"]), @user.id) - elsif @params['id'] - @context = Context.find_by_id_and_user_id(@params["id"], @user.id) + if params["name"] + @context = Context.find_by_name_and_user_id(deurlize(params["name"]), @user.id) + elsif params['id'] + @context = Context.find_by_id_and_user_id(params["id"], @user.id) else redirect_to(:controller => "context", :action => "list" ) end @@ -205,7 +205,7 @@ class ContextController < ApplicationController end def check_user_return_item - item = Todo.find( @params['id'] ) + item = Todo.find( params['id'] ) if @user == item.user return item else diff --git a/tracks/app/controllers/feed_controller.rb b/tracks/app/controllers/feed_controller.rb index 8e84dbdc..95ec646e 100644 --- a/tracks/app/controllers/feed_controller.rb +++ b/tracks/app/controllers/feed_controller.rb @@ -14,7 +14,7 @@ class FeedController < ApplicationController # Build an RSS feed def rss prepare_for_feed - @headers["Content-Type"] = "text/xml; charset=utf-8" + headers["Content-Type"] = "text/xml; charset=utf-8" end # Builds a plain text page listing uncompleted next actions, @@ -27,12 +27,12 @@ class FeedController < ApplicationController # def text prepare_for_feed - if @params.key?('context') - @contexts = [ @user.contexts.find(@params['context']) ] + if params.key?('context') + @contexts = [ @user.contexts.find(params['context']) ] else @contexts = @user.contexts.find_all_by_hide(false, "position ASC") end - @headers["Content-Type"] = "text/plain; charset=utf-8" + headers["Content-Type"] = "text/plain; charset=utf-8" end # Builds an iCal compatible export of uncompleted todos @@ -41,32 +41,32 @@ class FeedController < ApplicationController # def ical prepare_for_feed - if @params.key?('context') - @contexts = [ @user.contexts.find(@params['context']) ] + if params.key?('context') + @contexts = [ @user.contexts.find(params['context']) ] else @contexts = @user.contexts.find_all_by_hide(false, "position ASC") end - @headers["Content-Type"] = "text/plain; charset=utf-8" + headers["Content-Type"] = "text/plain; charset=utf-8" end def list_projects_only @projects = @user.projects @description = "Lists all the projects for #{@user.login}." - render :action => 'projects_' + @params['feedtype'] + render :action => 'projects_' + params['feedtype'] end def list_contexts_only @contexts = @user.contexts @description = "Lists all the contexts for #{@user.login}." - render :action => 'contexts_' + @params['feedtype'] + render :action => 'contexts_' + params['feedtype'] end protected # Check whether the token in the URL matches the word in the User's table def check_token_against_user_word - @user = User.find_by_login( @params['name'] ) - unless ( @params['token'] == @user.word) + @user = User.find_by_login( params['name'] ) + unless ( params['token'] == @user.word) render :text => "Sorry, you don't have permission to view this page." return false end @@ -78,15 +78,15 @@ protected condition_builder.add 'todos.done = ?', false - if @params.key?('limit') - options[:limit] = limit = @params['limit'] + if params.key?('limit') + options[:limit] = limit = params['limit'] @description = limit ? "Lists the last #{limit} uncompleted next actions" : "Lists uncompleted next actions" end @title = "Tracks - Next Actions" @description = "Filter: " - if @params.key?('due') - due_within = @params['due'].to_i + if params.key?('due') + due_within = params['due'].to_i condition_builder.add('todos.due <= ?', due_within.days.from_now) due_within_date_s = due_within.days.from_now.strftime("%Y-%m-%d") @title << " due today" if (due_within == 0) @@ -94,15 +94,15 @@ protected @description << " with a due date #{due_within_date_s} or earlier" end - if @params.key?('context') - context = @user.contexts.find(@params['context']) + if params.key?('context') + context = @user.contexts.find(params['context']) condition_builder.add('todos.context_id = ?', context.id) @title << " in #{context.name}" @description << " in context '#{context.name}'" end - if @params.key?('project') - project = @user.projects.find(@params['project']) + if params.key?('project') + project = @user.projects.find(params['project']) condition_builder.add('todos.project_id = ?', project.id) @title << " for #{project.name}" @description << " for project '#{project.name}'" @@ -119,16 +119,16 @@ protected def initialize @queries = Array.new - @params = Array.new + params = Array.new end def add(query, param) @queries << query - @params << param + params << param end def to_conditions - [@queries.join(' AND ')] + @params + [@queries.join(' AND ')] + params end end diff --git a/tracks/app/controllers/login_controller.rb b/tracks/app/controllers/login_controller.rb index 1f651629..add6d0ac 100644 --- a/tracks/app/controllers/login_controller.rb +++ b/tracks/app/controllers/login_controller.rb @@ -5,13 +5,13 @@ class LoginController < ApplicationController def login @page_title = "TRACKS::Login" - case @request.method + case request.method when :post - if @user = User.authenticate(@params['user_login'], @params['user_password']) + if @user = User.authenticate(params['user_login'], params['user_password']) session['user_id'] = @user.id # If checkbox on login page checked, we don't expire the session after 1 hour # of inactivity - session['noexpiry']= @params['user_noexpiry'] + session['noexpiry']= params['user_noexpiry'] if session['noexpiry'] == "on" msg = "will not expire." else @@ -20,7 +20,7 @@ class LoginController < ApplicationController flash['notice'] = "Login successful: session #{msg}" redirect_back_or_default :controller => "todo", :action => "list" else - @login = @params['user_login'] + @login = params['user_login'] flash['warning'] = "Login unsuccessful" end end @@ -56,7 +56,7 @@ class LoginController < ApplicationController end def create - user = User.new(@params['user']) + user = User.new(params['user']) unless user.valid? session['new_user'] = user redirect_to :controller => 'login', :action => 'signup' @@ -65,7 +65,7 @@ class LoginController < ApplicationController user.is_admin = true if User.find_all.empty? if user.save - @user = User.authenticate(user.login, @params['user']['password']) + @user = User.authenticate(user.login, params['user']['password']) @user.preferences = { "date_format" => "%d/%m/%Y", "week_starts" => "1", "no_completed" => "5", "staleness_starts" => "7", "due_style" => "1", "admin_email" => "butshesagirl@rousette.org.uk"} @user.save flash['notice'] = "Signup successful for user #{@user.login}." @@ -74,8 +74,8 @@ class LoginController < ApplicationController end def delete - if @params['id'] and ( @params['id'] = @user.id or @user.is_admin ) - @user = User.find(@params['id']) + if params['id'] and ( params['id'] = @user.id or @user.is_admin ) + @user = User.find(params['id']) # TODO: Maybe it would be better to mark deleted. That way user deletes can be reversed. @user.destroy end diff --git a/tracks/app/controllers/note_controller.rb b/tracks/app/controllers/note_controller.rb index 9a8f4b8f..16be4baf 100644 --- a/tracks/app/controllers/note_controller.rb +++ b/tracks/app/controllers/note_controller.rb @@ -19,7 +19,7 @@ class NoteController < ApplicationController # def add note = @user.notes.build - note.attributes = @params["new_note"] + note.attributes = params["new_note"] if note.save render_partial 'notes_summary', note @@ -40,7 +40,7 @@ class NoteController < ApplicationController def update note = check_user_return_note - note.attributes = @params["note"] + note.attributes = params["note"] if note.save render_partial 'notes', note else @@ -52,7 +52,7 @@ class NoteController < ApplicationController protected def check_user_return_note - note = Note.find_by_id( @params['id'] ) + note = Note.find_by_id( params['id'] ) if @user == note.user return note else diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/project_controller.rb index 04bd513f..3c972911 100644 --- a/tracks/app/controllers/project_controller.rb +++ b/tracks/app/controllers/project_controller.rb @@ -55,7 +55,7 @@ class ProjectController < ApplicationController def new_project project = @user.projects.build - project.attributes = @params['project'] + project.attributes = params['project'] project.name = deurlize(project.name) if project.save @@ -72,10 +72,10 @@ class ProjectController < ApplicationController def add_item self.init @item = @user.todos.build - @item.attributes = @params["todo"] + @item.attributes = params["todo"] if @item.due? - @item.due = Date.strptime(@params["todo"]["due"], @user.preferences["date_format"]) + @item.due = Date.strptime(params["todo"]["due"], @user.preferences["date_format"]) else @item.due = "" end @@ -165,7 +165,7 @@ class ProjectController < ApplicationController # def update check_user_set_project - @project.attributes = @params["project"] + @project.attributes = params["project"] @project.name = deurlize(@project.name) if @project.save render_partial 'project_listing', @project @@ -201,7 +201,7 @@ class ProjectController < ApplicationController # Methods for changing the sort order of the projects in the list # def order - @params["list-projects"].each_with_index do |id, position| + params["list-projects"].each_with_index do |id, position| if check_user_matches_project_user(id) Project.update(id, :position => position + 1) end @@ -212,10 +212,10 @@ class ProjectController < ApplicationController protected def check_user_set_project - if @params["name"] - @project = Project.find_by_name_and_user_id(deurlize(@params["name"]), @user.id) - elsif @params['id'] - @project = Project.find_by_id_and_user_id(@params["id"], @user.id) + if params["name"] + @project = Project.find_by_name_and_user_id(deurlize(params["name"]), @user.id) + elsif params['id'] + @project = Project.find_by_id_and_user_id(params["id"], @user.id) else redirect_to(:controller => "project", :action => "list" ) end @@ -240,7 +240,7 @@ class ProjectController < ApplicationController end def check_user_return_item - item = Todo.find( @params['id'] ) + item = Todo.find( params['id'] ) if @user == item.user return item else diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index f55b5c23..be8f56c6 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -49,10 +49,10 @@ class TodoController < ApplicationController def add_item self.init @item = @user.todos.build - @item.attributes = @params["todo"] + @item.attributes = params["todo"] if @item.due? - @item.due = Date.strptime(@params["todo"]["due"], @user.preferences["date_format"]) + @item.due = Date.strptime(params["todo"]["due"], @user.preferences["date_format"]) else @item.due = "" end @@ -87,10 +87,10 @@ class TodoController < ApplicationController # def add_deferred_item self.init - @tickle = Deferred.create(@params["todo"]) + @tickle = Deferred.create(params["todo"]) if @tickle.due? - @tickle.due = Date.strptime(@params["todo"]["due"], @user.preferences["date_format"]) + @tickle.due = Date.strptime(params["todo"]["due"], @user.preferences["date_format"]) else @tickle.due = "" end @@ -162,15 +162,15 @@ class TodoController < ApplicationController # def update_action self.init - if @params["on_project_page"] == true + if params["on_project_page"] == true @on_page = "project" end @item = check_user_return_item @original_item_context_id = @item.context_id - @item.attributes = @params["item"] + @item.attributes = params["item"] if @item.due? - @item.due = Date.strptime(@params["item"]["due"], @user.preferences["date_format"]) + @item.due = Date.strptime(params["item"]["due"], @user.preferences["date_format"]) else @item.due = "" end @@ -182,10 +182,10 @@ class TodoController < ApplicationController #self.init @tickle = check_user_return_item @original_item_context_id = @tickle.context_id - @tickle.attributes = @params["item"] + @tickle.attributes = params["item"] if @tickle.due? - @tickle.due = Date.strptime(@params["item"]["due"], @user.preferences["date_format"]) + @tickle.due = Date.strptime(params["item"]["due"], @user.preferences["date_format"]) else @tickle.due = "" end @@ -280,7 +280,7 @@ class TodoController < ApplicationController protected def check_user_return_item - item = Todo.find( @params['id'] ) + item = Todo.find( params['id'] ) if @user == item.user return item else diff --git a/tracks/app/controllers/user_controller.rb b/tracks/app/controllers/user_controller.rb index adefc6eb..11ce5719 100644 --- a/tracks/app/controllers/user_controller.rb +++ b/tracks/app/controllers/user_controller.rb @@ -23,12 +23,12 @@ class UserController < ApplicationController end def update_preferences - @user.preferences = { "date_format" => "#{@params['prefs']['date_format']}", - "week_starts" => "#{@params['prefs']['week_starts']}", - "no_completed" => "#{@params['prefs']['no_completed']}", - "staleness_starts" => "#{@params['prefs']['staleness_starts']}", - "due_style" => "#{@params['prefs']['due_style']}", - "admin_email" => "#{@params['prefs']['admin_email']}" + @user.preferences = { "date_format" => "#{params['prefs']['date_format']}", + "week_starts" => "#{params['prefs']['week_starts']}", + "no_completed" => "#{params['prefs']['no_completed']}", + "staleness_starts" => "#{params['prefs']['staleness_starts']}", + "due_style" => "#{params['prefs']['due_style']}", + "admin_email" => "#{params['prefs']['admin_email']}" } if @user.save redirect_to :action => 'preferences' diff --git a/tracks/app/helpers/login_helper.rb b/tracks/app/helpers/login_helper.rb index 72c3e2b5..bffb636c 100644 --- a/tracks/app/helpers/login_helper.rb +++ b/tracks/app/helpers/login_helper.rb @@ -3,7 +3,7 @@ module LoginHelper def render_errors(obj) return "" unless obj - return "" unless @request.post? + return "" unless request.post? tag = String.new unless obj.valid? diff --git a/tracks/app/views/context/list.rhtml b/tracks/app/views/context/list.rhtml index 46df24cc..66c29c07 100644 --- a/tracks/app/views/context/list.rhtml +++ b/tracks/app/views/context/list.rhtml @@ -38,11 +38,11 @@ -<% if @flash["confirmation"] %> -