Module: Shipyard::LayoutHelper

Defined in:
lib/shipyard-framework/helpers/layout_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_actionObject



15
16
17
# File 'lib/shipyard-framework/helpers/layout_helper.rb', line 15

def current_action
  controller.action_name.dasherize
end

#current_controllerObject



11
12
13
# File 'lib/shipyard-framework/helpers/layout_helper.rb', line 11

def current_controller
  controller.controller_name.dasherize
end

#current_pageObject



19
20
21
# File 'lib/shipyard-framework/helpers/layout_helper.rb', line 19

def current_page
  "#{current_controller}-#{current_action}"
end

#current_routeObject



23
24
25
# File 'lib/shipyard-framework/helpers/layout_helper.rb', line 23

def current_route
  "#{controller.controller_name}##{controller.action_name}"
end

#current_route_is?(routes) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/shipyard-framework/helpers/layout_helper.rb', line 27

def current_route_is?(routes)
  routes.tr(' ', '').split(',').include? current_route
end

#shipyard_css_classesObject



3
4
5
6
7
8
9
# File 'lib/shipyard-framework/helpers/layout_helper.rb', line 3

def shipyard_css_classes
  css_classes = []
  css_classes << current_page
  css_classes << current_controller
  css_classes << "env-#{::Rails.env}"
  css_classes.join(' ')
end