Module: Bootstrap::TypographyHelper
- Included in:
- BaseHelper
- Defined in:
- app/helpers/bootstrap/typography_helper.rb
Defined Under Namespace
Classes: List
Instance Method Summary collapse
-
#list(options = {}, &block) ⇒ Object
Public: Bootstrap Typography List, wraps List class to generate ul or ol tags with html options.
Instance Method Details
#list(options = {}, &block) ⇒ Object
Public: Bootstrap Typography List, wraps List class to generate ul or ol
tags with html options.
options - options can be accepted by ul or ol.
:type - unordered, ordered, unstyled.
( default: 'unordered' )
:li_options - common li options in ul ( default: {} )
other options can be accepted by ul or ol.
block - yield with List object, used to add li tags into ul or ol.
Also can add nested lists.
Examples
= list(type: 'ordered') do |i|
- i.add('line 1')
- i.add('line 2')
- i.add(link_to('line 3', hello_world_path), class: "li-class")
- i.add 'line 4' + list(type: 'unstyled') do |nested_li|
- nested_li.add('line 4.1')
- nested_li.add('line 4.2')
# => <ol>
<li>line 1</li>
<li>line 2</li>
<li class="li-class">
<a href="/hello_world">line 3</a>
</li>
<li>
line 4
<ul class="unstyled">
<li>line 4.1</li>
<li>line 4.2</li>
</ul>
</li>
</ol>
Returns html content of the list.
100 101 102 103 104 |
# File 'app/helpers/bootstrap/typography_helper.rb', line 100 def list( = {}, &block) builder = List.new(self, ) capture(builder, &block) if block_given? builder.to_s end |