Sha256: a92baa671ee07f0f82cc3161a7b89c5820d65e54ec24847fd68558bee6a3a4f3
Contents?: true
Size: 898 Bytes
Versions: 1
Compression:
Stored size: 898 Bytes
Contents
module AngularSprinkles module Helpers module BindFormForHelper ## # bind_form_for # # Wraps the form_for helper so that form submission can be bound # an Angular service function. Accepts an additional argument which # is the name of a service. Two arguments are passed to the service: # the object and the Angular representation of the form. def bind_form_for(record, submit_callback, options = {}, &block) form_name = ObjectKeyWrapper.new('form', JavaScript::NoOp) html_options = { 'name' => form_name, 'ng-submit' => service(submit_callback, record.bind, form_name) }.merge(options[:html] || {}) augmented_options = options.merge(url: "", method: "", html: html_options) form_for(record, augmented_options, &block).gsub('action="" ', '').html_safe end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
angular_sprinkles-0.2.7 | lib/angular_sprinkles/helpers/bind_form_for_helper.rb |