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 @ 959:910830dc222a
History | View | Annotate | Download (850 Bytes)
| 1 |
class ProjectEnumerationsController < ApplicationController |
|---|---|
| 2 |
before_filter :find_project_by_project_id
|
| 3 |
before_filter :authorize
|
| 4 |
|
| 5 |
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 |
|
| 15 |
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
|