lib/masterview/directives/radio_button.rb in masterview-0.2.5 vs lib/masterview/directives/radio_button.rb in masterview-0.3.0
- old
+ new
@@ -1,34 +1,23 @@
module MasterView
module Directives
# create radio_button helper, quoting object and method if necessary
# merging in any html options specified
- class Radio_button < MasterView::DirectiveBase
- def stag(dcs)
- #eat
- end
+ class RadioButton < MasterView::DirectiveBase
- def etag(dcs)
- args = parse_attr_value
- obj = args[0]
- method = args[1]
- tag_value = args[2]
+ metadata :priority => :default,
+ :category => 'form',
+ :description => 'Replaces the element with a Rails radio_button helper.',
+ :element_usage => 'input'
- obj = quote_if(obj)
- method = quote_if(method)
+ attr_arg :name, :quote => true
+ attr_arg :method, :quote => true
+ attr_arg :value
+ attr_arg :options, :append_element_attrs => [:common_html]
- options = {}
- options.merge! common_html_options(attrs_lck)
- remove_strings_from_attr_value!
- merge_hash_attr_value!(0, options)
-
- a = []
- a << 'radio_button '+ obj
- a << method
- a << tag_value
- a << attr_value unless attr_value.strip.empty?
- erb_content(a.join(', '))
+ event :element do
+ render erb_content( 'radio_button', :name, :method, :value, :options )
end
end
end
end