Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

project_enumerations_controller.rb 1.6KB

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