Module: LRD::ViewHelper
- Defined in:
- lib/app/helpers/lrd_view_helper.rb
Instance Method Summary collapse
-
#block_to_partial(partial_name, options = {}, &block) ⇒ Object
Passes the supplied block to the named partial.
-
#bool_checked(field) ⇒ Object
displays a checkmark if the field is set true.
-
#page_block(title = nil, options = {}, &block) ⇒ Object
a standardized view helper that renders a box with an optional title.
-
#set_headline(headline) ⇒ Object
Stores a headline for later rendering by the layout.
Instance Method Details
#block_to_partial(partial_name, options = {}, &block) ⇒ Object
Passes the supplied block to the named partial
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/app/helpers/lrd_view_helper.rb', line 17 def block_to_partial(partial_name, = {}, &block) # replace :id with :cssid and :class with :cssclass if [:id] [:cssid] = .delete(:id) else [:cssid] = "" if [:cssid].nil? end if [:class] [:cssclass] = .delete(:class) else [:cssclass] = "" if [:cssclass].nil? end .merge!(:body => capture(&block)) render(:partial => partial_name, :locals => ) end |
#bool_checked(field) ⇒ Object
displays a checkmark if the field is set true
10 11 12 13 |
# File 'lib/app/helpers/lrd_view_helper.rb', line 10 def bool_checked(field) filename = field ? "check.png" : "blank.gif" image_tag(filename, :alt => "yes", :size => "16x16") end |
#page_block(title = nil, options = {}, &block) ⇒ Object
a standardized view helper that renders a box with an optional title. The standard partial for it is in views/shared/_page_block.html.haml
36 37 38 |
# File 'lib/app/helpers/lrd_view_helper.rb', line 36 def page_block(title = nil, = {}, &block) block_to_partial('shared/block', .merge(:title => title), &block).html_safe end |
#set_headline(headline) ⇒ Object
Stores a headline for later rendering by the layout
5 6 7 |
# File 'lib/app/helpers/lrd_view_helper.rb', line 5 def set_headline(headline) content_for(:headline, headline) end |