summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-11 19:39:47 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-11 19:39:47 +0000
commit8ab9215ea8df2216ccfacf272804811b05ab82c8 (patch)
treeac9ab871a1f9fc1a190cd6505ee08e8efacf8863 /app
parent60d06d8c17290f536cf76ffd4a75bdafe540aa9a (diff)
downloadredmine-8ab9215ea8df2216ccfacf272804811b05ab82c8.tar.gz
redmine-8ab9215ea8df2216ccfacf272804811b05ab82c8.zip
Use named routes in controllers.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10983 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application_controller.rb10
-rw-r--r--app/controllers/issue_statuses_controller.rb10
-rw-r--r--app/controllers/issues_controller.rb18
-rw-r--r--app/controllers/journals_controller.rb2
-rw-r--r--app/controllers/members_controller.rb12
-rw-r--r--app/controllers/my_controller.rb16
-rw-r--r--app/controllers/news_controller.rb6
-rw-r--r--app/controllers/project_enumerations_controller.rb5
-rw-r--r--app/controllers/projects_controller.rb25
-rw-r--r--app/controllers/queries_controller.rb6
-rw-r--r--app/controllers/roles_controller.rb10
-rw-r--r--app/controllers/settings_controller.rb4
-rw-r--r--app/controllers/timelog_controller.rb20
-rw-r--r--app/controllers/trackers_controller.rb8
-rw-r--r--app/controllers/users_controller.rb15
-rw-r--r--app/controllers/versions_controller.rb10
-rw-r--r--app/controllers/wiki_controller.rb12
-rw-r--r--app/controllers/wikis_controller.rb2
-rw-r--r--app/controllers/workflows_controller.rb6
19 files changed, 113 insertions, 84 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index a4c804fd8..2b5e2f2c2 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -334,6 +334,16 @@ class ApplicationController < ActionController::Base
url
end
+ # Returns the path to project issues or to the cross-project
+ # issue list if project is nil
+ def _issues_path(project, *args)
+ if project
+ project_issues_path(project, *args)
+ else
+ issues_path(*args)
+ end
+ end
+
def redirect_back_or_default(default)
back_url = params[:back_url].to_s
if back_url.present?
diff --git a/app/controllers/issue_statuses_controller.rb b/app/controllers/issue_statuses_controller.rb
index 13943ddf8..ddaf9304d 100644
--- a/app/controllers/issue_statuses_controller.rb
+++ b/app/controllers/issue_statuses_controller.rb
@@ -42,7 +42,7 @@ class IssueStatusesController < ApplicationController
@issue_status = IssueStatus.new(params[:issue_status])
if request.post? && @issue_status.save
flash[:notice] = l(:notice_successful_create)
- redirect_to :action => 'index'
+ redirect_to issue_statuses_path
else
render :action => 'new'
end
@@ -56,7 +56,7 @@ class IssueStatusesController < ApplicationController
@issue_status = IssueStatus.find(params[:id])
if request.put? && @issue_status.update_attributes(params[:issue_status])
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'index'
+ redirect_to issue_statuses_path
else
render :action => 'edit'
end
@@ -64,10 +64,10 @@ class IssueStatusesController < ApplicationController
def destroy
IssueStatus.find(params[:id]).destroy
- redirect_to :action => 'index'
+ redirect_to issue_statuses_path
rescue
flash[:error] = l(:error_unable_delete_issue_status)
- redirect_to :action => 'index'
+ redirect_to issue_statuses_path
end
def update_issue_done_ratio
@@ -76,6 +76,6 @@ class IssueStatusesController < ApplicationController
else
flash[:error] = l(:error_issue_done_ratios_not_updated)
end
- redirect_to :action => 'index'
+ redirect_to issue_statuses_path
end
end
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 455d2e3d5..a48ded5ee 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -145,8 +145,12 @@ class IssuesController < ApplicationController
format.html {
render_attachment_warning_if_needed(@issue)
flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("##{@issue.id}", issue_path(@issue), :title => @issue.subject))
- redirect_to(params[:continue] ? { :action => 'new', :project_id => @issue.project, :issue => {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} } :
- { :action => 'show', :id => @issue })
+ if params[:continue]
+ attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?}
+ redirect_to new_project_issue_path(@issue.project, :issue => attrs)
+ else
+ redirect_to issue_path(@issue)
+ end
}
format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) }
end
@@ -187,7 +191,7 @@ class IssuesController < ApplicationController
flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record?
respond_to do |format|
- format.html { redirect_back_or_default({:action => 'show', :id => @issue}) }
+ format.html { redirect_back_or_default issue_path(@issue) }
format.api { render_api_ok }
end
else
@@ -270,12 +274,12 @@ class IssuesController < ApplicationController
if params[:follow]
if @issues.size == 1 && moved_issues.size == 1
- redirect_to :controller => 'issues', :action => 'show', :id => moved_issues.first
+ redirect_to issue_path(moved_issues.first)
elsif moved_issues.map(&:project).uniq.size == 1
- redirect_to :controller => 'issues', :action => 'index', :project_id => moved_issues.map(&:project).first
+ redirect_to project_issues_path(moved_issues.map(&:project).first)
end
else
- redirect_back_or_default({:controller => 'issues', :action => 'index', :project_id => @project})
+ redirect_back_or_default _issues_path(@project)
end
end
@@ -308,7 +312,7 @@ class IssuesController < ApplicationController
end
end
respond_to do |format|
- format.html { redirect_back_or_default(:action => 'index', :project_id => @project) }
+ format.html { redirect_back_or_default _issues_path(@project) }
format.api { render_api_ok }
end
end
diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb
index 5b9624ca5..64614b9be 100644
--- a/app/controllers/journals_controller.rb
+++ b/app/controllers/journals_controller.rb
@@ -80,7 +80,7 @@ class JournalsController < ApplicationController
@journal.destroy if @journal.details.empty? && @journal.notes.blank?
call_hook(:controller_journals_edit_post, { :journal => @journal, :params => params})
respond_to do |format|
- format.html { redirect_to :controller => 'issues', :action => 'show', :id => @journal.journalized_id }
+ format.html { redirect_to issue_path(@journal.journalized) }
format.js { render :action => 'update' }
end
else
diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb
index 520302c8c..c1f737dc9 100644
--- a/app/controllers/members_controller.rb
+++ b/app/controllers/members_controller.rb
@@ -63,7 +63,7 @@ class MembersController < ApplicationController
end
respond_to do |format|
- format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project }
+ format.html { redirect_to_settings_in_projects }
format.js { @members = members }
format.api {
@member = members.first
@@ -82,7 +82,7 @@ class MembersController < ApplicationController
end
saved = @member.save
respond_to do |format|
- format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project }
+ format.html { redirect_to_settings_in_projects }
format.js
format.api {
if saved
@@ -99,7 +99,7 @@ class MembersController < ApplicationController
@member.destroy
end
respond_to do |format|
- format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project }
+ format.html { redirect_to_settings_in_projects }
format.js
format.api {
if @member.destroyed?
@@ -115,4 +115,10 @@ class MembersController < ApplicationController
@principals = Principal.active.not_member_of(@project).like(params[:q]).all(:limit => 100)
render :layout => false
end
+
+ private
+
+ def redirect_to_settings_in_projects
+ redirect_to settings_project_path(@project, :tab => 'members')
+ end
end
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb
index b2c2a9dc7..9ee82c054 100644
--- a/app/controllers/my_controller.rb
+++ b/app/controllers/my_controller.rb
@@ -59,7 +59,7 @@ class MyController < ApplicationController
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
set_language_if_valid @user.language
flash[:notice] = l(:notice_account_updated)
- redirect_to :action => 'account'
+ redirect_to my_account_path
return
end
end
@@ -69,7 +69,7 @@ class MyController < ApplicationController
def destroy
@user = User.current
unless @user.own_account_deletable?
- redirect_to :action => 'account'
+ redirect_to my_account_path
return
end
@@ -88,7 +88,7 @@ class MyController < ApplicationController
@user = User.current
unless @user.change_password_allowed?
flash[:error] = l(:notice_can_t_change_password)
- redirect_to :action => 'account'
+ redirect_to my_account_path
return
end
if request.post?
@@ -96,7 +96,7 @@ class MyController < ApplicationController
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
if @user.save
flash[:notice] = l(:notice_account_password_updated)
- redirect_to :action => 'account'
+ redirect_to my_account_path
end
else
flash[:error] = l(:notice_account_wrong_password)
@@ -114,7 +114,7 @@ class MyController < ApplicationController
User.current.rss_key
flash[:notice] = l(:notice_feeds_access_key_reseted)
end
- redirect_to :action => 'account'
+ redirect_to my_account_path
end
# Create a new API key
@@ -127,7 +127,7 @@ class MyController < ApplicationController
User.current.api_key
flash[:notice] = l(:notice_api_access_key_reseted)
end
- redirect_to :action => 'account'
+ redirect_to my_account_path
end
# User's page layout configuration
@@ -156,7 +156,7 @@ class MyController < ApplicationController
layout['top'].unshift block
@user.pref[:my_page_layout] = layout
@user.pref.save
- redirect_to :action => 'page_layout'
+ redirect_to my_page_layout_path
end
# Remove a block to user's page
@@ -169,7 +169,7 @@ class MyController < ApplicationController
%w(top left right).each {|f| (layout[f] ||= []).delete block }
@user.pref[:my_page_layout] = layout
@user.pref.save
- redirect_to :action => 'page_layout'
+ redirect_to my_page_layout_path
end
# Change blocks order on user's page
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index c4e83fa72..160328ebc 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -73,7 +73,7 @@ class NewsController < ApplicationController
if @news.save
render_attachment_warning_if_needed(@news)
flash[:notice] = l(:notice_successful_create)
- redirect_to :controller => 'news', :action => 'index', :project_id => @project
+ redirect_to project_news_index_path(@project)
else
render :action => 'new'
end
@@ -88,7 +88,7 @@ class NewsController < ApplicationController
if @news.save
render_attachment_warning_if_needed(@news)
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'show', :id => @news
+ redirect_to news_path(@news)
else
render :action => 'edit'
end
@@ -96,7 +96,7 @@ class NewsController < ApplicationController
def destroy
@news.destroy
- redirect_to :action => 'index', :project_id => @project
+ redirect_to project_news_index_path(@project)
end
private
diff --git a/app/controllers/project_enumerations_controller.rb b/app/controllers/project_enumerations_controller.rb
index 2254caaee..11273b8db 100644
--- a/app/controllers/project_enumerations_controller.rb
+++ b/app/controllers/project_enumerations_controller.rb
@@ -29,7 +29,7 @@ class ProjectEnumerationsController < ApplicationController
flash[:notice] = l(:notice_successful_update)
end
- redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
+ redirect_to settings_project_path(@project, :tab => 'activities')
end
def destroy
@@ -37,7 +37,6 @@ class ProjectEnumerationsController < ApplicationController
time_entry_activity.destroy(time_entry_activity.parent)
end
flash[:notice] = l(:notice_successful_update)
- redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
+ redirect_to settings_project_path(@project, :tab => 'activities')
end
-
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 56b62263c..d9edffa41 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -90,10 +90,12 @@ class ProjectsController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_create)
- redirect_to(params[:continue] ?
- {:controller => 'projects', :action => 'new', :project => {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}} :
- {:controller => 'projects', :action => 'settings', :id => @project}
- )
+ if params[:continue]
+ attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}
+ redirect_to new_project_path(attrs)
+ else
+ redirect_to settings_project_path(@project)
+ end
}
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
end
@@ -103,7 +105,6 @@ class ProjectsController < ApplicationController
format.api { render_validation_errors(@project) }
end
end
-
end
def copy
@@ -120,13 +121,13 @@ class ProjectsController < ApplicationController
if validate_parent_id && @project.copy(@source_project, :only => params[:only])
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
flash[:notice] = l(:notice_successful_create)
- redirect_to :controller => 'projects', :action => 'settings', :id => @project
+ redirect_to settings_project_path(@project)
elsif !@project.new_record?
# Project was created
# But some objects were not copied due to validation failures
# (eg. issues from disabled trackers)
# TODO: inform about that
- redirect_to :controller => 'projects', :action => 'settings', :id => @project
+ redirect_to settings_project_path(@project)
end
end
end
@@ -182,7 +183,7 @@ class ProjectsController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'settings', :id => @project
+ redirect_to settings_project_path(@project)
}
format.api { render_api_ok }
end
@@ -200,7 +201,7 @@ class ProjectsController < ApplicationController
def modules
@project.enabled_module_names = params[:enabled_module_names]
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'settings', :id => @project, :tab => 'modules'
+ redirect_to settings_project_path(@project, :tab => 'modules')
end
def archive
@@ -209,12 +210,12 @@ class ProjectsController < ApplicationController
flash[:error] = l(:error_can_not_archive_project)
end
end
- redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status]))
+ redirect_to admin_projects_path(:status => params[:status])
end
def unarchive
@project.unarchive if request.post? && !@project.active?
- redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status]))
+ redirect_to admin_projects_path(:status => params[:status])
end
def close
@@ -233,7 +234,7 @@ class ProjectsController < ApplicationController
if api_request? || params[:confirm]
@project_to_destroy.destroy
respond_to do |format|
- format.html { redirect_to :controller => 'admin', :action => 'projects' }
+ format.html { redirect_to admin_projects_path }
format.api { render_api_ok }
end
end
diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb
index 16bc9f963..448b4e56b 100644
--- a/app/controllers/queries_controller.rb
+++ b/app/controllers/queries_controller.rb
@@ -60,7 +60,7 @@ class QueriesController < ApplicationController
if @query.save
flash[:notice] = l(:notice_successful_create)
- redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :query_id => @query
+ redirect_to _issues_path(@project, :query_id => @query)
else
render :action => 'new', :layout => !request.xhr?
end
@@ -78,7 +78,7 @@ class QueriesController < ApplicationController
if @query.save
flash[:notice] = l(:notice_successful_update)
- redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :query_id => @query
+ redirect_to _issues_path(@project, :query_id => @query)
else
render :action => 'edit'
end
@@ -86,7 +86,7 @@ class QueriesController < ApplicationController
def destroy
@query.destroy
- redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1
+ redirect_to _issues_path(@project, :set_filter => 1)
end
private
diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb
index 72c9c70bf..292304260 100644
--- a/app/controllers/roles_controller.rb
+++ b/app/controllers/roles_controller.rb
@@ -58,7 +58,7 @@ class RolesController < ApplicationController
@role.workflow_rules.copy(copy_from)
end
flash[:notice] = l(:notice_successful_create)
- redirect_to :action => 'index'
+ redirect_to roles_path
else
@roles = Role.sorted.all
render :action => 'new'
@@ -71,7 +71,7 @@ class RolesController < ApplicationController
def update
if request.put? and @role.update_attributes(params[:role])
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'index'
+ redirect_to roles_path
else
render :action => 'edit'
end
@@ -79,10 +79,10 @@ class RolesController < ApplicationController
def destroy
@role.destroy
- redirect_to :action => 'index'
+ redirect_to roles_path
rescue
flash[:error] = l(:error_can_not_remove_role)
- redirect_to :action => 'index'
+ redirect_to roles_path
end
def permissions
@@ -94,7 +94,7 @@ class RolesController < ApplicationController
role.save
end
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'index'
+ redirect_to roles_path
end
end
diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb
index b27582671..e3a2c6d26 100644
--- a/app/controllers/settings_controller.rb
+++ b/app/controllers/settings_controller.rb
@@ -36,7 +36,7 @@ class SettingsController < ApplicationController
Setting[name] = value
end
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'edit', :tab => params[:tab]
+ redirect_to settings_path(:tab => params[:tab])
else
@options = {}
user_format = User::USER_FORMATS.collect{|key, value| [key, value[:setting_order]]}.sort{|a, b| a[1] <=> b[1]}
@@ -55,7 +55,7 @@ class SettingsController < ApplicationController
if request.post?
Setting.send "plugin_#{@plugin.id}=", params[:settings]
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'plugin', :id => @plugin.id
+ redirect_to plugin_settings_path(@plugin.id)
else
@partial = @plugin.settings[:partial]
@settings = Setting.send "plugin_#{@plugin.id}"
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb
index 61d72e3f3..eb9f7ead9 100644
--- a/app/controllers/timelog_controller.rb
+++ b/app/controllers/timelog_controller.rb
@@ -128,16 +128,24 @@ class TimelogController < ApplicationController
flash[:notice] = l(:notice_successful_create)
if params[:continue]
if params[:project_id]
- redirect_to :action => 'new', :project_id => @time_entry.project, :issue_id => @time_entry.issue,
+ options = {
:time_entry => {:issue_id => @time_entry.issue_id, :activity_id => @time_entry.activity_id},
:back_url => params[:back_url]
+ }
+ if @time_entry.issue
+ redirect_to new_project_issue_time_entry_path(@time_entry.project, @time_entry.issue, options)
+ else
+ redirect_to new_project_time_entry_path(@time_entry.project, options)
+ end
else
- redirect_to :action => 'new',
+ options = {
:time_entry => {:project_id => @time_entry.project_id, :issue_id => @time_entry.issue_id, :activity_id => @time_entry.activity_id},
:back_url => params[:back_url]
+ }
+ redirect_to new_time_entry_path(options)
end
else
- redirect_back_or_default :action => 'index', :project_id => @time_entry.project
+ redirect_back_or_default project_time_entries_path(@time_entry.project)
end
}
format.api { render :action => 'show', :status => :created, :location => time_entry_url(@time_entry) }
@@ -163,7 +171,7 @@ class TimelogController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
- redirect_back_or_default :action => 'index', :project_id => @time_entry.project
+ redirect_back_or_default project_time_entries_path(@time_entry.project)
}
format.api { render_api_ok }
end
@@ -194,7 +202,7 @@ class TimelogController < ApplicationController
end
end
set_flash_from_bulk_time_entry_save(@time_entries, unsaved_time_entry_ids)
- redirect_back_or_default({:controller => 'timelog', :action => 'index', :project_id => @projects.first})
+ redirect_back_or_default project_time_entries_path(@projects.first)
end
def destroy
@@ -213,7 +221,7 @@ class TimelogController < ApplicationController
else
flash[:error] = l(:notice_unable_delete_time_entry)
end
- redirect_back_or_default(:action => 'index', :project_id => @projects.first)
+ redirect_back_or_default project_time_entries_path(@projects.first)
}
format.api {
if destroyed
diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb
index 938e6e2bc..602ea5288 100644
--- a/app/controllers/trackers_controller.rb
+++ b/app/controllers/trackers_controller.rb
@@ -48,7 +48,7 @@ class TrackersController < ApplicationController
@tracker.workflow_rules.copy(copy_from)
end
flash[:notice] = l(:notice_successful_create)
- redirect_to :action => 'index'
+ redirect_to trackers_path
return
end
new
@@ -64,7 +64,7 @@ class TrackersController < ApplicationController
@tracker = Tracker.find(params[:id])
if @tracker.update_attributes(params[:tracker])
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'index'
+ redirect_to trackers_path
return
end
edit
@@ -78,7 +78,7 @@ class TrackersController < ApplicationController
else
@tracker.destroy
end
- redirect_to :action => 'index'
+ redirect_to trackers_path
end
def fields
@@ -92,7 +92,7 @@ class TrackersController < ApplicationController
end
end
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'fields'
+ redirect_to fields_trackers_path
return
end
@trackers = Tracker.sorted.all
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index e6702a971..96c46fa36 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -101,10 +101,11 @@ class UsersController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_user_successful_create, :id => view_context.link_to(@user.login, user_path(@user)))
- redirect_to(params[:continue] ?
- {:controller => 'users', :action => 'new'} :
- {:controller => 'users', :action => 'edit', :id => @user}
- )
+ if params[:continue]
+ redirect_to new_user_path
+ else
+ redirect_to edit_user_path(@user)
+ end
}
format.api { render :action => 'show', :status => :created, :location => user_url(@user) }
end
@@ -171,7 +172,7 @@ class UsersController < ApplicationController
def destroy
@user.destroy
respond_to do |format|
- format.html { redirect_back_or_default(users_url) }
+ format.html { redirect_back_or_default(users_path) }
format.api { render_api_ok }
end
end
@@ -180,7 +181,7 @@ class UsersController < ApplicationController
@membership = Member.edit_membership(params[:membership_id], params[:membership], @user)
@membership.save
respond_to do |format|
- format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' }
+ format.html { redirect_to edit_user_path(@user, :tab => 'memberships') }
format.js
end
end
@@ -191,7 +192,7 @@ class UsersController < ApplicationController
@membership.destroy
end
respond_to do |format|
- format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' }
+ format.html { redirect_to edit_user_path(@user, :tab => 'memberships') }
format.js
end
end
diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb
index 9777c0537..97f02e76d 100644
--- a/app/controllers/versions_controller.rb
+++ b/app/controllers/versions_controller.rb
@@ -96,7 +96,7 @@ class VersionsController < ApplicationController
respond_to do |format|
format.html do
flash[:notice] = l(:notice_successful_create)
- redirect_back_or_default :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
+ redirect_back_or_default settings_project_path(@project, :tab => 'versions')
end
format.js
format.api do
@@ -125,7 +125,7 @@ class VersionsController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
- redirect_back_or_default :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
+ redirect_back_or_default settings_project_path(@project, :tab => 'versions')
}
format.api { render_api_ok }
end
@@ -142,21 +142,21 @@ class VersionsController < ApplicationController
if request.put?
@project.close_completed_versions
end
- redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
+ redirect_to settings_project_path(@project, :tab => 'versions')
end
def destroy
if @version.fixed_issues.empty?
@version.destroy
respond_to do |format|
- format.html { redirect_back_or_default :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project }
+ format.html { redirect_back_or_default settings_project_path(@project, :tab => 'versions') }
format.api { render_api_ok }
end
else
respond_to do |format|
format.html {
flash[:error] = l(:notice_unable_delete_version)
- redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
+ redirect_to settings_project_path(@project, :tab => 'versions')
}
format.api { head :unprocessable_entity }
end
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 115f61157..6d3b44636 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -160,10 +160,10 @@ class WikiController < ApplicationController
call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page})
respond_to do |format|
- format.html { redirect_to :action => 'show', :project_id => @project, :id => @page.title }
+ format.html { redirect_to project_wiki_page_path(@project, @page.title) }
format.api {
if was_new_page
- render :action => 'show', :status => :created, :location => url_for(:controller => 'wiki', :action => 'show', :project_id => @project, :id => @page.title)
+ render :action => 'show', :status => :created, :location => project_wiki_page_path(@project, @page.title)
else
render_api_ok
end
@@ -200,13 +200,13 @@ class WikiController < ApplicationController
@original_title = @page.pretty_title
if request.post? && @page.update_attributes(params[:wiki_page])
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'show', :project_id => @project, :id => @page.title
+ redirect_to project_wiki_page_path(@project, @page.title)
end
end
def protect
@page.update_attribute :protected, params[:protected]
- redirect_to :action => 'show', :project_id => @project, :id => @page.title
+ redirect_to project_wiki_page_path(@project, @page.title)
end
# show page history
@@ -262,7 +262,7 @@ class WikiController < ApplicationController
end
@page.destroy
respond_to do |format|
- format.html { redirect_to :action => 'index', :project_id => @project }
+ format.html { redirect_to project_wiki_index_path(@project) }
format.api { render_api_ok }
end
end
@@ -272,7 +272,7 @@ class WikiController < ApplicationController
@content = @page.content_for_version(params[:version])
@content.destroy
- redirect_to_referer_or :action => 'history', :id => @page.title, :project_id => @project
+ redirect_to_referer_or history_project_wiki_page_path(@project, @page.title)
end
# Export wiki to a single pdf or html file
diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb
index 5f40bb934..05ef52f5e 100644
--- a/app/controllers/wikis_controller.rb
+++ b/app/controllers/wikis_controller.rb
@@ -30,7 +30,7 @@ class WikisController < ApplicationController
def destroy
if request.post? && params[:confirm] && @project.wiki
@project.wiki.destroy
- redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'wiki'
+ redirect_to settings_project_path(@project, :tab => 'wiki')
end
end
end
diff --git a/app/controllers/workflows_controller.rb b/app/controllers/workflows_controller.rb
index 793635667..16fe75d16 100644
--- a/app/controllers/workflows_controller.rb
+++ b/app/controllers/workflows_controller.rb
@@ -38,7 +38,7 @@ class WorkflowsController < ApplicationController
}
}
if @role.save
- redirect_to :action => 'edit', :role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only]
+ redirect_to workflows_edit_path(:role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only])
return
end
end
@@ -64,7 +64,7 @@ class WorkflowsController < ApplicationController
if request.post? && @role && @tracker
WorkflowPermission.replace_permissions(@tracker, @role, params[:permissions] || {})
- redirect_to :action => 'permissions', :role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only]
+ redirect_to workflows_permissions_path(:role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only])
return
end
@@ -111,7 +111,7 @@ class WorkflowsController < ApplicationController
else
WorkflowRule.copy(@source_tracker, @source_role, @target_trackers, @target_roles)
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'copy', :source_tracker_id => @source_tracker, :source_role_id => @source_role
+ redirect_to workflows_copy_path(:source_tracker_id => @source_tracker, :source_role_id => @source_role)
end
end
end