@@ -198,6 +198,31 class IssuesController < ApplicationController | |||
|
198 | 198 | @issue.safe_attributes = attrs |
|
199 | 199 | end |
|
200 | 200 | |
|
201 | respond_to do |format| | |
|
202 | format.html { } | |
|
203 | format.xml { } | |
|
204 | end | |
|
205 | end | |
|
206 | ||
|
207 | #-- | |
|
208 | # Start converting to the Rails REST controllers | |
|
209 | #++ | |
|
210 | def update | |
|
211 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current) | |
|
212 | @priorities = IssuePriority.all | |
|
213 | @edit_allowed = User.current.allowed_to?(:edit_issues, @project) | |
|
214 | @time_entry = TimeEntry.new | |
|
215 | ||
|
216 | @notes = params[:notes] | |
|
217 | journal = @issue.init_journal(User.current, @notes) | |
|
218 | # User can change issue attributes only if he has :edit permission or if a workflow transition is allowed | |
|
219 | if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue] | |
|
220 | attrs = params[:issue].dup | |
|
221 | attrs.delete_if {|k,v| !UPDATABLE_ATTRS_ON_TRANSITION.include?(k) } unless @edit_allowed | |
|
222 | attrs.delete(:status_id) unless @allowed_statuses.detect {|s| s.id.to_s == attrs[:status_id].to_s} | |
|
223 | @issue.safe_attributes = attrs | |
|
224 | end | |
|
225 | ||
|
201 | 226 | if request.get? |
|
202 | 227 | # nop |
|
203 | 228 | else |
@@ -237,13 +262,6 class IssuesController < ApplicationController | |||
|
237 | 262 | attachments.each(&:destroy) |
|
238 | 263 | end |
|
239 | 264 | |
|
240 | #-- | |
|
241 | # Start converting to the Rails REST controllers | |
|
242 | #++ | |
|
243 | def update | |
|
244 | edit | |
|
245 | end | |
|
246 | ||
|
247 | 265 | def reply |
|
248 | 266 | journal = Journal.find(params[:journal_id]) if params[:journal_id] |
|
249 | 267 | if journal |
@@ -126,7 +126,8 ActionController::Routing::Routes.draw do |map| | |||
|
126 | 126 | issues_actions.connect 'issues.:format', :action => 'new', :format => /xml/ |
|
127 | 127 | end |
|
128 | 128 | issues_routes.with_options :conditions => {:method => :put} do |issues_actions| |
|
129 |
issues_actions.connect 'issues/:id |
|
|
129 | issues_actions.connect 'issues/:id/edit', :action => 'update', :id => /\d+/ | |
|
130 | issues_actions.connect 'issues/:id.:format', :action => 'update', :id => /\d+/, :format => /xml/ | |
|
130 | 131 | end |
|
131 | 132 | issues_routes.with_options :conditions => {:method => :delete} do |issues_actions| |
|
132 | 133 | issues_actions.connect 'issues/:id.:format', :action => 'destroy', :id => /\d+/, :format => /xml/ |
@@ -114,7 +114,7 class IssuesApiTest < ActionController::IntegrationTest | |||
|
114 | 114 | def test_update_routing |
|
115 | 115 | assert_routing( |
|
116 | 116 | {:method => :put, :path => '/issues/1.xml'}, |
|
117 |
:controller => 'issues', :action => ' |
|
|
117 | :controller => 'issues', :action => 'update', :id => '1', :format => 'xml' | |
|
118 | 118 | ) |
|
119 | 119 | end |
|
120 | 120 |
@@ -69,7 +69,7 class IssuesTest < ActionController::IntegrationTest | |||
|
69 | 69 | log_user('jsmith', 'jsmith') |
|
70 | 70 | set_tmp_attachments_directory |
|
71 | 71 | |
|
72 |
p |
|
|
72 | put 'issues/1/edit', | |
|
73 | 73 | :notes => 'Some notes', |
|
74 | 74 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}} |
|
75 | 75 | assert_redirected_to "issues/1" |
General Comments 0
You need to be logged in to leave comments.
Login now