You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

project_enumerations_controller.rb 850B

1234567891011121314151617181920212223242526
  1. class ProjectEnumerationsController < ApplicationController
  2. before_filter :find_project_by_project_id
  3. before_filter :authorize
  4. def update
  5. if request.put? && params[:enumerations]
  6. Project.transaction do
  7. params[:enumerations].each do |id, activity|
  8. @project.update_or_create_time_entry_activity(id, activity)
  9. end
  10. end
  11. flash[:notice] = l(:notice_successful_update)
  12. end
  13. redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
  14. end
  15. def destroy
  16. @project.time_entry_activities.each do |time_entry_activity|
  17. time_entry_activity.destroy(time_entry_activity.parent)
  18. end
  19. flash[:notice] = l(:notice_successful_update)
  20. redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
  21. end
  22. end