2012-05-05 14:56:53 +02:00
|
|
|
# Redmine - project management software
|
2013-01-12 10:29:31 +01:00
|
|
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
2012-05-05 14:56:53 +02:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
2010-09-02 19:39:56 +02:00
|
|
|
class ProjectEnumerationsController < ApplicationController
|
2010-09-10 18:00:49 +02:00
|
|
|
before_filter :find_project_by_project_id
|
2010-09-02 19:39:56 +02:00
|
|
|
before_filter :authorize
|
2011-08-31 14:03:37 +02:00
|
|
|
|
2010-09-10 18:00:49 +02:00
|
|
|
def update
|
|
|
|
if request.put? && params[:enumerations]
|
2010-09-02 19:39:56 +02:00
|
|
|
Project.transaction do
|
|
|
|
params[:enumerations].each do |id, activity|
|
|
|
|
@project.update_or_create_time_entry_activity(id, activity)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
flash[:notice] = l(:notice_successful_update)
|
|
|
|
end
|
2011-08-31 14:03:37 +02:00
|
|
|
|
2012-12-11 20:39:47 +01:00
|
|
|
redirect_to settings_project_path(@project, :tab => 'activities')
|
2010-09-02 19:39:56 +02:00
|
|
|
end
|
|
|
|
|
2010-09-03 17:04:03 +02:00
|
|
|
def destroy
|
|
|
|
@project.time_entry_activities.each do |time_entry_activity|
|
|
|
|
time_entry_activity.destroy(time_entry_activity.parent)
|
|
|
|
end
|
|
|
|
flash[:notice] = l(:notice_successful_update)
|
2012-12-11 20:39:47 +01:00
|
|
|
redirect_to settings_project_path(@project, :tab => 'activities')
|
2010-09-03 17:04:03 +02:00
|
|
|
end
|
2010-09-02 19:39:56 +02:00
|
|
|
end
|