Sha256: b542762b659eff0823989892a77d9818389779052949014de28159931da28f03
Contents?: true
Size: 642 Bytes
Versions: 2
Compression:
Stored size: 642 Bytes
Contents
require 'push_type/tag_list_query' module PushType class TagListField < ArrayField def template @opts[:template] || 'tag_list' end def html_options { multiple: true, placeholder: 'Tags...' }.merge(super) end def to_json(val) return if val.blank? super.reject(&:blank?) end def from_json(val) return if val.blank? super.reject(&:blank?) end initialized_on_node do |object, field| object.define_singleton_method "all_#{ field.name }".to_sym do |*args| TagListQuery.new(field.name, object.name.underscore.to_sym).all *args end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
push_type_core-0.5.0.alpha.2 | app/fields/push_type/tag_list_field.rb |
push_type_core-0.5.0.alpha.1 | app/fields/push_type/tag_list_field.rb |