Module: Voluntary::LayoutHelper
- Defined in:
- app/helpers/voluntary/layout_helper.rb
Instance Method Summary collapse
- #breadcrumbs ⇒ Object
- #breadcrumbs_with_ancestors(links) ⇒ Object
- #footer_navigation ⇒ Object
- #sidenav(links_count = 2) ⇒ Object
Instance Method Details
#breadcrumbs ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'app/helpers/voluntary/layout_helper.rb', line 3 def result = context: , renderer: :breadcrumbs_without_method_links, join_with: ' > ' result = result && result.scan('<a').length > 1 ? result : '' if respond_to?(:resource) && resource.respond_to?(:ancestors) (result) else result end end |
#breadcrumbs_with_ancestors(links) ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/helpers/voluntary/layout_helper.rb', line 14 def (links) links = links.split(' > ') current_resource_link = links.pop links += resource.ancestors.map {|ancestor| link_to ancestor.name, ancestor } links << current_resource_link raw links.join(' > ') end |
#footer_navigation ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/helpers/voluntary/layout_helper.rb', line 29 def links = [] ['privacy-policy', 'terms-of-use', 'about-us'].each do |page_name| text = t("pages.#{page_name.gsub('-', '_')}.title") path = "#{controller_name}/#{params[:id]}" active = path == "#{controller_name}/#{page_name}" links << (active ? text : link_to(text, page_path(page_name))) end raw links.join(' | ') end |
#sidenav(links_count = 2) ⇒ Object
22 23 24 25 26 27 |
# File 'app/helpers/voluntary/layout_helper.rb', line 22 def sidenav(links_count = 2) links_count ||= 2 result = context: , renderer: :twitter_sidenav, level: @twitter_sidenav_level result && result.scan('<a').length >= links_count ? result : '' end |