lib/cm_admin/models/form_field.rb in cm-admin-0.9.1 vs lib/cm_admin/models/form_field.rb in cm-admin-1.0.0

- old
+ new

@@ -1,11 +1,16 @@ module CmAdmin module Models class FormField - attr_accessor :field_name, :label, :header, :input_type, :collection, :disabled, :helper_method, :placeholder, :display_if, :html_attr - VALID_INPUT_TYPES = [:integer, :decimal, :string, :single_select, :multi_select, :date, :date_time, :text, :single_file_upload, :multi_file_upload, :hidden, :rich_text].freeze + attr_accessor :field_name, :label, :header, :input_type, :collection, :disabled, :helper_method, + :placeholder, :display_if, :html_attr, :target + VALID_INPUT_TYPES = %i[ + integer decimal string single_select multi_select date date_time text + single_file_upload multi_file_upload hidden rich_text check_box radio_button + ].freeze + def initialize(field_name, input_type, attributes = {}) @field_name = field_name set_default_values attributes.each do |key, value| self.send("#{key.to_s}=", value) @@ -18,9 +23,10 @@ self.disabled = false self.label = self.field_name.to_s.titleize self.input_type = :string self.placeholder = "Enter #{self.field_name.to_s.downcase.gsub('_', ' ')}" self.html_attr = {} + self.target = {} end end end end