Use named routes in controllers.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10983 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
60d06d8c17
commit
8ab9215ea8
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -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 :action => 'new',
|
||||
: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_project_time_entry_path(@time_entry.project, options)
|
||||
end
|
||||
else
|
||||
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
|
||||
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 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -141,7 +141,7 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
|
||||
match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
|
||||
resources :wiki, :except => [:index, :new, :create] do
|
||||
resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do
|
||||
member do
|
||||
get 'rename'
|
||||
post 'rename'
|
||||
|
@ -317,7 +317,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post]
|
||||
match 'settings', :controller => 'settings', :action => 'index', :via => :get
|
||||
match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post]
|
||||
match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post]
|
||||
match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post], :as => 'plugin_settings'
|
||||
|
||||
match 'sys/projects', :to => 'sys#projects', :via => :get
|
||||
match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post
|
||||
|
|
|
@ -184,7 +184,7 @@ class ProjectsControllerTest < ActionController::TestCase
|
|||
assert_difference 'Project.count' do
|
||||
post :create, :project => {:name => "blog", :identifier => "blog"}, :continue => 'Create and continue'
|
||||
end
|
||||
assert_redirected_to '/projects/new?'
|
||||
assert_redirected_to '/projects/new'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class SettingsControllerTest < ActionController::TestCase
|
|||
:notified_events => %w(issue_added issue_updated news_added),
|
||||
:emails_footer => 'Test footer'
|
||||
}
|
||||
assert_redirected_to '/settings/edit'
|
||||
assert_redirected_to '/settings'
|
||||
assert_equal 'functional@test.foo', Setting.mail_from
|
||||
assert !Setting.bcc_recipients?
|
||||
assert_equal %w(issue_added issue_updated news_added), Setting.notified_events
|
||||
|
|
Loading…
Reference in New Issue