Class: HubController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- HubController
- Defined in:
- app/controllers/hub_controller.rb
Constant Summary
Constants included from ProjectsHelper
ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION
Instance Method Summary collapse
-
#handle_bad_tab_order ⇒ Object
protected
Appends default tabs missing from the user's order, e.g.
-
#index ⇒ Object
GET /hub.
- #order_tabs ⇒ Object
- #set_links_to_render ⇒ Object protected
- #tasks ⇒ Object
- #update_tab_order ⇒ Object
Methods inherited from ApplicationController
Methods included from RedirectHelper
Methods included from RequestType
Methods included from LogRecent
Methods included from Cookies
#digest_cookie, #digested_cookie_exists?
Methods included from Whitelist
Methods included from ProjectsHelper
#cumulative_gb_per_year, #cumulative_projects_created_per_year, #document_cumulative_gb_per_year, #document_gb_per_year, #gb_per_year, #image_cumulative_gb_per_year, #image_gb_per_year, #invalid_object, #project_classification, #project_initials, #project_link, #project_login_link, #project_matches, #project_tag, #projects_list, #projects_search_form, #sound_cumulative_gb_per_year, #sound_gb_per_year, #taxonworks_classification, #week_in_review_graphs
Methods included from Api::Intercept
Methods included from TokenAuthentication
#intercept_project, #intercept_user, #intercept_user_or_project, #project_token_authenticate, #token_authenticate
Instance Method Details
#handle_bad_tab_order ⇒ Object (protected)
Appends default tabs missing from the user's order, e.g. an empty order after a reset, or tabs added since the order was saved. If favorite was last (as in the default order) it stays last, so users who never reordered end up with the current default order.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/hub_controller.rb', line 39 def handle_bad_tab_order order = @sessions_current_user.hub_tab_order missing = DEFAULT_HUB_TAB_ORDER - order if missing.any? new_order = if order.last == 'favorite' order[0..-2] + missing + ['favorite'] else order + missing end @sessions_current_user.update_column(:hub_tab_order, new_order) end true end |
#index ⇒ Object
GET /hub
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/hub_controller.rb', line 6 def index handle_bad_tab_order respond_to do |format| format.html {} # TODO not used?! # format.js { # render partial: 'navigation_index' # layout: nil # } format.json{ render json: helpers.hub_json } end end |
#order_tabs ⇒ Object
24 25 26 |
# File 'app/controllers/hub_controller.rb', line 24 def order_tabs handle_bad_tab_order end |
#set_links_to_render ⇒ Object (protected)
54 55 56 57 |
# File 'app/controllers/hub_controller.rb', line 54 def set_links_to_render @links_to_render = params[:list] @links_to_render ||= @sessions_current_user.hub_tab_order.first end |
#tasks ⇒ Object
20 21 22 |
# File 'app/controllers/hub_controller.rb', line 20 def tasks @tasks = UserTasks.hub_tasks(params[:category]) end |
#update_tab_order ⇒ Object
28 29 30 31 |
# File 'app/controllers/hub_controller.rb', line 28 def update_tab_order @sessions_current_user.update_column(:hub_tab_order, params[:order]) head :ok end |