Class: Clot::LinksBlock
- Inherits:
-
Liquid::Block
- Object
- Liquid::Block
- Clot::LinksBlock
show all
- Includes:
- TagHelper
- Defined in:
- lib/clot/nav_bar.rb
Instance Method Summary
collapse
Methods included from TagHelper
#resolve_value, #split_params
Constructor Details
#initialize(name, params, tokens) ⇒ LinksBlock
Returns a new instance of LinksBlock.
113
114
115
116
|
# File 'lib/clot/nav_bar.rb', line 113
def initialize(name, params, tokens)
@params = split_params(params)
super
end
|
Instance Method Details
#get_nav_body(context) ⇒ Object
118
119
120
121
122
123
124
125
|
# File 'lib/clot/nav_bar.rb', line 118
def get_nav_body(context)
context.stack do
LinksBlock.link_block ||= 1
context['block_id'] = LinksBlock.link_block += 1
context['tag_factory'] = @tag_factory
render_all(@nodelist, context) * ""
end
end
|
#render(context) ⇒ Object
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
# File 'lib/clot/nav_bar.rb', line 127
def render(context)
@tag_factory = GenericTagFactory
@params.each do |pair|
pair_data = pair.split ":"
case pair_data[0]
when "factory_name" then @tag_factory = pair_data[1].constantize
end
end
result = @tag_factory[:list_open_tag] || ""
context['tag_factory'] = @tag_factory
result += get_nav_body(context)
result += @tag_factory[:list_close_tag] || ""
result
end
|