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