Sha256: e22920139337d3abf2ce10d6f029840bd896fa4d8913bbf6c49774d91908528b
Contents?: true
Size: 954 Bytes
Versions: 33
Compression:
Stored size: 954 Bytes
Contents
# frozen_string_literal: true # # Helpful methods for navigation bar on the side # module CoreNavBarHelper # # Determines which css attributes should be assigned to the current menu, # options are # <ul> # <li>read-only - the menu is greyed out and disabled</li> # <li>locked - a lock icon appears</li> # <li>active - if the current controller matches either the name or names</li> # </ul> # def nav_css(names, read_only = false, feature_enabled = true, feature_visible = true) states = [] states << 'read-only' if read_only states << 'locked' unless feature_enabled states << 'hidden' unless feature_visible case names when String states << 'active' if names.eql?(controller.controller_name) when Array states << 'active' if names.include?(controller.controller_name) else states << 'active' if names.to_s.eql?(controller.controller_name) end states.join(' ') end end
Version data entries
33 entries across 33 versions & 1 rubygems