Class: ProjectEnumerationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/project_enumerations_controller.rb

Overview

– copyright ChiliProject is a project management system.

Copyright (C) 2010-2013 the ChiliProject Team

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.

See doc/COPYRIGHT.rdoc for more details. ++

Instance Method Summary collapse

Methods included from Redmine::MenuManager::MenuController

#current_menu_item, included, #menu_items, #redirect_to_project_menu_item

Methods included from Redmine::Search::Controller

#default_search_scope, #default_search_scopes, included

Methods included from Redmine::I18n

#current_language, #day_name, #find_language, #format_date, #format_time, included, #l, #l_hours, #l_or_humanize, #ll, #month_name, #set_language_if_valid, #valid_languages

Instance Method Details

#destroyObject



32
33
34
35
36
37
38
# File 'app/controllers/project_enumerations_controller.rb', line 32

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)
  redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
end

#updateObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/project_enumerations_controller.rb', line 19

def update
  if request.put? && params[:enumerations]
    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

  redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
end