lib/jqr-helpers/helpers.rb in jqr-helpers-1.0.32 vs lib/jqr-helpers/helpers.rb in jqr-helpers-1.0.33
- old
+ new
@@ -23,15 +23,15 @@
# HTML <li> tag.
# @param options [Hash] the options if a URL is given.
def panel(title, url_or_options={}, options={}, &block)
if url_or_options.is_a?(String)
url = url_or_options
- content = ''
+ content = nil
id = nil
else
options = url_or_options
- content = yield
+ content = block
id = Helpers._random_string
url = '#' + id
end
options.merge!(:id => id)
panels << {
@@ -243,14 +243,14 @@
# Print a tab container. This expects a block, which will be passed a
# PanelRenderer object. Panels can be local (with content) or remote
# (with a URL).
# @example
# <%= tab_container {:collapsible => true}, {:class => 'my-tabs}' do |r| %>
- # <%= r.panel 'Tab 1', do %>
+ # <% r.panel 'Tab 1' do %>
# My tab content here
# <% end %>
- # <%= r.panel 'Tab 2', 'http://www.foobar.com/' %>
+ # <% r.panel 'Tab 2', 'http://www.foobar.com/' %>
# <% end %>
# @param options [Hash] options to pass to the jQuery tabs() method.
# @param html_options [Hash] options to pass to the tab container element
# itself.
def tab_container(options={}, html_options={}, &block)
@@ -269,10 +269,10 @@
end
raw s2
end
s3 = renderer.panels.inject('') do |sum, panel|
if panel[:options][:id]
- sum = sum + content_tag(:div, panel[:content], panel[:options])
+ sum = sum + content_tag(:div, panel[:options], &panel[:content])
end
sum
end
s + raw(s3)
end