Module: RailsViewHelpers::HtmlHelper
- Defined in:
- app/helpers/rails_view_helpers/html_helper.rb
Instance Method Summary collapse
-
#bln(bool, true_string = "✔".html_safe, false_string = nbsp) ⇒ Object
Displays a check-mark (✔) when bln is
true
elsenbsp
. -
#body_tag(options = {}, &block) ⇒ String
Includes controller and action name as data attributes.
-
#nbsp(count = 1) ⇒ String
Returns one or more non-breaking spaces ( ) marked
html_safe
. -
#td_bln(*args) ⇒ String
Same as
bln
but wrapped in a TD and centered (w/rail_view_helper.css). - #th_actions(*args) ⇒ Object
Instance Method Details
#bln(bool, true_string = "✔".html_safe, false_string = nbsp) ⇒ Object
Displays a check-mark (✔) when bln is true
else nbsp
.
35 36 37 38 39 40 41 |
# File 'app/helpers/rails_view_helpers/html_helper.rb', line 35 def bln(bool, true_string="✔".html_safe, false_string=nbsp) if bool true_string else false_string end end |
#body_tag(options = {}, &block) ⇒ String
Includes controller and action name as data attributes.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/helpers/rails_view_helpers/html_helper.rb', line 13 def body_tag(={}, &block) = () .delete(:class) if [:class].blank? [:data] ||= {} [:data][:controller] = controller.controller_name [:data][:action] = controller.action_name content_tag(:body, ) do yield end end |
#nbsp(count = 1) ⇒ String
Returns one or more non-breaking spaces ( ) marked html_safe
.
74 75 76 |
# File 'app/helpers/rails_view_helpers/html_helper.rb', line 74 def nbsp(count=1) (' ' * count).html_safe end |
#td_bln(*args) ⇒ String
Same as bln
but wrapped in a TD and centered (w/rail_view_helper.css)
48 49 50 51 52 53 |
# File 'app/helpers/rails_view_helpers/html_helper.rb', line 48 def td_bln(*args) = (args.) = ensure_class(, 'c') content_tag(:td, bln(*args), ) end |
#th_actions(*args) ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'app/helpers/rails_view_helpers/html_helper.rb', line 56 def th_actions(*args) = (args.) colspan = args.shift || 1 text = args.shift || 'Actions' [:colspan] = colspan [:class] = 'c' if [:class].empty? content_tag(:th, text, ) end |