lib/formstrap/form_builder.rb in formstrap-0.2.1 vs lib/formstrap/form_builder.rb in formstrap-0.3.0
- old
+ new
@@ -9,10 +9,21 @@
def association_field(attribute, options = {})
render_input(:association, attribute, options)
end
+ def preview_button(value = nil, options = {}, &block)
+ default_options = {
+ data: {
+ controller: "preview",
+ "preview-url-value": options[:url]
+ },
+ type: nil
+ }
+ button value, default_options.deep_merge(options.except(:url)), &block
+ end
+
def checkbox(attribute, formstrap: true, **options)
if formstrap
render_input :checkbox, attribute, options
else
check_box attribute, options
@@ -99,9 +110,13 @@
if formstrap
render_input :password, attribute, options
else
password_field attribute, options
end
+ end
+
+ def repeater_for(attribute, options = {}, &block)
+ @template.render("formstrap/repeater", form: self, attribute: attribute, **options, &block)
end
def redactorx(attribute, options = {})
render_input(:redactorx, attribute, options)
end