annotate app/controllers/project_enumerations_controller.rb @ 1295:622f24f53b42 redmine-2.3

Update to Redmine SVN revision 11972 on 2.3-stable branch
author Chris Cannam
date Fri, 14 Jun 2013 09:02:21 +0100
parents 433d4f72a19b
children e248c7af89ec
rev   line source
Chris@1115 1 # Redmine - project management software
Chris@1295 2 # Copyright (C) 2006-2013 Jean-Philippe Lang
Chris@1115 3 #
Chris@1115 4 # This program is free software; you can redistribute it and/or
Chris@1115 5 # modify it under the terms of the GNU General Public License
Chris@1115 6 # as published by the Free Software Foundation; either version 2
Chris@1115 7 # of the License, or (at your option) any later version.
Chris@1115 8 #
Chris@1115 9 # This program is distributed in the hope that it will be useful,
Chris@1115 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@1115 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@1115 12 # GNU General Public License for more details.
Chris@1115 13 #
Chris@1115 14 # You should have received a copy of the GNU General Public License
Chris@1115 15 # along with this program; if not, write to the Free Software
Chris@1115 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@1115 17
chris@22 18 class ProjectEnumerationsController < ApplicationController
chris@22 19 before_filter :find_project_by_project_id
chris@22 20 before_filter :authorize
Chris@909 21
chris@22 22 def update
chris@22 23 if request.put? && params[:enumerations]
chris@22 24 Project.transaction do
chris@22 25 params[:enumerations].each do |id, activity|
chris@22 26 @project.update_or_create_time_entry_activity(id, activity)
chris@22 27 end
chris@22 28 end
chris@22 29 flash[:notice] = l(:notice_successful_update)
chris@22 30 end
Chris@909 31
Chris@1295 32 redirect_to settings_project_path(@project, :tab => 'activities')
chris@22 33 end
chris@22 34
chris@22 35 def destroy
chris@22 36 @project.time_entry_activities.each do |time_entry_activity|
chris@22 37 time_entry_activity.destroy(time_entry_activity.parent)
chris@22 38 end
chris@22 39 flash[:notice] = l(:notice_successful_update)
Chris@1295 40 redirect_to settings_project_path(@project, :tab => 'activities')
chris@22 41 end
chris@22 42 end