Class: Jekyll::AttendeasePlugin::PortalNavigationTag
- Inherits:
-
Liquid::Block
- Object
- Liquid::Block
- Jekyll::AttendeasePlugin::PortalNavigationTag
- Defined in:
- lib/jekyll/attendease_plugin/tags.rb
Instance Method Summary collapse
-
#initialize(tag_name, params, tokens) ⇒ PortalNavigationTag
constructor
A new instance of PortalNavigationTag.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, params, tokens) ⇒ PortalNavigationTag
Returns a new instance of PortalNavigationTag.
86 87 88 89 90 91 92 93 |
# File 'lib/jekyll/attendease_plugin/tags.rb', line 86 def initialize(tag_name, params, tokens) super @options = {} params.split(/\s/).each do |keypair| opt = keypair.split('=') @options[opt[0]] = opt[1] if opt.length == 2 end end |
Instance Method Details
#render(context) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/jekyll/attendease_plugin/tags.rb', line 95 def render(context) portal_pages = context.registers[:site].data['portal_pages'] nav = [] if portal_pages.is_a?(Array) portal_pages.sort! { |a, b| a['weight'] <=> b['weight'] } portal_pages.select { |p| p['top_level'] }.each do |page| if page['active'] && !page['hidden'] template = Liquid::Template.parse(super) template.assigns['page'] = page nav << template.render end end nav.join("\n") else '' end end |