Class: WelcomeController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- WelcomeController
- Defined in:
- app/controllers/welcome_controller.rb
Constant Summary
Constants included from Localization
Localization::LOCALIZED_STRINGS
Instance Method Summary collapse
Methods inherited from ApplicationController
in_place_edit_for, #initialize
Methods included from ApplicationHelper
#back_or_link_to, #detour?, #detour_to, #display_notice, #h, #image_button_to, #image_detour_to, #image_link_to, #image_link_to_remote, #insert, #record, #resolution_image, #t, #update_task, #with_detour
Methods included from Localization
#l, load_localized_strings, #valid_language?
Constructor Details
This class inherits a constructor from ApplicationController
Instance Method Details
#index ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/welcome_controller.rb', line 2 def index flash.keep if Task.find_started.size > 0 redirect_to :controller => 'tasks', :action => :list_started return end if Backlog.count == 0 redirect_to :controller => 'backlogs', :action => :new return end active_periods = Period.find(:all).select {|period| period.active?(true)} my_active_periods = active_periods.select {|period| period.party.includes?(current_user)} unless my_active_periods.empty? my_active_periods = my_active_periods.sort_by {|p| p.required_speed} my_active_periods_required_speed = my_active_periods.map {|p| p.required_speed} most_urgent_period = my_active_periods.last else most_urgent_period = active_periods.sort_by {|p| p.required_speed}.last end if most_urgent_period redirect_to :controller => 'periods', :action => :show, :id => most_urgent_period return end most_urgent_backlog = Backlog.find(:first, :order => :id) redirect_to :controller => 'backlogs', :action => :show, :id => most_urgent_backlog.id end |