To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / app / controllers / project_enumerations_controller.rb @ 1304:6137548ba453

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