module LRD::ViewHelper
Public Instance Methods
block_to_partial(partial_name, options = {}, &block)
click to toggle source
Passes the supplied block to the named partial
# File lib/app/helpers/lrd_view_helper.rb, line 17 def block_to_partial(partial_name, options = {}, &block) # replace :id with :cssid and :class with :cssclass if options[:id] options[:cssid] = options.delete(:id) else options[:cssid] = "" if options[:cssid].nil? end if options[:class] options[:cssclass] = options.delete(:class) else options[:cssclass] = "" if options[:cssclass].nil? end options.merge!(:body => capture(&block)) render(:partial => partial_name, :locals => options) end
bool_checked(field)
click to toggle source
displays a checkmark if the field is set true
# 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)
click to toggle source
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
# File lib/app/helpers/lrd_view_helper.rb, line 36 def page_block(title = nil, options = {}, &block) block_to_partial('shared/block', options.merge(:title => title), &block).html_safe end
set_headline(headline)
click to toggle source
Stores a headline for later rendering by the layout
# File lib/app/helpers/lrd_view_helper.rb, line 5 def set_headline(headline) content_for(:headline, headline) end