Class: TwitterBootstrapBuilder::Builders::NavContainerBuilder
- Inherits:
-
Base
- Object
- Base
- TwitterBootstrapBuilder::Builders::NavContainerBuilder
show all
- Defined in:
- lib/twitter_bootstrap_builder/builders/nav_container_builder.rb
Instance Attribute Summary
Attributes inherited from Base
#block, #options, #template
Instance Method Summary
collapse
Methods inherited from Base
#html_safe, #initialize
Instance Method Details
#active_link_to(*args, &block) ⇒ Object
21
22
23
|
# File 'lib/twitter_bootstrap_builder/builders/nav_container_builder.rb', line 21
def active_link_to(*args, &block)
Tag.block(:li, template.link_to(*args, &block), class: 'active').html_safe
end
|
#custom(&block) ⇒ Object
33
34
35
|
# File 'lib/twitter_bootstrap_builder/builders/nav_container_builder.rb', line 33
def custom(&block)
Tag.block(:li, Tag.block(:a, template.capture(self, &block))).html_safe
end
|
#divider ⇒ Object
25
26
27
|
# File 'lib/twitter_bootstrap_builder/builders/nav_container_builder.rb', line 25
def divider
Tag.block(:li, Divider.vertical).html_safe
end
|
#dropdown_link(text, &block) ⇒ Object
29
30
31
|
# File 'lib/twitter_bootstrap_builder/builders/nav_container_builder.rb', line 29
def dropdown_link(text, &block)
Tag.block(:li, DropDownLinkBuilder.new(template, text: text, &block).html_safe).html_safe
end
|
#link_to(*args, &block) ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/twitter_bootstrap_builder/builders/nav_container_builder.rb', line 12
def link_to(*args, &block)
options = args.select { |a| a.is_a?(Hash) }.first || {}
if options[:active_if].is_a?(Proc) ? options[:active_if].call : options[:active_if]
active_link_to(*args, &block)
else
Tag.block(:li, template.link_to(*args, &block)).html_safe
end
end
|
#to_s ⇒ Object
5
6
7
8
9
10
|
# File 'lib/twitter_bootstrap_builder/builders/nav_container_builder.rb', line 5
def to_s
nav_container = NavContainer.new
nav_container.pull_right if options[:align] == :right
nav_container.append template.capture(self, &block) if block
nav_container.to_s
end
|