Sha256: 0df620e1925bcba49907a4385c738519dae257977d09089948d10346a26a5584
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
module KirguduBase class DynamicPages::FormProperty < ::KirguduBase::DynamicPages::Property mergeable_attributes :input_type, :max_length, :read_only, :events fixable_attributes :events validates_presence_of :name, :input_type validates_inclusion_of :input_type, in: ::KirguduBase::DynamicPages::Enums::SUPPORTED_INPUT_TYPES, allow_nil: true validates_presence_of :data_source, if: :must_have_data_source? validates_inclusion_of :read_only, in: [:true, :false], allow_nil: true def initialize(options = {}) self.input_type = :text_edit self.max_length = 0 self.read_only = :false self.events = nil super(options) end attr_accessor :input_type attr_accessor :max_length attr_accessor :read_only attr_accessor :events def to_external_hash(options = {}) options ||= {} options.merge!({ }) super(options) end def events_for_json self.events ? self.events.map { |e| e.to_external_hash(nil) } : {} end def must_have_data_source? [:chosen_select, :select, :autocomplete_with_id, :autocomplete].include?(self.input_type) end end end
Version data entries
3 entries across 3 versions & 1 rubygems