2017-06-30 19:20:48 +00:00
|
|
|
module ApplicationHelper
|
2017-06-30 21:02:22 +00:00
|
|
|
def body_classes
|
|
|
|
user_signed_in? ? 'logged-in' : 'logged-out'
|
|
|
|
end
|
2017-07-14 13:23:40 +00:00
|
|
|
|
2017-07-21 19:56:42 +00:00
|
|
|
def body_data_page
|
|
|
|
action = case action_name
|
|
|
|
when 'create' then 'new'
|
|
|
|
when 'update' then 'edit'
|
|
|
|
else action_name
|
|
|
|
end.downcase
|
|
|
|
|
|
|
|
path = controller.controller_path.split('/')
|
|
|
|
namespace = path.first if path.second
|
|
|
|
|
|
|
|
[namespace, controller.controller_name, action].compact.join(':')
|
|
|
|
end
|
|
|
|
|
2017-07-14 13:23:40 +00:00
|
|
|
def nav_link(title, link, html_options = {})
|
|
|
|
classes = ['nav-item']
|
|
|
|
classes << 'active' if current_page?(link)
|
|
|
|
|
|
|
|
content_tag(:li, class: classes) do
|
|
|
|
link_to(title, link, html_options.merge(class: 'nav-link'))
|
|
|
|
end
|
|
|
|
end
|
2017-06-30 19:20:48 +00:00
|
|
|
end
|