Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
HydraAccessControlsHelper
Defined in:
vendor/plugins/blacklight/app/controllers/application_controller.rb,
app/controllers/application_controller.rb,
vendor/plugins/hydra_repository/app/controllers/application_controller.rb

Overview

Filters added to this controller apply to all controllers in the application. Likewise, all the methods added will be available for all controllers.

Direct Known Subclasses

AssetsController, BookmarksController, CatalogController, DownloadsController, FeedbackController, FileAssetsController, FolderController, GenericContentObjectsController, GetController, PermissionsController, SavedSearchesController, SearchHistoryController, UserSessionsController, UsersController

Instance Method Summary (collapse)

Methods included from HydraAccessControlsHelper

#editor?, #reader?, #test_permission

Instance Method Details

- (Object) current_user



96
97
98
99
100
# File 'vendor/plugins/blacklight/app/controllers/application_controller.rb', line 96

def current_user
  return @current_user if defined?(@current_user)
  @current_user = current_user_session && current_user_session.user
  @current_user.extend(Hydra::SuperuserAttributes)
end

- (Object) default_html_head

before filter to set up our default html HEAD content. Sub-class controllers can over-ride this method, or instead turn off the before_filter if they like. See: api.rubyonrails.org/classes/ActionController/Filters/ClassMethods.html for how to turn off a filter in a sub-class and such.



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'vendor/plugins/blacklight/app/controllers/application_controller.rb', line 37

def default_html_head
  # when working offline, comment out the above uncomment the next line:
  #javascript_includes << ['jquery-1.4.2.min.js', 'jquery-ui-1.8.1.custom.min.js', { :plugin=>:blacklight } ]

  javascript_includes << ['http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js']
  javascript_includes << ['application', {:plugin=>:hydra_repository, :media=>'all'}]
  
  javascript_includes << ['blacklight', 'application', 'accordion', { :plugin=>:blacklight } ]
  
  stylesheet_links << ['yui', 'jquery/ui-lightness/jquery-ui-1.8.1.custom.css', 'application', {:plugin=>:blacklight, :media=>'all'}]
  stylesheet_links << ['redmond/jquery-ui-1.8.5.custom.css', {:plugin=>:hydra_repository, :media=>'all'}]      
  stylesheet_links << ['styles', 'hydrangea', "hydrangea-split-button.css", {:plugin=>:hydra_repository,:media=>'all'}]
end

- (Object) error

test for exception notifier plugin

Raises:

  • (RuntimeError)


24
25
26
# File 'vendor/plugins/blacklight/app/controllers/application_controller.rb', line 24

def error
  raise RuntimeError, "Generating a test error..."
end

- (Object) extra_head_content

An array of strings to be added to HTML HEAD section of view. See ApplicationHelper#render_head_content for details.



46
47
48
# File 'vendor/plugins/blacklight/app/controllers/application_controller.rb', line 46

def extra_head_content
  @extra_head_content ||= []
end

- (Object) javascript_includes

Array, where each element is an array of arguments to Rails javascript_include_tag helper. See ApplicationHelper#render_head_content for details.



62
63
64
# File 'vendor/plugins/blacklight/app/controllers/application_controller.rb', line 62

def javascript_includes
  @javascript_includes ||= []
end

Array, where each element is an array of arguments to Rails stylesheet_link_tag helper. See ApplicationHelper#render_head_content for details.



54
55
56
# File 'vendor/plugins/blacklight/app/controllers/application_controller.rb', line 54

def stylesheet_links
  @stylesheet_links ||= []
end

- (Object) user_class



12
# File 'vendor/plugins/blacklight/app/controllers/application_controller.rb', line 12

def user_class; User end