Module: BootstrapBaseHelper
- Extended by:
- ActiveSupport::Concern
- Includes:
- BootstrapHelper
- Defined in:
- app/helpers/bootstrap_base_helper.rb
Defined Under Namespace
Classes: List
Instance Method Summary collapse
-
#c_image_tag(source, options = {}) ⇒ Object
圆形图片 和 image_tag 一样用.
-
#glyph_icon(*names) ⇒ Object
glyph_icon bootstrap icon.
-
#list(*args, &block) ⇒ Object
bootstrap Typography List.
-
#p_image_tag(source, options = {}) ⇒ Object
带边框图片 和 image_tag 一样用.
-
#r_image_tag(source, options = {}) ⇒ Object
Images 圆角图片 和 image_tag 一样用.
Methods included from BootstrapHelper
#div, #javascript_include_tag_with_p, #merge_predef_class
Instance Method Details
#c_image_tag(source, options = {}) ⇒ Object
圆形图片 和 image_tag 一样用
124 125 126 |
# File 'app/helpers/bootstrap_base_helper.rb', line 124 def c_image_tag(source, ={}) image_tag(source, merge_predef_class('img-circle', )) end |
#glyph_icon(*names) ⇒ Object
glyph_icon bootstrap icon
Example:
glyph_icon(:plus)
# => <i class="icon-plus"></i>
glyph_icon(:align_justify, :white)
# => <i class="icon-align-justify icon-white"></i>
142 143 144 |
# File 'app/helpers/bootstrap_base_helper.rb', line 142 def glyph_icon(*names) content_tag :i, nil, :class => names.flatten.map { |name| "icon-#{name.to_s.gsub('_', '-')}" } end |
#list(*args, &block) ⇒ Object
bootstrap Typography List
collection - content to be displayed, can be a nested array like this:
[
'list1',
'list2',
{'list3' => [
'sublist1',
'sublist2',
{'sublist3' => [
'sublist3.1',
'sublist3.2'
]}
]},
'list4'
]
options - a hash
type: unordered, ordered, unstyled. default: unordered
the other html options can be accepted by ul or ol
li_options: common li options in ul
94 95 96 97 98 |
# File 'app/helpers/bootstrap_base_helper.rb', line 94 def list(*args, &block) builder = List.new(self, *args) capture(builder, &block) if block_given? builder.to_s end |
#p_image_tag(source, options = {}) ⇒ Object
带边框图片 和 image_tag 一样用
130 131 132 |
# File 'app/helpers/bootstrap_base_helper.rb', line 130 def p_image_tag(source, ={}) image_tag(source, merge_predef_class('img-polaroid', )) end |
#r_image_tag(source, options = {}) ⇒ Object
Images 圆角图片 和 image_tag 一样用
118 119 120 |
# File 'app/helpers/bootstrap_base_helper.rb', line 118 def r_image_tag(source, ={}) image_tag(source, merge_predef_class('img-rounded', )) end |