Class: PandaCms::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- PandaCms::ApplicationController
- Includes:
- ApplicationHelper, ApplicationHelper
- Defined in:
- app/controllers/panda_cms/application_controller.rb
Direct Known Subclasses
PandaCms::Admin::BlockContentsController, PandaCms::Admin::DashboardController, PandaCms::Admin::FilesController, PandaCms::Admin::FormsController, PandaCms::Admin::MenusController, PandaCms::Admin::PagesController, PandaCms::Admin::PostsController, PandaCms::Admin::SessionsController, PandaCms::Admin::SettingsController, ErrorsController, FormSubmissionsController, PagesController, PostsController
Instance Method Summary collapse
- #add_breadcrumb(name, path = nil) ⇒ Object
- #authenticate_admin_user! ⇒ Object
- #authenticate_user! ⇒ Object
- #breadcrumbs ⇒ Object
-
#current_user ⇒ Object
Required for paper_trail and seems as good as convention these days.
-
#set_current_request_details ⇒ void
Set the current request details.
- #user_signed_in? ⇒ Boolean
Methods included from ApplicationHelper
#active_link?, #block_link_to, #component, #level_indent, #menu_indent, #nav_class, #nav_highlight_colour_classes, #panda_cms_editor, #panda_cms_form_with, #selected_nav_highlight_colour_classes, #table_indent, #title_tag
Instance Method Details
#add_breadcrumb(name, path = nil) ⇒ Object
21 22 23 |
# File 'app/controllers/panda_cms/application_controller.rb', line 21 def (name, path = nil) << Breadcrumb.new(name, path) end |
#authenticate_admin_user! ⇒ Object
42 43 44 |
# File 'app/controllers/panda_cms/application_controller.rb', line 42 def authenticate_admin_user! redirect_to root_path, flash: {error: "Please login to view this!"} unless user_signed_in? && current_user.admin? end |
#authenticate_user! ⇒ Object
38 39 40 |
# File 'app/controllers/panda_cms/application_controller.rb', line 38 def authenticate_user! redirect_to root_path, flash: {error: "Please login to view this!"} unless user_signed_in? end |
#breadcrumbs ⇒ Object
17 18 19 |
# File 'app/controllers/panda_cms/application_controller.rb', line 17 def @breadcrumbs ||= [] end |
#current_user ⇒ Object
Required for paper_trail and seems as good as convention these days
47 48 49 |
# File 'app/controllers/panda_cms/application_controller.rb', line 47 def current_user PandaCms::Current.user end |
#set_current_request_details ⇒ void
This method returns an undefined value.
Set the current request details
27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/panda_cms/application_controller.rb', line 27 def set_current_request_details PandaCms::Current.request_id = request.uuid PandaCms::Current.user_agent = request.user_agent PandaCms::Current.ip_address = request.ip PandaCms::Current.root = request.base_url PandaCms::Current.page = nil PandaCms::Current.user ||= User.find_by(id: session[:user_id]) if session[:user_id] PandaCms.config.url ||= PandaCms::Current.root end |