Skip to content

Commit

Permalink
[#748] fix create-button attribute handling
Browse files Browse the repository at this point in the history
  • Loading branch information
al2o3cr committed Sep 21, 2011
1 parent 44bf29c commit a0c3cf0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions hobo/lib/hobo/rapid/taglibs/rapid_forms.dryml
Expand Up @@ -643,11 +643,17 @@ All of the standard ajax attributes are supported (see the main taglib documenti
new.set_creator(current_user)
if can_create?(new)
label ||= ht("#{new.class.to_s.underscore}.actions.new", :default=>"New #{new.class.model_name.human}")
ajax_attributes = { :message => message }
class_name = new.class.name.underscore
ajax_attributes[:params] = { class_name => fields } unless fields.empty?
params ||= params || {}
params = params.merge(class_name => fields) unless fields.blank?

ajax_attributes, html_attributes = attributes.partition_hash(Hobo::Rapid::Helper::AJAX_ATTRS)

ajax_attributes.reverse_merge!(:message => message, :params => params)
func = ajax_updater(object_url(new.class, :method => :post), update, ajax_attributes)
element :input, add_classes(attributes.merge(:type =>'button', :onclick => func, :value => label),
html_attributes.reverse_merge!(:type =>'button', :onclick => func, :value => label)

element :input, add_classes(html_attributes,
"button create-button create-#{class_name}-button"), nil, true, true
end
%></def>
Expand Down

0 comments on commit a0c3cf0

Please sign in to comment.