##// END OF EJS Templates
Fixed: no error message when creating a category from the issue form fails (#1477)....
Jean-Philippe Lang -
r3004:97c5362cfece
parent child
Show More
@@ -1,350 +1,359
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2009 Jean-Philippe Lang
2 # Copyright (C) 2006-2009 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 class ProjectsController < ApplicationController
18 class ProjectsController < ApplicationController
19 menu_item :overview
19 menu_item :overview
20 menu_item :activity, :only => :activity
20 menu_item :activity, :only => :activity
21 menu_item :roadmap, :only => :roadmap
21 menu_item :roadmap, :only => :roadmap
22 menu_item :files, :only => [:list_files, :add_file]
22 menu_item :files, :only => [:list_files, :add_file]
23 menu_item :settings, :only => :settings
23 menu_item :settings, :only => :settings
24 menu_item :issues, :only => [:changelog]
24 menu_item :issues, :only => [:changelog]
25
25
26 before_filter :find_project, :except => [ :index, :list, :add, :copy, :activity ]
26 before_filter :find_project, :except => [ :index, :list, :add, :copy, :activity ]
27 before_filter :find_optional_project, :only => :activity
27 before_filter :find_optional_project, :only => :activity
28 before_filter :authorize, :except => [ :index, :list, :add, :copy, :archive, :unarchive, :destroy, :activity ]
28 before_filter :authorize, :except => [ :index, :list, :add, :copy, :archive, :unarchive, :destroy, :activity ]
29 before_filter :authorize_global, :only => :add
29 before_filter :authorize_global, :only => :add
30 before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ]
30 before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ]
31 accept_key_auth :activity
31 accept_key_auth :activity
32
32
33 after_filter :only => [:add, :edit, :archive, :unarchive, :destroy] do |controller|
33 after_filter :only => [:add, :edit, :archive, :unarchive, :destroy] do |controller|
34 if controller.request.post?
34 if controller.request.post?
35 controller.send :expire_action, :controller => 'welcome', :action => 'robots.txt'
35 controller.send :expire_action, :controller => 'welcome', :action => 'robots.txt'
36 end
36 end
37 end
37 end
38
38
39 helper :sort
39 helper :sort
40 include SortHelper
40 include SortHelper
41 helper :custom_fields
41 helper :custom_fields
42 include CustomFieldsHelper
42 include CustomFieldsHelper
43 helper :issues
43 helper :issues
44 helper IssuesHelper
44 helper IssuesHelper
45 helper :queries
45 helper :queries
46 include QueriesHelper
46 include QueriesHelper
47 helper :repositories
47 helper :repositories
48 include RepositoriesHelper
48 include RepositoriesHelper
49 include ProjectsHelper
49 include ProjectsHelper
50
50
51 # Lists visible projects
51 # Lists visible projects
52 def index
52 def index
53 respond_to do |format|
53 respond_to do |format|
54 format.html {
54 format.html {
55 @projects = Project.visible.find(:all, :order => 'lft')
55 @projects = Project.visible.find(:all, :order => 'lft')
56 }
56 }
57 format.atom {
57 format.atom {
58 projects = Project.visible.find(:all, :order => 'created_on DESC',
58 projects = Project.visible.find(:all, :order => 'created_on DESC',
59 :limit => Setting.feeds_limit.to_i)
59 :limit => Setting.feeds_limit.to_i)
60 render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
60 render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
61 }
61 }
62 end
62 end
63 end
63 end
64
64
65 # Add a new project
65 # Add a new project
66 def add
66 def add
67 @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
67 @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
68 @trackers = Tracker.all
68 @trackers = Tracker.all
69 @project = Project.new(params[:project])
69 @project = Project.new(params[:project])
70 if request.get?
70 if request.get?
71 @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
71 @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
72 @project.trackers = Tracker.all
72 @project.trackers = Tracker.all
73 @project.is_public = Setting.default_projects_public?
73 @project.is_public = Setting.default_projects_public?
74 @project.enabled_module_names = Setting.default_projects_modules
74 @project.enabled_module_names = Setting.default_projects_modules
75 else
75 else
76 @project.enabled_module_names = params[:enabled_modules]
76 @project.enabled_module_names = params[:enabled_modules]
77 if @project.save
77 if @project.save
78 @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
78 @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
79 # Add current user as a project member if he is not admin
79 # Add current user as a project member if he is not admin
80 unless User.current.admin?
80 unless User.current.admin?
81 r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
81 r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
82 m = Member.new(:user => User.current, :roles => [r])
82 m = Member.new(:user => User.current, :roles => [r])
83 @project.members << m
83 @project.members << m
84 end
84 end
85 flash[:notice] = l(:notice_successful_create)
85 flash[:notice] = l(:notice_successful_create)
86 redirect_to :controller => 'projects', :action => 'settings', :id => @project
86 redirect_to :controller => 'projects', :action => 'settings', :id => @project
87 end
87 end
88 end
88 end
89 end
89 end
90
90
91 def copy
91 def copy
92 @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
92 @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
93 @trackers = Tracker.all
93 @trackers = Tracker.all
94 @root_projects = Project.find(:all,
94 @root_projects = Project.find(:all,
95 :conditions => "parent_id IS NULL AND status = #{Project::STATUS_ACTIVE}",
95 :conditions => "parent_id IS NULL AND status = #{Project::STATUS_ACTIVE}",
96 :order => 'name')
96 :order => 'name')
97 @source_project = Project.find(params[:id])
97 @source_project = Project.find(params[:id])
98 if request.get?
98 if request.get?
99 @project = Project.copy_from(@source_project)
99 @project = Project.copy_from(@source_project)
100 if @project
100 if @project
101 @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
101 @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
102 else
102 else
103 redirect_to :controller => 'admin', :action => 'projects'
103 redirect_to :controller => 'admin', :action => 'projects'
104 end
104 end
105 else
105 else
106 @project = Project.new(params[:project])
106 @project = Project.new(params[:project])
107 @project.enabled_module_names = params[:enabled_modules]
107 @project.enabled_module_names = params[:enabled_modules]
108 if @project.copy(@source_project, :only => params[:only])
108 if @project.copy(@source_project, :only => params[:only])
109 @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
109 @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
110 flash[:notice] = l(:notice_successful_create)
110 flash[:notice] = l(:notice_successful_create)
111 redirect_to :controller => 'admin', :action => 'projects'
111 redirect_to :controller => 'admin', :action => 'projects'
112 end
112 end
113 end
113 end
114 rescue ActiveRecord::RecordNotFound
114 rescue ActiveRecord::RecordNotFound
115 redirect_to :controller => 'admin', :action => 'projects'
115 redirect_to :controller => 'admin', :action => 'projects'
116 end
116 end
117
117
118 # Show @project
118 # Show @project
119 def show
119 def show
120 if params[:jump]
120 if params[:jump]
121 # try to redirect to the requested menu item
121 # try to redirect to the requested menu item
122 redirect_to_project_menu_item(@project, params[:jump]) && return
122 redirect_to_project_menu_item(@project, params[:jump]) && return
123 end
123 end
124
124
125 @users_by_role = @project.users_by_role
125 @users_by_role = @project.users_by_role
126 @subprojects = @project.children.visible
126 @subprojects = @project.children.visible
127 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
127 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
128 @trackers = @project.rolled_up_trackers
128 @trackers = @project.rolled_up_trackers
129
129
130 cond = @project.project_condition(Setting.display_subprojects_issues?)
130 cond = @project.project_condition(Setting.display_subprojects_issues?)
131
131
132 @open_issues_by_tracker = Issue.visible.count(:group => :tracker,
132 @open_issues_by_tracker = Issue.visible.count(:group => :tracker,
133 :include => [:project, :status, :tracker],
133 :include => [:project, :status, :tracker],
134 :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false])
134 :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false])
135 @total_issues_by_tracker = Issue.visible.count(:group => :tracker,
135 @total_issues_by_tracker = Issue.visible.count(:group => :tracker,
136 :include => [:project, :status, :tracker],
136 :include => [:project, :status, :tracker],
137 :conditions => cond)
137 :conditions => cond)
138
138
139 TimeEntry.visible_by(User.current) do
139 TimeEntry.visible_by(User.current) do
140 @total_hours = TimeEntry.sum(:hours,
140 @total_hours = TimeEntry.sum(:hours,
141 :include => :project,
141 :include => :project,
142 :conditions => cond).to_f
142 :conditions => cond).to_f
143 end
143 end
144 @key = User.current.rss_key
144 @key = User.current.rss_key
145 end
145 end
146
146
147 def settings
147 def settings
148 @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
148 @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
149 @issue_category ||= IssueCategory.new
149 @issue_category ||= IssueCategory.new
150 @member ||= @project.members.new
150 @member ||= @project.members.new
151 @trackers = Tracker.all
151 @trackers = Tracker.all
152 @repository ||= @project.repository
152 @repository ||= @project.repository
153 @wiki ||= @project.wiki
153 @wiki ||= @project.wiki
154 end
154 end
155
155
156 # Edit @project
156 # Edit @project
157 def edit
157 def edit
158 if request.post?
158 if request.post?
159 @project.attributes = params[:project]
159 @project.attributes = params[:project]
160 if @project.save
160 if @project.save
161 @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
161 @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
162 flash[:notice] = l(:notice_successful_update)
162 flash[:notice] = l(:notice_successful_update)
163 redirect_to :action => 'settings', :id => @project
163 redirect_to :action => 'settings', :id => @project
164 else
164 else
165 settings
165 settings
166 render :action => 'settings'
166 render :action => 'settings'
167 end
167 end
168 end
168 end
169 end
169 end
170
170
171 def modules
171 def modules
172 @project.enabled_module_names = params[:enabled_modules]
172 @project.enabled_module_names = params[:enabled_modules]
173 redirect_to :action => 'settings', :id => @project, :tab => 'modules'
173 redirect_to :action => 'settings', :id => @project, :tab => 'modules'
174 end
174 end
175
175
176 def archive
176 def archive
177 @project.archive if request.post? && @project.active?
177 @project.archive if request.post? && @project.active?
178 redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status]))
178 redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status]))
179 end
179 end
180
180
181 def unarchive
181 def unarchive
182 @project.unarchive if request.post? && !@project.active?
182 @project.unarchive if request.post? && !@project.active?
183 redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status]))
183 redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status]))
184 end
184 end
185
185
186 # Delete @project
186 # Delete @project
187 def destroy
187 def destroy
188 @project_to_destroy = @project
188 @project_to_destroy = @project
189 if request.post? and params[:confirm]
189 if request.post? and params[:confirm]
190 @project_to_destroy.destroy
190 @project_to_destroy.destroy
191 redirect_to :controller => 'admin', :action => 'projects'
191 redirect_to :controller => 'admin', :action => 'projects'
192 end
192 end
193 # hide project in layout
193 # hide project in layout
194 @project = nil
194 @project = nil
195 end
195 end
196
196
197 # Add a new issue category to @project
197 # Add a new issue category to @project
198 def add_issue_category
198 def add_issue_category
199 @category = @project.issue_categories.build(params[:category])
199 @category = @project.issue_categories.build(params[:category])
200 if request.post? and @category.save
200 if request.post?
201 if @category.save
201 respond_to do |format|
202 respond_to do |format|
202 format.html do
203 format.html do
203 flash[:notice] = l(:notice_successful_create)
204 flash[:notice] = l(:notice_successful_create)
204 redirect_to :action => 'settings', :tab => 'categories', :id => @project
205 redirect_to :action => 'settings', :tab => 'categories', :id => @project
205 end
206 end
206 format.js do
207 format.js do
207 # IE doesn't support the replace_html rjs method for select box options
208 # IE doesn't support the replace_html rjs method for select box options
208 render(:update) {|page| page.replace "issue_category_id",
209 render(:update) {|page| page.replace "issue_category_id",
209 content_tag('select', '<option></option>' + options_from_collection_for_select(@project.issue_categories, 'id', 'name', @category.id), :id => 'issue_category_id', :name => 'issue[category_id]')
210 content_tag('select', '<option></option>' + options_from_collection_for_select(@project.issue_categories, 'id', 'name', @category.id), :id => 'issue_category_id', :name => 'issue[category_id]')
210 }
211 }
211 end
212 end
212 end
213 end
214 else
215 respond_to do |format|
216 format.html
217 format.js do
218 render(:update) {|page| page.alert(@category.errors.full_messages.join('\n')) }
219 end
220 end
221 end
213 end
222 end
214 end
223 end
215
224
216 # Add a new version to @project
225 # Add a new version to @project
217 def add_version
226 def add_version
218 @version = @project.versions.build(params[:version])
227 @version = @project.versions.build(params[:version])
219 if request.post? and @version.save
228 if request.post? and @version.save
220 flash[:notice] = l(:notice_successful_create)
229 flash[:notice] = l(:notice_successful_create)
221 redirect_to :action => 'settings', :tab => 'versions', :id => @project
230 redirect_to :action => 'settings', :tab => 'versions', :id => @project
222 end
231 end
223 end
232 end
224
233
225 def add_file
234 def add_file
226 if request.post?
235 if request.post?
227 container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
236 container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
228 attachments = attach_files(container, params[:attachments])
237 attachments = attach_files(container, params[:attachments])
229 if !attachments.empty? && Setting.notified_events.include?('file_added')
238 if !attachments.empty? && Setting.notified_events.include?('file_added')
230 Mailer.deliver_attachments_added(attachments)
239 Mailer.deliver_attachments_added(attachments)
231 end
240 end
232 redirect_to :controller => 'projects', :action => 'list_files', :id => @project
241 redirect_to :controller => 'projects', :action => 'list_files', :id => @project
233 return
242 return
234 end
243 end
235 @versions = @project.versions.sort
244 @versions = @project.versions.sort
236 end
245 end
237
246
238 def save_activities
247 def save_activities
239 if request.post? && params[:enumerations]
248 if request.post? && params[:enumerations]
240 Project.transaction do
249 Project.transaction do
241 params[:enumerations].each do |id, activity|
250 params[:enumerations].each do |id, activity|
242 @project.update_or_create_time_entry_activity(id, activity)
251 @project.update_or_create_time_entry_activity(id, activity)
243 end
252 end
244 end
253 end
245 end
254 end
246
255
247 redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
256 redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
248 end
257 end
249
258
250 def reset_activities
259 def reset_activities
251 @project.time_entry_activities.each do |time_entry_activity|
260 @project.time_entry_activities.each do |time_entry_activity|
252 time_entry_activity.destroy(time_entry_activity.parent)
261 time_entry_activity.destroy(time_entry_activity.parent)
253 end
262 end
254 redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
263 redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
255 end
264 end
256
265
257 def list_files
266 def list_files
258 sort_init 'filename', 'asc'
267 sort_init 'filename', 'asc'
259 sort_update 'filename' => "#{Attachment.table_name}.filename",
268 sort_update 'filename' => "#{Attachment.table_name}.filename",
260 'created_on' => "#{Attachment.table_name}.created_on",
269 'created_on' => "#{Attachment.table_name}.created_on",
261 'size' => "#{Attachment.table_name}.filesize",
270 'size' => "#{Attachment.table_name}.filesize",
262 'downloads' => "#{Attachment.table_name}.downloads"
271 'downloads' => "#{Attachment.table_name}.downloads"
263
272
264 @containers = [ Project.find(@project.id, :include => :attachments, :order => sort_clause)]
273 @containers = [ Project.find(@project.id, :include => :attachments, :order => sort_clause)]
265 @containers += @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse
274 @containers += @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse
266 render :layout => !request.xhr?
275 render :layout => !request.xhr?
267 end
276 end
268
277
269 # Show changelog for @project
278 # Show changelog for @project
270 def changelog
279 def changelog
271 @trackers = @project.trackers.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position')
280 @trackers = @project.trackers.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position')
272 retrieve_selected_tracker_ids(@trackers)
281 retrieve_selected_tracker_ids(@trackers)
273 @versions = @project.versions.sort
282 @versions = @project.versions.sort
274 end
283 end
275
284
276 def roadmap
285 def roadmap
277 @trackers = @project.trackers.find(:all, :conditions => ["is_in_roadmap=?", true])
286 @trackers = @project.trackers.find(:all, :conditions => ["is_in_roadmap=?", true])
278 retrieve_selected_tracker_ids(@trackers)
287 retrieve_selected_tracker_ids(@trackers)
279 @versions = @project.versions.sort
288 @versions = @project.versions.sort
280 @versions = @versions.select {|v| !v.completed? } unless params[:completed]
289 @versions = @versions.select {|v| !v.completed? } unless params[:completed]
281 end
290 end
282
291
283 def activity
292 def activity
284 @days = Setting.activity_days_default.to_i
293 @days = Setting.activity_days_default.to_i
285
294
286 if params[:from]
295 if params[:from]
287 begin; @date_to = params[:from].to_date + 1; rescue; end
296 begin; @date_to = params[:from].to_date + 1; rescue; end
288 end
297 end
289
298
290 @date_to ||= Date.today + 1
299 @date_to ||= Date.today + 1
291 @date_from = @date_to - @days
300 @date_from = @date_to - @days
292 @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
301 @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
293 @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
302 @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
294
303
295 @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project,
304 @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project,
296 :with_subprojects => @with_subprojects,
305 :with_subprojects => @with_subprojects,
297 :author => @author)
306 :author => @author)
298 @activity.scope_select {|t| !params["show_#{t}"].nil?}
307 @activity.scope_select {|t| !params["show_#{t}"].nil?}
299 @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
308 @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
300
309
301 events = @activity.events(@date_from, @date_to)
310 events = @activity.events(@date_from, @date_to)
302
311
303 if events.empty? || stale?(:etag => [events.first, User.current])
312 if events.empty? || stale?(:etag => [events.first, User.current])
304 respond_to do |format|
313 respond_to do |format|
305 format.html {
314 format.html {
306 @events_by_day = events.group_by(&:event_date)
315 @events_by_day = events.group_by(&:event_date)
307 render :layout => false if request.xhr?
316 render :layout => false if request.xhr?
308 }
317 }
309 format.atom {
318 format.atom {
310 title = l(:label_activity)
319 title = l(:label_activity)
311 if @author
320 if @author
312 title = @author.name
321 title = @author.name
313 elsif @activity.scope.size == 1
322 elsif @activity.scope.size == 1
314 title = l("label_#{@activity.scope.first.singularize}_plural")
323 title = l("label_#{@activity.scope.first.singularize}_plural")
315 end
324 end
316 render_feed(events, :title => "#{@project || Setting.app_title}: #{title}")
325 render_feed(events, :title => "#{@project || Setting.app_title}: #{title}")
317 }
326 }
318 end
327 end
319 end
328 end
320
329
321 rescue ActiveRecord::RecordNotFound
330 rescue ActiveRecord::RecordNotFound
322 render_404
331 render_404
323 end
332 end
324
333
325 private
334 private
326 # Find project of id params[:id]
335 # Find project of id params[:id]
327 # if not found, redirect to project list
336 # if not found, redirect to project list
328 # Used as a before_filter
337 # Used as a before_filter
329 def find_project
338 def find_project
330 @project = Project.find(params[:id])
339 @project = Project.find(params[:id])
331 rescue ActiveRecord::RecordNotFound
340 rescue ActiveRecord::RecordNotFound
332 render_404
341 render_404
333 end
342 end
334
343
335 def find_optional_project
344 def find_optional_project
336 return true unless params[:id]
345 return true unless params[:id]
337 @project = Project.find(params[:id])
346 @project = Project.find(params[:id])
338 authorize
347 authorize
339 rescue ActiveRecord::RecordNotFound
348 rescue ActiveRecord::RecordNotFound
340 render_404
349 render_404
341 end
350 end
342
351
343 def retrieve_selected_tracker_ids(selectable_trackers)
352 def retrieve_selected_tracker_ids(selectable_trackers)
344 if ids = params[:tracker_ids]
353 if ids = params[:tracker_ids]
345 @selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s }
354 @selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s }
346 else
355 else
347 @selected_tracker_ids = selectable_trackers.collect {|t| t.id.to_s }
356 @selected_tracker_ids = selectable_trackers.collect {|t| t.id.to_s }
348 end
357 end
349 end
358 end
350 end
359 end
General Comments 0
You need to be logged in to leave comments. Login now