Module: BootstrapTextHelper
- Defined in:
- app/helpers/bootstrap_text_helper.rb
Overview
RAILS BOOTSTRAP ENGINE
Bootstrap Text Helpers
Copyright 2012-2013 Luiz Eduardo de Oliveira Fonseca, Agência Orangeweb
Licensed under The MIT License
Instance Method Summary collapse
- #boolean_badge(value, title_true = "Sim", title_false = "Não") ⇒ Object
-
#icon_text(icon, text) ⇒ Object
Exibe um span com um ícone e um texto associados.
-
#page_header(&block) ⇒ Object
Cria o Page Header.
- #page_section(title, options = {}) ⇒ Object
- #page_section_fluid(title, options = {}) ⇒ Object
-
#star_icon(val) ⇒ Object
Exibe uma Estrela de acordo com o valor de um campo booleano.
-
#star_rating(val = 0) ⇒ Object
Star Rating.
Instance Method Details
#boolean_badge(value, title_true = "Sim", title_false = "Não") ⇒ Object
52 53 54 55 56 57 58 |
# File 'app/helpers/bootstrap_text_helper.rb', line 52 def boolean_badge(value, title_true = "Sim", title_false = "Não") if value then badge_success title_true else badge_important title_false end end |
#icon_text(icon, text) ⇒ Object
Exibe um span com um ícone e um texto associados
<span><i class=“icon icon-?”></i> Text</span>
27 28 29 |
# File 'app/helpers/bootstrap_text_helper.rb', line 27 def icon_text(icon, text) raw content_tag(:span, icon(icon.to_sym) + " #{text}") end |
#page_header(&block) ⇒ Object
Cria o Page Header
66 67 68 69 70 71 |
# File 'app/helpers/bootstrap_text_helper.rb', line 66 def page_header &block = {} if [:class].nil? then [:class] = "" end [:class].insert(-1, " page-header ") content_tag :div, capture(&block), end |
#page_section(title, options = {}) ⇒ Object
90 91 92 93 94 |
# File 'app/helpers/bootstrap_text_helper.rb', line 90 def page_section title, = {} if [:class].nil? then [:class] = "" end [:class].insert(-1, " row-fluid") raw content_tag(:div, (content_tag(:h3, title) << content_tag(:br)), ) end |
#page_section_fluid(title, options = {}) ⇒ Object
79 80 81 82 83 |
# File 'app/helpers/bootstrap_text_helper.rb', line 79 def page_section_fluid title, = {} if [:class].nil? then [:class] = "" end [:class].insert(-1, " row-fluid") raw content_tag(:div, (content_tag(:hr) << content_tag(:h3, title) << content_tag(:br)), ) end |
#star_icon(val) ⇒ Object
Exibe uma Estrela de acordo com o valor de um campo booleano
38 39 40 41 42 43 44 |
# File 'app/helpers/bootstrap_text_helper.rb', line 38 def star_icon(val) if val then content_tag(:i, "", :class => "icon icon-star star-full-color") else content_tag(:i, "", :class => "icon icon-star-empty star-empty-color") end end |
#star_rating(val = 0) ⇒ Object
Star Rating
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'app/helpers/bootstrap_text_helper.rb', line 101 def val=0 = case val when 0 then 0 when 01..05 then 05 when 06..10 then 10 when 11..15 then 15 when 16..20 then 20 when 21..25 then 25 when 26..30 then 30 when 31..35 then 35 when 36..40 then 40 when 41..45 then 45 when 46..50 then 50 else -1 end if .to_i >= 0 then content_tag :span, "", :class => "star-rating rating-#{}", :rel => "tooltip", :title => "#{} estrelas" else content_tag :span, "!!! Entre com um valor entre 0 e 50 (#{}) !!!" end end |