| 
									
										
										
										
											2019-03-16 09:37:35 +00:00
										 |  |  | # frozen_string_literal: true | 
					
						
							| 
									
										
										
										
											2019-03-15 01:32:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-05 12:56:53 +00:00
										 |  |  | # Redmine - project management software | 
					
						
							| 
									
										
										
										
											2017-06-25 08:40:31 +00:00
										 |  |  | # Copyright (C) 2006-2017  Jean-Philippe Lang | 
					
						
							| 
									
										
										
										
											2012-05-05 12:56:53 +00: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 17:39:56 +00:00
										 |  |  | class ProjectEnumerationsController < ApplicationController | 
					
						
							| 
									
										
										
										
											2016-07-14 07:27:31 +00:00
										 |  |  |   before_action :find_project_by_project_id | 
					
						
							|  |  |  |   before_action :authorize | 
					
						
							| 
									
										
										
										
											2011-08-31 12:03:37 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-10 16:00:49 +00:00
										 |  |  |   def update | 
					
						
							| 
									
										
										
										
											2017-07-23 11:26:04 +00:00
										 |  |  |     if @project.update_or_create_time_entry_activities(update_params) | 
					
						
							|  |  |  |       flash[:notice] = l(:notice_successful_update) | 
					
						
							| 
									
										
										
										
											2010-09-02 17:39:56 +00:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2011-08-31 12:03:37 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-11 19:39:47 +00:00
										 |  |  |     redirect_to settings_project_path(@project, :tab => 'activities') | 
					
						
							| 
									
										
										
										
											2010-09-02 17:39:56 +00:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-03 15:04:03 +00: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 19:39:47 +00:00
										 |  |  |     redirect_to settings_project_path(@project, :tab => 'activities') | 
					
						
							| 
									
										
										
										
											2010-09-03 15:04:03 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2017-07-23 11:26:04 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   private | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def update_params | 
					
						
							|  |  |  |     params. | 
					
						
							|  |  |  |       permit(:enumerations => [:parent_id, :active, {:custom_field_values => {}}]). | 
					
						
							|  |  |  |       require(:enumerations) | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2010-09-02 17:39:56 +00:00
										 |  |  | end |