Class: Locomotive::Steam::Liquid::Tags::Nav
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Locomotive::Steam::Liquid::Tags::Nav
- Defined in:
- lib/locomotive/steam/liquid/tags/nav.rb
Overview
Display the children pages of the site, current page or the parent page. If not precised, nav is applied on the current page. The html output is based on the ul/li tags.
Usage:
nav site % => <ul class=“nav”><li class=“on”><a href=“/features”>Features</a></li></ul>
{% nav site, no_wrapper: true, exclude: ‘contact|about’, id: ‘main-nav’, class: ‘nav’, active_class: ‘on’ }
Constant Summary collapse
- Syntax =
/(#{::Liquid::VariableSignature}+)/o
Instance Attribute Summary collapse
-
#current_locale ⇒ Object
Returns the value of attribute current_locale.
-
#current_page ⇒ Object
Returns the value of attribute current_page.
-
#current_site ⇒ Object
Returns the value of attribute current_site.
-
#page_repository ⇒ Object
Returns the value of attribute page_repository.
-
#services ⇒ Object
Returns the value of attribute services.
Instance Method Summary collapse
-
#initialize(tag_name, markup, options) ⇒ Nav
constructor
A new instance of Nav.
- #render(context) ⇒ Object
Constructor Details
Instance Attribute Details
#current_locale ⇒ Object
Returns the value of attribute current_locale.
19 20 21 |
# File 'lib/locomotive/steam/liquid/tags/nav.rb', line 19 def current_locale @current_locale end |
#current_page ⇒ Object
Returns the value of attribute current_page.
19 20 21 |
# File 'lib/locomotive/steam/liquid/tags/nav.rb', line 19 def current_page @current_page end |
#current_site ⇒ Object
Returns the value of attribute current_site.
19 20 21 |
# File 'lib/locomotive/steam/liquid/tags/nav.rb', line 19 def current_site @current_site end |
#page_repository ⇒ Object
Returns the value of attribute page_repository.
19 20 21 |
# File 'lib/locomotive/steam/liquid/tags/nav.rb', line 19 def page_repository @page_repository end |
#services ⇒ Object
Returns the value of attribute services.
19 20 21 |
# File 'lib/locomotive/steam/liquid/tags/nav.rb', line 19 def services @services end |
Instance Method Details
#render(context) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/locomotive/steam/liquid/tags/nav.rb', line 31 def render(context) self.set_vars_from_context(context) set_template_if_asked # get all the children of a source: site (index page), parent or page. pages = children_of(fetch_starting_page) _output = self.build_entries_output(pages, context) if self.no_wrapper? _output else self.render_tag(:nav, id: @_options[:id], css: @_options[:class]) do self.render_tag(:ul) { _output } end end end |