##// END OF EJS Templates
Use named routes in controllers....
Jean-Philippe Lang -
r10754:8ab9215ea8df
parent child
Show More
@@ -334,6 +334,16 class ApplicationController < ActionController::Base
334 334 url
335 335 end
336 336
337 # Returns the path to project issues or to the cross-project
338 # issue list if project is nil
339 def _issues_path(project, *args)
340 if project
341 project_issues_path(project, *args)
342 else
343 issues_path(*args)
344 end
345 end
346
337 347 def redirect_back_or_default(default)
338 348 back_url = params[:back_url].to_s
339 349 if back_url.present?
@@ -42,7 +42,7 class IssueStatusesController < ApplicationController
42 42 @issue_status = IssueStatus.new(params[:issue_status])
43 43 if request.post? && @issue_status.save
44 44 flash[:notice] = l(:notice_successful_create)
45 redirect_to :action => 'index'
45 redirect_to issue_statuses_path
46 46 else
47 47 render :action => 'new'
48 48 end
@@ -56,7 +56,7 class IssueStatusesController < ApplicationController
56 56 @issue_status = IssueStatus.find(params[:id])
57 57 if request.put? && @issue_status.update_attributes(params[:issue_status])
58 58 flash[:notice] = l(:notice_successful_update)
59 redirect_to :action => 'index'
59 redirect_to issue_statuses_path
60 60 else
61 61 render :action => 'edit'
62 62 end
@@ -64,10 +64,10 class IssueStatusesController < ApplicationController
64 64
65 65 def destroy
66 66 IssueStatus.find(params[:id]).destroy
67 redirect_to :action => 'index'
67 redirect_to issue_statuses_path
68 68 rescue
69 69 flash[:error] = l(:error_unable_delete_issue_status)
70 redirect_to :action => 'index'
70 redirect_to issue_statuses_path
71 71 end
72 72
73 73 def update_issue_done_ratio
@@ -76,6 +76,6 class IssueStatusesController < ApplicationController
76 76 else
77 77 flash[:error] = l(:error_issue_done_ratios_not_updated)
78 78 end
79 redirect_to :action => 'index'
79 redirect_to issue_statuses_path
80 80 end
81 81 end
@@ -145,8 +145,12 class IssuesController < ApplicationController
145 145 format.html {
146 146 render_attachment_warning_if_needed(@issue)
147 147 flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("##{@issue.id}", issue_path(@issue), :title => @issue.subject))
148 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?} } :
149 { :action => 'show', :id => @issue })
148 if params[:continue]
149 attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?}
150 redirect_to new_project_issue_path(@issue.project, :issue => attrs)
151 else
152 redirect_to issue_path(@issue)
153 end
150 154 }
151 155 format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) }
152 156 end
@@ -187,7 +191,7 class IssuesController < ApplicationController
187 191 flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record?
188 192
189 193 respond_to do |format|
190 format.html { redirect_back_or_default({:action => 'show', :id => @issue}) }
194 format.html { redirect_back_or_default issue_path(@issue) }
191 195 format.api { render_api_ok }
192 196 end
193 197 else
@@ -270,12 +274,12 class IssuesController < ApplicationController
270 274
271 275 if params[:follow]
272 276 if @issues.size == 1 && moved_issues.size == 1
273 redirect_to :controller => 'issues', :action => 'show', :id => moved_issues.first
277 redirect_to issue_path(moved_issues.first)
274 278 elsif moved_issues.map(&:project).uniq.size == 1
275 redirect_to :controller => 'issues', :action => 'index', :project_id => moved_issues.map(&:project).first
279 redirect_to project_issues_path(moved_issues.map(&:project).first)
276 280 end
277 281 else
278 redirect_back_or_default({:controller => 'issues', :action => 'index', :project_id => @project})
282 redirect_back_or_default _issues_path(@project)
279 283 end
280 284 end
281 285
@@ -308,7 +312,7 class IssuesController < ApplicationController
308 312 end
309 313 end
310 314 respond_to do |format|
311 format.html { redirect_back_or_default(:action => 'index', :project_id => @project) }
315 format.html { redirect_back_or_default _issues_path(@project) }
312 316 format.api { render_api_ok }
313 317 end
314 318 end
@@ -80,7 +80,7 class JournalsController < ApplicationController
80 80 @journal.destroy if @journal.details.empty? && @journal.notes.blank?
81 81 call_hook(:controller_journals_edit_post, { :journal => @journal, :params => params})
82 82 respond_to do |format|
83 format.html { redirect_to :controller => 'issues', :action => 'show', :id => @journal.journalized_id }
83 format.html { redirect_to issue_path(@journal.journalized) }
84 84 format.js { render :action => 'update' }
85 85 end
86 86 else
@@ -63,7 +63,7 class MembersController < ApplicationController
63 63 end
64 64
65 65 respond_to do |format|
66 format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project }
66 format.html { redirect_to_settings_in_projects }
67 67 format.js { @members = members }
68 68 format.api {
69 69 @member = members.first
@@ -82,7 +82,7 class MembersController < ApplicationController
82 82 end
83 83 saved = @member.save
84 84 respond_to do |format|
85 format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project }
85 format.html { redirect_to_settings_in_projects }
86 86 format.js
87 87 format.api {
88 88 if saved
@@ -99,7 +99,7 class MembersController < ApplicationController
99 99 @member.destroy
100 100 end
101 101 respond_to do |format|
102 format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project }
102 format.html { redirect_to_settings_in_projects }
103 103 format.js
104 104 format.api {
105 105 if @member.destroyed?
@@ -115,4 +115,10 class MembersController < ApplicationController
115 115 @principals = Principal.active.not_member_of(@project).like(params[:q]).all(:limit => 100)
116 116 render :layout => false
117 117 end
118
119 private
120
121 def redirect_to_settings_in_projects
122 redirect_to settings_project_path(@project, :tab => 'members')
123 end
118 124 end
@@ -59,7 +59,7 class MyController < ApplicationController
59 59 @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
60 60 set_language_if_valid @user.language
61 61 flash[:notice] = l(:notice_account_updated)
62 redirect_to :action => 'account'
62 redirect_to my_account_path
63 63 return
64 64 end
65 65 end
@@ -69,7 +69,7 class MyController < ApplicationController
69 69 def destroy
70 70 @user = User.current
71 71 unless @user.own_account_deletable?
72 redirect_to :action => 'account'
72 redirect_to my_account_path
73 73 return
74 74 end
75 75
@@ -88,7 +88,7 class MyController < ApplicationController
88 88 @user = User.current
89 89 unless @user.change_password_allowed?
90 90 flash[:error] = l(:notice_can_t_change_password)
91 redirect_to :action => 'account'
91 redirect_to my_account_path
92 92 return
93 93 end
94 94 if request.post?
@@ -96,7 +96,7 class MyController < ApplicationController
96 96 @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
97 97 if @user.save
98 98 flash[:notice] = l(:notice_account_password_updated)
99 redirect_to :action => 'account'
99 redirect_to my_account_path
100 100 end
101 101 else
102 102 flash[:error] = l(:notice_account_wrong_password)
@@ -114,7 +114,7 class MyController < ApplicationController
114 114 User.current.rss_key
115 115 flash[:notice] = l(:notice_feeds_access_key_reseted)
116 116 end
117 redirect_to :action => 'account'
117 redirect_to my_account_path
118 118 end
119 119
120 120 # Create a new API key
@@ -127,7 +127,7 class MyController < ApplicationController
127 127 User.current.api_key
128 128 flash[:notice] = l(:notice_api_access_key_reseted)
129 129 end
130 redirect_to :action => 'account'
130 redirect_to my_account_path
131 131 end
132 132
133 133 # User's page layout configuration
@@ -156,7 +156,7 class MyController < ApplicationController
156 156 layout['top'].unshift block
157 157 @user.pref[:my_page_layout] = layout
158 158 @user.pref.save
159 redirect_to :action => 'page_layout'
159 redirect_to my_page_layout_path
160 160 end
161 161
162 162 # Remove a block to user's page
@@ -169,7 +169,7 class MyController < ApplicationController
169 169 %w(top left right).each {|f| (layout[f] ||= []).delete block }
170 170 @user.pref[:my_page_layout] = layout
171 171 @user.pref.save
172 redirect_to :action => 'page_layout'
172 redirect_to my_page_layout_path
173 173 end
174 174
175 175 # Change blocks order on user's page
@@ -73,7 +73,7 class NewsController < ApplicationController
73 73 if @news.save
74 74 render_attachment_warning_if_needed(@news)
75 75 flash[:notice] = l(:notice_successful_create)
76 redirect_to :controller => 'news', :action => 'index', :project_id => @project
76 redirect_to project_news_index_path(@project)
77 77 else
78 78 render :action => 'new'
79 79 end
@@ -88,7 +88,7 class NewsController < ApplicationController
88 88 if @news.save
89 89 render_attachment_warning_if_needed(@news)
90 90 flash[:notice] = l(:notice_successful_update)
91 redirect_to :action => 'show', :id => @news
91 redirect_to news_path(@news)
92 92 else
93 93 render :action => 'edit'
94 94 end
@@ -96,7 +96,7 class NewsController < ApplicationController
96 96
97 97 def destroy
98 98 @news.destroy
99 redirect_to :action => 'index', :project_id => @project
99 redirect_to project_news_index_path(@project)
100 100 end
101 101
102 102 private
@@ -29,7 +29,7 class ProjectEnumerationsController < ApplicationController
29 29 flash[:notice] = l(:notice_successful_update)
30 30 end
31 31
32 redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
32 redirect_to settings_project_path(@project, :tab => 'activities')
33 33 end
34 34
35 35 def destroy
@@ -37,7 +37,6 class ProjectEnumerationsController < ApplicationController
37 37 time_entry_activity.destroy(time_entry_activity.parent)
38 38 end
39 39 flash[:notice] = l(:notice_successful_update)
40 redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
40 redirect_to settings_project_path(@project, :tab => 'activities')
41 41 end
42
43 42 end
@@ -90,10 +90,12 class ProjectsController < ApplicationController
90 90 respond_to do |format|
91 91 format.html {
92 92 flash[:notice] = l(:notice_successful_create)
93 redirect_to(params[:continue] ?
94 {:controller => 'projects', :action => 'new', :project => {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}} :
95 {:controller => 'projects', :action => 'settings', :id => @project}
96 )
93 if params[:continue]
94 attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}
95 redirect_to new_project_path(attrs)
96 else
97 redirect_to settings_project_path(@project)
98 end
97 99 }
98 100 format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
99 101 end
@@ -103,7 +105,6 class ProjectsController < ApplicationController
103 105 format.api { render_validation_errors(@project) }
104 106 end
105 107 end
106
107 108 end
108 109
109 110 def copy
@@ -120,13 +121,13 class ProjectsController < ApplicationController
120 121 if validate_parent_id && @project.copy(@source_project, :only => params[:only])
121 122 @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
122 123 flash[:notice] = l(:notice_successful_create)
123 redirect_to :controller => 'projects', :action => 'settings', :id => @project
124 redirect_to settings_project_path(@project)
124 125 elsif !@project.new_record?
125 126 # Project was created
126 127 # But some objects were not copied due to validation failures
127 128 # (eg. issues from disabled trackers)
128 129 # TODO: inform about that
129 redirect_to :controller => 'projects', :action => 'settings', :id => @project
130 redirect_to settings_project_path(@project)
130 131 end
131 132 end
132 133 end
@@ -182,7 +183,7 class ProjectsController < ApplicationController
182 183 respond_to do |format|
183 184 format.html {
184 185 flash[:notice] = l(:notice_successful_update)
185 redirect_to :action => 'settings', :id => @project
186 redirect_to settings_project_path(@project)
186 187 }
187 188 format.api { render_api_ok }
188 189 end
@@ -200,7 +201,7 class ProjectsController < ApplicationController
200 201 def modules
201 202 @project.enabled_module_names = params[:enabled_module_names]
202 203 flash[:notice] = l(:notice_successful_update)
203 redirect_to :action => 'settings', :id => @project, :tab => 'modules'
204 redirect_to settings_project_path(@project, :tab => 'modules')
204 205 end
205 206
206 207 def archive
@@ -209,12 +210,12 class ProjectsController < ApplicationController
209 210 flash[:error] = l(:error_can_not_archive_project)
210 211 end
211 212 end
212 redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status]))
213 redirect_to admin_projects_path(:status => params[:status])
213 214 end
214 215
215 216 def unarchive
216 217 @project.unarchive if request.post? && !@project.active?
217 redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status]))
218 redirect_to admin_projects_path(:status => params[:status])
218 219 end
219 220
220 221 def close
@@ -233,7 +234,7 class ProjectsController < ApplicationController
233 234 if api_request? || params[:confirm]
234 235 @project_to_destroy.destroy
235 236 respond_to do |format|
236 format.html { redirect_to :controller => 'admin', :action => 'projects' }
237 format.html { redirect_to admin_projects_path }
237 238 format.api { render_api_ok }
238 239 end
239 240 end
@@ -60,7 +60,7 class QueriesController < ApplicationController
60 60
61 61 if @query.save
62 62 flash[:notice] = l(:notice_successful_create)
63 redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :query_id => @query
63 redirect_to _issues_path(@project, :query_id => @query)
64 64 else
65 65 render :action => 'new', :layout => !request.xhr?
66 66 end
@@ -78,7 +78,7 class QueriesController < ApplicationController
78 78
79 79 if @query.save
80 80 flash[:notice] = l(:notice_successful_update)
81 redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :query_id => @query
81 redirect_to _issues_path(@project, :query_id => @query)
82 82 else
83 83 render :action => 'edit'
84 84 end
@@ -86,7 +86,7 class QueriesController < ApplicationController
86 86
87 87 def destroy
88 88 @query.destroy
89 redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1
89 redirect_to _issues_path(@project, :set_filter => 1)
90 90 end
91 91
92 92 private
@@ -58,7 +58,7 class RolesController < ApplicationController
58 58 @role.workflow_rules.copy(copy_from)
59 59 end
60 60 flash[:notice] = l(:notice_successful_create)
61 redirect_to :action => 'index'
61 redirect_to roles_path
62 62 else
63 63 @roles = Role.sorted.all
64 64 render :action => 'new'
@@ -71,7 +71,7 class RolesController < ApplicationController
71 71 def update
72 72 if request.put? and @role.update_attributes(params[:role])
73 73 flash[:notice] = l(:notice_successful_update)
74 redirect_to :action => 'index'
74 redirect_to roles_path
75 75 else
76 76 render :action => 'edit'
77 77 end
@@ -79,10 +79,10 class RolesController < ApplicationController
79 79
80 80 def destroy
81 81 @role.destroy
82 redirect_to :action => 'index'
82 redirect_to roles_path
83 83 rescue
84 84 flash[:error] = l(:error_can_not_remove_role)
85 redirect_to :action => 'index'
85 redirect_to roles_path
86 86 end
87 87
88 88 def permissions
@@ -94,7 +94,7 class RolesController < ApplicationController
94 94 role.save
95 95 end
96 96 flash[:notice] = l(:notice_successful_update)
97 redirect_to :action => 'index'
97 redirect_to roles_path
98 98 end
99 99 end
100 100
@@ -36,7 +36,7 class SettingsController < ApplicationController
36 36 Setting[name] = value
37 37 end
38 38 flash[:notice] = l(:notice_successful_update)
39 redirect_to :action => 'edit', :tab => params[:tab]
39 redirect_to settings_path(:tab => params[:tab])
40 40 else
41 41 @options = {}
42 42 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
55 55 if request.post?
56 56 Setting.send "plugin_#{@plugin.id}=", params[:settings]
57 57 flash[:notice] = l(:notice_successful_update)
58 redirect_to :action => 'plugin', :id => @plugin.id
58 redirect_to plugin_settings_path(@plugin.id)
59 59 else
60 60 @partial = @plugin.settings[:partial]
61 61 @settings = Setting.send "plugin_#{@plugin.id}"
@@ -128,16 +128,24 class TimelogController < ApplicationController
128 128 flash[:notice] = l(:notice_successful_create)
129 129 if params[:continue]
130 130 if params[:project_id]
131 redirect_to :action => 'new', :project_id => @time_entry.project, :issue_id => @time_entry.issue,
131 options = {
132 132 :time_entry => {:issue_id => @time_entry.issue_id, :activity_id => @time_entry.activity_id},
133 133 :back_url => params[:back_url]
134 }
135 if @time_entry.issue
136 redirect_to new_project_issue_time_entry_path(@time_entry.project, @time_entry.issue, options)
137 else
138 redirect_to new_project_time_entry_path(@time_entry.project, options)
139 end
134 140 else
135 redirect_to :action => 'new',
141 options = {
136 142 :time_entry => {:project_id => @time_entry.project_id, :issue_id => @time_entry.issue_id, :activity_id => @time_entry.activity_id},
137 143 :back_url => params[:back_url]
144 }
145 redirect_to new_time_entry_path(options)
138 146 end
139 147 else
140 redirect_back_or_default :action => 'index', :project_id => @time_entry.project
148 redirect_back_or_default project_time_entries_path(@time_entry.project)
141 149 end
142 150 }
143 151 format.api { render :action => 'show', :status => :created, :location => time_entry_url(@time_entry) }
@@ -163,7 +171,7 class TimelogController < ApplicationController
163 171 respond_to do |format|
164 172 format.html {
165 173 flash[:notice] = l(:notice_successful_update)
166 redirect_back_or_default :action => 'index', :project_id => @time_entry.project
174 redirect_back_or_default project_time_entries_path(@time_entry.project)
167 175 }
168 176 format.api { render_api_ok }
169 177 end
@@ -194,7 +202,7 class TimelogController < ApplicationController
194 202 end
195 203 end
196 204 set_flash_from_bulk_time_entry_save(@time_entries, unsaved_time_entry_ids)
197 redirect_back_or_default({:controller => 'timelog', :action => 'index', :project_id => @projects.first})
205 redirect_back_or_default project_time_entries_path(@projects.first)
198 206 end
199 207
200 208 def destroy
@@ -213,7 +221,7 class TimelogController < ApplicationController
213 221 else
214 222 flash[:error] = l(:notice_unable_delete_time_entry)
215 223 end
216 redirect_back_or_default(:action => 'index', :project_id => @projects.first)
224 redirect_back_or_default project_time_entries_path(@projects.first)
217 225 }
218 226 format.api {
219 227 if destroyed
@@ -48,7 +48,7 class TrackersController < ApplicationController
48 48 @tracker.workflow_rules.copy(copy_from)
49 49 end
50 50 flash[:notice] = l(:notice_successful_create)
51 redirect_to :action => 'index'
51 redirect_to trackers_path
52 52 return
53 53 end
54 54 new
@@ -64,7 +64,7 class TrackersController < ApplicationController
64 64 @tracker = Tracker.find(params[:id])
65 65 if @tracker.update_attributes(params[:tracker])
66 66 flash[:notice] = l(:notice_successful_update)
67 redirect_to :action => 'index'
67 redirect_to trackers_path
68 68 return
69 69 end
70 70 edit
@@ -78,7 +78,7 class TrackersController < ApplicationController
78 78 else
79 79 @tracker.destroy
80 80 end
81 redirect_to :action => 'index'
81 redirect_to trackers_path
82 82 end
83 83
84 84 def fields
@@ -92,7 +92,7 class TrackersController < ApplicationController
92 92 end
93 93 end
94 94 flash[:notice] = l(:notice_successful_update)
95 redirect_to :action => 'fields'
95 redirect_to fields_trackers_path
96 96 return
97 97 end
98 98 @trackers = Tracker.sorted.all
@@ -101,10 +101,11 class UsersController < ApplicationController
101 101 respond_to do |format|
102 102 format.html {
103 103 flash[:notice] = l(:notice_user_successful_create, :id => view_context.link_to(@user.login, user_path(@user)))
104 redirect_to(params[:continue] ?
105 {:controller => 'users', :action => 'new'} :
106 {:controller => 'users', :action => 'edit', :id => @user}
107 )
104 if params[:continue]
105 redirect_to new_user_path
106 else
107 redirect_to edit_user_path(@user)
108 end
108 109 }
109 110 format.api { render :action => 'show', :status => :created, :location => user_url(@user) }
110 111 end
@@ -171,7 +172,7 class UsersController < ApplicationController
171 172 def destroy
172 173 @user.destroy
173 174 respond_to do |format|
174 format.html { redirect_back_or_default(users_url) }
175 format.html { redirect_back_or_default(users_path) }
175 176 format.api { render_api_ok }
176 177 end
177 178 end
@@ -180,7 +181,7 class UsersController < ApplicationController
180 181 @membership = Member.edit_membership(params[:membership_id], params[:membership], @user)
181 182 @membership.save
182 183 respond_to do |format|
183 format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' }
184 format.html { redirect_to edit_user_path(@user, :tab => 'memberships') }
184 185 format.js
185 186 end
186 187 end
@@ -191,7 +192,7 class UsersController < ApplicationController
191 192 @membership.destroy
192 193 end
193 194 respond_to do |format|
194 format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' }
195 format.html { redirect_to edit_user_path(@user, :tab => 'memberships') }
195 196 format.js
196 197 end
197 198 end
@@ -96,7 +96,7 class VersionsController < ApplicationController
96 96 respond_to do |format|
97 97 format.html do
98 98 flash[:notice] = l(:notice_successful_create)
99 redirect_back_or_default :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
99 redirect_back_or_default settings_project_path(@project, :tab => 'versions')
100 100 end
101 101 format.js
102 102 format.api do
@@ -125,7 +125,7 class VersionsController < ApplicationController
125 125 respond_to do |format|
126 126 format.html {
127 127 flash[:notice] = l(:notice_successful_update)
128 redirect_back_or_default :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
128 redirect_back_or_default settings_project_path(@project, :tab => 'versions')
129 129 }
130 130 format.api { render_api_ok }
131 131 end
@@ -142,21 +142,21 class VersionsController < ApplicationController
142 142 if request.put?
143 143 @project.close_completed_versions
144 144 end
145 redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
145 redirect_to settings_project_path(@project, :tab => 'versions')
146 146 end
147 147
148 148 def destroy
149 149 if @version.fixed_issues.empty?
150 150 @version.destroy
151 151 respond_to do |format|
152 format.html { redirect_back_or_default :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project }
152 format.html { redirect_back_or_default settings_project_path(@project, :tab => 'versions') }
153 153 format.api { render_api_ok }
154 154 end
155 155 else
156 156 respond_to do |format|
157 157 format.html {
158 158 flash[:error] = l(:notice_unable_delete_version)
159 redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
159 redirect_to settings_project_path(@project, :tab => 'versions')
160 160 }
161 161 format.api { head :unprocessable_entity }
162 162 end
@@ -160,10 +160,10 class WikiController < ApplicationController
160 160 call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page})
161 161
162 162 respond_to do |format|
163 format.html { redirect_to :action => 'show', :project_id => @project, :id => @page.title }
163 format.html { redirect_to project_wiki_page_path(@project, @page.title) }
164 164 format.api {
165 165 if was_new_page
166 render :action => 'show', :status => :created, :location => url_for(:controller => 'wiki', :action => 'show', :project_id => @project, :id => @page.title)
166 render :action => 'show', :status => :created, :location => project_wiki_page_path(@project, @page.title)
167 167 else
168 168 render_api_ok
169 169 end
@@ -200,13 +200,13 class WikiController < ApplicationController
200 200 @original_title = @page.pretty_title
201 201 if request.post? && @page.update_attributes(params[:wiki_page])
202 202 flash[:notice] = l(:notice_successful_update)
203 redirect_to :action => 'show', :project_id => @project, :id => @page.title
203 redirect_to project_wiki_page_path(@project, @page.title)
204 204 end
205 205 end
206 206
207 207 def protect
208 208 @page.update_attribute :protected, params[:protected]
209 redirect_to :action => 'show', :project_id => @project, :id => @page.title
209 redirect_to project_wiki_page_path(@project, @page.title)
210 210 end
211 211
212 212 # show page history
@@ -262,7 +262,7 class WikiController < ApplicationController
262 262 end
263 263 @page.destroy
264 264 respond_to do |format|
265 format.html { redirect_to :action => 'index', :project_id => @project }
265 format.html { redirect_to project_wiki_index_path(@project) }
266 266 format.api { render_api_ok }
267 267 end
268 268 end
@@ -272,7 +272,7 class WikiController < ApplicationController
272 272
273 273 @content = @page.content_for_version(params[:version])
274 274 @content.destroy
275 redirect_to_referer_or :action => 'history', :id => @page.title, :project_id => @project
275 redirect_to_referer_or history_project_wiki_page_path(@project, @page.title)
276 276 end
277 277
278 278 # Export wiki to a single pdf or html file
@@ -30,7 +30,7 class WikisController < ApplicationController
30 30 def destroy
31 31 if request.post? && params[:confirm] && @project.wiki
32 32 @project.wiki.destroy
33 redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'wiki'
33 redirect_to settings_project_path(@project, :tab => 'wiki')
34 34 end
35 35 end
36 36 end
@@ -38,7 +38,7 class WorkflowsController < ApplicationController
38 38 }
39 39 }
40 40 if @role.save
41 redirect_to :action => 'edit', :role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only]
41 redirect_to workflows_edit_path(:role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only])
42 42 return
43 43 end
44 44 end
@@ -64,7 +64,7 class WorkflowsController < ApplicationController
64 64
65 65 if request.post? && @role && @tracker
66 66 WorkflowPermission.replace_permissions(@tracker, @role, params[:permissions] || {})
67 redirect_to :action => 'permissions', :role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only]
67 redirect_to workflows_permissions_path(:role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only])
68 68 return
69 69 end
70 70
@@ -111,7 +111,7 class WorkflowsController < ApplicationController
111 111 else
112 112 WorkflowRule.copy(@source_tracker, @source_role, @target_trackers, @target_roles)
113 113 flash[:notice] = l(:notice_successful_update)
114 redirect_to :action => 'copy', :source_tracker_id => @source_tracker, :source_role_id => @source_role
114 redirect_to workflows_copy_path(:source_tracker_id => @source_tracker, :source_role_id => @source_role)
115 115 end
116 116 end
117 117 end
@@ -141,7 +141,7 RedmineApp::Application.routes.draw do
141 141 end
142 142
143 143 match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
144 resources :wiki, :except => [:index, :new, :create] do
144 resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do
145 145 member do
146 146 get 'rename'
147 147 post 'rename'
@@ -317,7 +317,7 RedmineApp::Application.routes.draw do
317 317 match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post]
318 318 match 'settings', :controller => 'settings', :action => 'index', :via => :get
319 319 match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post]
320 match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post]
320 match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post], :as => 'plugin_settings'
321 321
322 322 match 'sys/projects', :to => 'sys#projects', :via => :get
323 323 match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post
@@ -184,7 +184,7 class ProjectsControllerTest < ActionController::TestCase
184 184 assert_difference 'Project.count' do
185 185 post :create, :project => {:name => "blog", :identifier => "blog"}, :continue => 'Create and continue'
186 186 end
187 assert_redirected_to '/projects/new?'
187 assert_redirected_to '/projects/new'
188 188 end
189 189 end
190 190
@@ -72,7 +72,7 class SettingsControllerTest < ActionController::TestCase
72 72 :notified_events => %w(issue_added issue_updated news_added),
73 73 :emails_footer => 'Test footer'
74 74 }
75 assert_redirected_to '/settings/edit'
75 assert_redirected_to '/settings'
76 76 assert_equal 'functional@test.foo', Setting.mail_from
77 77 assert !Setting.bcc_recipients?
78 78 assert_equal %w(issue_added issue_updated news_added), Setting.notified_events
General Comments 0
You need to be logged in to leave comments. Login now