Module: NavigationHelper
- Defined in:
- app/helpers/navigation_helper.rb
Instance Method Summary collapse
- #current_feature ⇒ Object
- #render_nav_for_feature(feature) ⇒ Object
- #render_nav_link(name, href) ⇒ Object
- #render_navigation(key) ⇒ Object
Instance Method Details
#current_feature ⇒ Object
13 14 15 16 17 18 |
# File 'app/helpers/navigation_helper.rb', line 13 def current_feature return nil unless current_project && current_project.persisted? @current_feature ||= current_project.features.find do |feature| current_page? feature_path(current_project, feature) end end |
#render_nav_for_feature(feature) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/helpers/navigation_helper.rb', line 20 def render_nav_for_feature(feature) feature = Houston.project_features[feature] return unless feature.permitted?(current_ability, current_project) render_nav_link feature.name, feature.path(current_project) rescue KeyError Rails.logger.error "\e[31;1mThere is no project feature named #{feature.inspect}\e[0m" nil end |
#render_nav_link(name, href) ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/helpers/navigation_helper.rb', line 30 def render_nav_link(name, href) if current_page? href "<li class=\"current\">#{h name}</li>".html_safe else "<li><a href=\"#{href}\" title=\"#{h name}\">#{h name}</a></li>".html_safe end end |
#render_navigation(key) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'app/helpers/navigation_helper.rb', line 3 def (key) link = Houston.[key] return unless link.permitted?(current_ability) render_nav_link link.name, link.path rescue KeyError Rails.logger.error "\e[31;1mThere is no navigation renderer named #{key.inspect}\e[0m" nil end |