2012-05-05 16:56:53 +04:00
|
|
|
# Redmine - project management software
|
2013-01-12 13:29:31 +04:00
|
|
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
2012-05-05 16:56:53 +04: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 21:39:56 +04:00
|
|
|
class ProjectEnumerationsController < ApplicationController
|
2010-09-10 20:00:49 +04:00
|
|
|
before_filter :find_project_by_project_id
|
2010-09-02 21:39:56 +04:00
|
|
|
before_filter :authorize
|
2011-08-31 16:03:37 +04:00
|
|
|
|
2010-09-10 20:00:49 +04:00
|
|
|
def update
|
|
|
|
if request.put? && params[:enumerations]
|
2010-09-02 21:39:56 +04: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 16:03:37 +04:00
|
|
|
|
2012-12-11 23:39:47 +04:00
|
|
|
redirect_to settings_project_path(@project, :tab => 'activities')
|
2010-09-02 21:39:56 +04:00
|
|
|
end
|
|
|
|
|
2010-09-03 19:04:03 +04: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 23:39:47 +04:00
|
|
|
redirect_to settings_project_path(@project, :tab => 'activities')
|
2010-09-03 19:04:03 +04:00
|
|
|
end
|
2010-09-02 21:39:56 +04:00
|
|
|
end
|