To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / app / controllers / project_enumerations_controller.rb @ 912:5e80956cc792
History | View | Annotate | Download (850 Bytes)
| 1 | 22:40f7cfd4df19 | chris | class ProjectEnumerationsController < ApplicationController |
|---|---|---|---|
| 2 | before_filter :find_project_by_project_id
|
||
| 3 | before_filter :authorize
|
||
| 4 | 909:cbb26bc654de | Chris | |
| 5 | 22:40f7cfd4df19 | chris | def update |
| 6 | if request.put? && params[:enumerations] |
||
| 7 | Project.transaction do |
||
| 8 | params[:enumerations].each do |id, activity| |
||
| 9 | @project.update_or_create_time_entry_activity(id, activity)
|
||
| 10 | end
|
||
| 11 | end
|
||
| 12 | flash[:notice] = l(:notice_successful_update) |
||
| 13 | end
|
||
| 14 | 909:cbb26bc654de | Chris | |
| 15 | 22:40f7cfd4df19 | chris | redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project |
| 16 | end
|
||
| 17 | |||
| 18 | def destroy |
||
| 19 | @project.time_entry_activities.each do |time_entry_activity| |
||
| 20 | time_entry_activity.destroy(time_entry_activity.parent) |
||
| 21 | end
|
||
| 22 | flash[:notice] = l(:notice_successful_update) |
||
| 23 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project |
||
| 24 | end
|
||
| 25 | |||
| 26 | end |