summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/account_controller.rb6
-rw-r--r--app/controllers/admin_controller.rb4
-rw-r--r--app/controllers/auth_sources_controller.rb8
-rw-r--r--app/controllers/boards_controller.rb2
-rw-r--r--app/controllers/comments_controller.rb4
-rw-r--r--app/controllers/custom_fields_controller.rb8
-rw-r--r--app/controllers/documents_controller.rb8
-rw-r--r--app/controllers/enumerations_controller.rb8
-rw-r--r--app/controllers/groups_controller.rb10
-rw-r--r--app/controllers/issue_categories_controller.rb17
-rw-r--r--app/controllers/issue_relations_controller.rb4
11 files changed, 42 insertions, 37 deletions
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index 70ab85170..9eaf5f6d3 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -110,7 +110,7 @@ class AccountController < ApplicationController
session[:auth_source_registration] = nil
self.logged_user = @user
flash[:notice] = l(:notice_account_activated)
- redirect_to :controller => 'my', :action => 'account'
+ redirect_to my_account_path
end
else
@user.login = params[:user][:login]
@@ -218,7 +218,7 @@ class AccountController < ApplicationController
set_autologin_cookie(user)
end
call_hook(:controller_account_success_authentication_after, {:user => user })
- redirect_back_or_default :controller => 'my', :action => 'page'
+ redirect_back_or_default my_page_path
end
def set_autologin_cookie(user)
@@ -270,7 +270,7 @@ class AccountController < ApplicationController
if user.save
self.logged_user = user
flash[:notice] = l(:notice_account_activated)
- redirect_to :controller => 'my', :action => 'account'
+ redirect_to my_account_path
else
yield if block_given?
end
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index a7a1b9a14..fd9cfccee 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -54,7 +54,7 @@ class AdminController < ApplicationController
flash[:error] = l(:error_can_t_load_default_data, e.message)
end
end
- redirect_to :action => 'index'
+ redirect_to admin_path
end
def test_email
@@ -68,7 +68,7 @@ class AdminController < ApplicationController
flash[:error] = l(:notice_email_error, e.message)
end
ActionMailer::Base.raise_delivery_errors = raise_delivery_errors
- redirect_to :controller => 'settings', :action => 'edit', :tab => 'notifications'
+ redirect_to settings_path(:tab => 'notifications')
end
def info
diff --git a/app/controllers/auth_sources_controller.rb b/app/controllers/auth_sources_controller.rb
index c850bc83d..0ba89ec02 100644
--- a/app/controllers/auth_sources_controller.rb
+++ b/app/controllers/auth_sources_controller.rb
@@ -34,7 +34,7 @@ class AuthSourcesController < ApplicationController
@auth_source = AuthSource.new_subclass_instance(params[:type], params[:auth_source])
if @auth_source.save
flash[:notice] = l(:notice_successful_create)
- redirect_to :action => 'index'
+ redirect_to auth_sources_path
else
render :action => 'new'
end
@@ -48,7 +48,7 @@ class AuthSourcesController < ApplicationController
@auth_source = AuthSource.find(params[:id])
if @auth_source.update_attributes(params[:auth_source])
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'index'
+ redirect_to auth_sources_path
else
render :action => 'edit'
end
@@ -62,7 +62,7 @@ class AuthSourcesController < ApplicationController
rescue Exception => e
flash[:error] = l(:error_unable_to_connect, e.message)
end
- redirect_to :action => 'index'
+ redirect_to auth_sources_path
end
def destroy
@@ -71,6 +71,6 @@ class AuthSourcesController < ApplicationController
@auth_source.destroy
flash[:notice] = l(:notice_successful_delete)
end
- redirect_to :action => 'index'
+ redirect_to auth_sources_path
end
end
diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb
index faf88647c..790e3ef75 100644
--- a/app/controllers/boards_controller.rb
+++ b/app/controllers/boards_controller.rb
@@ -99,7 +99,7 @@ class BoardsController < ApplicationController
private
def redirect_to_settings_in_projects
- redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards'
+ redirect_to settings_project_path(@project, :tab => 'boards')
end
def find_board_if_available
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index ca9aa1a86..70b504381 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -32,12 +32,12 @@ class CommentsController < ApplicationController
flash[:notice] = l(:label_comment_added)
end
- redirect_to :controller => 'news', :action => 'show', :id => @news
+ redirect_to news_path(@news)
end
def destroy
@news.comments.find(params[:comment_id]).destroy
- redirect_to :controller => 'news', :action => 'show', :id => @news
+ redirect_to news_path(@news)
end
private
diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb
index fb03277a7..59de860cd 100644
--- a/app/controllers/custom_fields_controller.rb
+++ b/app/controllers/custom_fields_controller.rb
@@ -34,7 +34,7 @@ class CustomFieldsController < ApplicationController
if request.post? and @custom_field.save
flash[:notice] = l(:notice_successful_create)
call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field)
- redirect_to :action => 'index', :tab => @custom_field.class.name
+ redirect_to custom_fields_path(:tab => @custom_field.class.name)
else
render :action => 'new'
end
@@ -47,7 +47,7 @@ class CustomFieldsController < ApplicationController
if request.put? and @custom_field.update_attributes(params[:custom_field])
flash[:notice] = l(:notice_successful_update)
call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field)
- redirect_to :action => 'index', :tab => @custom_field.class.name
+ redirect_to custom_fields_path(:tab => @custom_field.class.name)
else
render :action => 'edit'
end
@@ -55,10 +55,10 @@ class CustomFieldsController < ApplicationController
def destroy
@custom_field.destroy
- redirect_to :action => 'index', :tab => @custom_field.class.name
+ redirect_to custom_fields_path(:tab => @custom_field.class.name)
rescue
flash[:error] = l(:error_can_not_delete_custom_field)
- redirect_to :action => 'index'
+ redirect_to custom_fields_path(:tab => @custom_field.class.name)
end
private
diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb
index cf40d1293..9a782574d 100644
--- a/app/controllers/documents_controller.rb
+++ b/app/controllers/documents_controller.rb
@@ -58,7 +58,7 @@ class DocumentsController < ApplicationController
if @document.save
render_attachment_warning_if_needed(@document)
flash[:notice] = l(:notice_successful_create)
- redirect_to :action => 'index', :project_id => @project
+ redirect_to project_documents_path(@project)
else
render :action => 'new'
end
@@ -71,7 +71,7 @@ class DocumentsController < ApplicationController
@document.safe_attributes = params[:document]
if request.put? and @document.save
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'show', :id => @document
+ redirect_to document_path(@document)
else
render :action => 'edit'
end
@@ -79,7 +79,7 @@ class DocumentsController < ApplicationController
def destroy
@document.destroy if request.delete?
- redirect_to :controller => 'documents', :action => 'index', :project_id => @project
+ redirect_to project_documents_path(@project)
end
def add_attachment
@@ -89,6 +89,6 @@ class DocumentsController < ApplicationController
if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
Mailer.attachments_added(attachments[:files]).deliver
end
- redirect_to :action => 'show', :id => @document
+ redirect_to document_path(@document)
end
end
diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb
index 6eddff738..33389e4b3 100644
--- a/app/controllers/enumerations_controller.rb
+++ b/app/controllers/enumerations_controller.rb
@@ -46,7 +46,7 @@ class EnumerationsController < ApplicationController
def create
if request.post? && @enumeration.save
flash[:notice] = l(:notice_successful_create)
- redirect_to :action => 'index'
+ redirect_to enumerations_path
else
render :action => 'new'
end
@@ -58,7 +58,7 @@ class EnumerationsController < ApplicationController
def update
if request.put? && @enumeration.update_attributes(params[:enumeration])
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'index'
+ redirect_to enumerations_path
else
render :action => 'edit'
end
@@ -68,12 +68,12 @@ class EnumerationsController < ApplicationController
if !@enumeration.in_use?
# No associated objects
@enumeration.destroy
- redirect_to :action => 'index'
+ redirect_to enumerations_path
return
elsif params[:reassign_to_id]
if reassign_to = @enumeration.class.find_by_id(params[:reassign_to_id])
@enumeration.destroy(reassign_to)
- redirect_to :action => 'index'
+ redirect_to enumerations_path
return
end
end
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 2e57d179a..e09fc5b0d 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -84,7 +84,7 @@ class GroupsController < ApplicationController
@group.destroy
respond_to do |format|
- format.html { redirect_to(groups_url) }
+ format.html { redirect_to(groups_path) }
format.api { render_api_ok }
end
end
@@ -93,7 +93,7 @@ class GroupsController < ApplicationController
@users = User.find_all_by_id(params[:user_id] || params[:user_ids])
@group.users << @users if request.post?
respond_to do |format|
- format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'users' }
+ format.html { redirect_to edit_group_path(@group, :tab => 'users') }
format.js
format.api { render_api_ok }
end
@@ -102,7 +102,7 @@ class GroupsController < ApplicationController
def remove_user
@group.users.delete(User.find(params[:user_id])) if request.delete?
respond_to do |format|
- format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'users' }
+ format.html { redirect_to edit_group_path(@group, :tab => 'users') }
format.js
format.api { render_api_ok }
end
@@ -117,7 +117,7 @@ class GroupsController < ApplicationController
@membership = Member.edit_membership(params[:membership_id], params[:membership], @group)
@membership.save if request.post?
respond_to do |format|
- format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'memberships' }
+ format.html { redirect_to edit_group_path(@group, :tab => 'memberships') }
format.js
end
end
@@ -125,7 +125,7 @@ class GroupsController < ApplicationController
def destroy_membership
Member.find(params[:membership_id]).destroy if request.post?
respond_to do |format|
- format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'memberships' }
+ format.html { redirect_to edit_group_path(@group, :tab => 'memberships') }
format.js
end
end
diff --git a/app/controllers/issue_categories_controller.rb b/app/controllers/issue_categories_controller.rb
index 89afde13d..e7faba6f7 100644
--- a/app/controllers/issue_categories_controller.rb
+++ b/app/controllers/issue_categories_controller.rb
@@ -26,14 +26,14 @@ class IssueCategoriesController < ApplicationController
def index
respond_to do |format|
- format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project }
+ format.html { redirect_to_settings_in_projects }
format.api { @categories = @project.issue_categories.all }
end
end
def show
respond_to do |format|
- format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project }
+ format.html { redirect_to_settings_in_projects }
format.api
end
end
@@ -55,7 +55,7 @@ class IssueCategoriesController < ApplicationController
respond_to do |format|
format.html do
flash[:notice] = l(:notice_successful_create)
- redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project
+ redirect_to_settings_in_projects
end
format.js
format.api { render :action => 'show', :status => :created, :location => issue_category_path(@category) }
@@ -78,7 +78,7 @@ class IssueCategoriesController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
- redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project
+ redirect_to_settings_in_projects
}
format.api { render_api_ok }
end
@@ -99,7 +99,7 @@ class IssueCategoriesController < ApplicationController
end
@category.destroy(reassign_to)
respond_to do |format|
- format.html { redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'categories' }
+ format.html { redirect_to_settings_in_projects }
format.api { render_api_ok }
end
return
@@ -107,7 +107,12 @@ class IssueCategoriesController < ApplicationController
@categories = @project.issue_categories - [@category]
end
-private
+ private
+
+ def redirect_to_settings_in_projects
+ redirect_to settings_project_path(@project, :tab => 'categories')
+ end
+
# Wrap ApplicationController's find_model_object method to set
# @category instead of just @issue_category
def find_model_object
diff --git a/app/controllers/issue_relations_controller.rb b/app/controllers/issue_relations_controller.rb
index 2f1165cad..4e4c45888 100644
--- a/app/controllers/issue_relations_controller.rb
+++ b/app/controllers/issue_relations_controller.rb
@@ -48,7 +48,7 @@ class IssueRelationsController < ApplicationController
saved = @relation.save
respond_to do |format|
- format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue }
+ format.html { redirect_to issue_path(@issue) }
format.js {
@relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
}
@@ -67,7 +67,7 @@ class IssueRelationsController < ApplicationController
@relation.destroy
respond_to do |format|
- format.html { redirect_to issue_path } # TODO : does this really work since @issue is always nil? What is it useful to?
+ format.html { redirect_to issue_path(@relation.issue_from) }
format.js
format.api { render_api_ok }
end