Class: HubController

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

Constant Summary

Constants included from ProjectsHelper

ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION

Instance Method Summary collapse

Methods included from RedirectHelper

#destroy_redirect

Methods included from RequestType

#json_request?

Methods included from LogRecent

#log_user_recent_route

Methods included from Cookies

#digest_cookie, #digested_cookie_exists?

Methods included from Whitelist

#whitelist_constantize

Methods included from ProjectsHelper

#cumulative_gb_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_link, #project_matches, #project_tag, #projects_list, #projects_search_form, #taxonworks_classification, #week_in_review_graphs

Methods included from Api::Intercept

#intercept_api

Methods included from TokenAuthentication

#intercept_project, #intercept_user, #intercept_user_or_project, #project_token_authenticate, #token_authenticate

Instance Method Details

#handle_bad_tab_orderObject (protected)



36
37
38
39
40
41
42
43
44
# File 'app/controllers/hub_controller.rb', line 36

def handle_bad_tab_order
  # This is preventative only, it should never happen in real data, and may only occur when 
  # we reset tab performance.
  if @sessions_current_user.hub_tab_order.empty?
    # TODO: update_column likely
    @sessions_current_user.update_attribute(:hub_tab_order, DEFAULT_HUB_TAB_ORDER)
  end
  true
end

#indexObject

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_tabsObject



24
25
26
# File 'app/controllers/hub_controller.rb', line 24

def order_tabs
  handle_bad_tab_order
end


46
47
48
49
# File 'app/controllers/hub_controller.rb', line 46

def set_links_to_render
  @links_to_render = params[:list]
  @links_to_render ||= @sessions_current_user.hub_tab_order.first
end

#tasksObject



20
21
22
# File 'app/controllers/hub_controller.rb', line 20

def tasks
  @tasks = UserTasks.hub_tasks(params[:category])
end

#update_tab_orderObject



28
29
30
31
32
# File 'app/controllers/hub_controller.rb', line 28

def update_tab_order
  # TODO: update_column likely 
  @sessions_current_user.update_attribute(:hub_tab_order, params[:order])
  head :ok
end