Module: NodeController

Extended by:
ActiveSupport::Concern
Included in:
ContactsController, HomePagesController, TextPagesController
Defined in:
lib/generators/dummy/templates/controllers/concerns/node_controller.rb

Instance Method Summary collapse

Instance Method Details


17
18
19
# File 'lib/generators/dummy/templates/controllers/concerns/node_controller.rb', line 17

def menu
  @menu ||= root_node.children.where(active: true)
end

#node_active?(node) ⇒ Boolean

Returns:

  • (Boolean)

31
32
33
# File 'lib/generators/dummy/templates/controllers/concerns/node_controller.rb', line 31

def node_active? node
  @active_nodes.include? node
end

#node_classObject


21
22
23
24
# File 'lib/generators/dummy/templates/controllers/concerns/node_controller.rb', line 21

def node_class
  # for node routes the node class can be detected from params
  @node_class ||= params[:node_class].constantize
end

#root_nodeObject


13
14
15
# File 'lib/generators/dummy/templates/controllers/concerns/node_controller.rb', line 13

def root_node
  @root ||= available_roots.find_by(locale: I18n.locale)
end

#showObject


10
11
# File 'lib/generators/dummy/templates/controllers/concerns/node_controller.rb', line 10

def show
end

#siteObject


26
27
28
29
# File 'lib/generators/dummy/templates/controllers/concerns/node_controller.rb', line 26

def site
  # for node routes site can be detected from params
  @site ||= params[:site]
end