@@ -1,26 +1,26 | |||||
1 | class ProjectEnumerationsController < ApplicationController |
|
1 | class ProjectEnumerationsController < ApplicationController | |
2 | before_filter :find_project_by_project_id |
|
2 | before_filter :find_project_by_project_id | |
3 | before_filter :authorize |
|
3 | before_filter :authorize | |
4 |
|
4 | |||
5 | def update |
|
5 | def update | |
6 | if request.put? && params[:enumerations] |
|
6 | if request.put? && params[:enumerations] | |
7 | Project.transaction do |
|
7 | Project.transaction do | |
8 | params[:enumerations].each do |id, activity| |
|
8 | params[:enumerations].each do |id, activity| | |
9 | @project.update_or_create_time_entry_activity(id, activity) |
|
9 | @project.update_or_create_time_entry_activity(id, activity) | |
10 | end |
|
10 | end | |
11 | end |
|
11 | end | |
12 | flash[:notice] = l(:notice_successful_update) |
|
12 | flash[:notice] = l(:notice_successful_update) | |
13 | end |
|
13 | end | |
14 |
|
14 | |||
15 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project |
|
15 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project | |
16 | end |
|
16 | end | |
17 |
|
17 | |||
18 | def destroy |
|
18 | def destroy | |
19 | @project.time_entry_activities.each do |time_entry_activity| |
|
19 | @project.time_entry_activities.each do |time_entry_activity| | |
20 | time_entry_activity.destroy(time_entry_activity.parent) |
|
20 | time_entry_activity.destroy(time_entry_activity.parent) | |
21 | end |
|
21 | end | |
22 | flash[:notice] = l(:notice_successful_update) |
|
22 | flash[:notice] = l(:notice_successful_update) | |
23 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project |
|
23 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project | |
24 | end |
|
24 | end | |
25 |
|
25 | |||
26 | end |
|
26 | end |
General Comments 0
You need to be logged in to leave comments.
Login now