Class: Publinator::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/publinator/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#body_idObject



34
35
36
37
38
39
40
41
42
43
44
# File 'app/controllers/publinator/application_controller.rb', line 34

def body_id
  if @section
    return @section.slug
  elsif @page
    return @page.section.slug
  elsif @publishable
    return @publishable.class.to_s.downcase
  else
    return "home"
  end
end

#current_controllerObject



29
30
31
32
# File 'app/controllers/publinator/application_controller.rb', line 29

def current_controller
  return "Home" if body_id == 'home'
  body_id.pluralize.camelize
end

#current_domainObject



12
13
14
# File 'app/controllers/publinator/application_controller.rb', line 12

def current_domain
  @current_domain ||= DomainName.get_by_domain_name(request)
end

#current_layoutObject



16
17
18
19
20
21
22
# File 'app/controllers/publinator/application_controller.rb', line 16

def current_layout
  if current_site.nil?
    "publinator/publinator"
  else
    @current_layout ||= current_site.layout
  end
end

#current_siteObject



7
8
9
10
# File 'app/controllers/publinator/application_controller.rb', line 7

def current_site
  return nil if current_domain.nil?
  @current_site ||= current_domain.site
end

#current_site_nameObject



24
25
26
27
# File 'app/controllers/publinator/application_controller.rb', line 24

def current_site_name
  return "Publinator" if current_site.nil?
  @current_site_name ||= current_site.name
end