Class: FiltrosPersonalizados::FieldsPadroes::Field
- Inherits:
-
Object
- Object
- FiltrosPersonalizados::FieldsPadroes::Field
- Defined in:
- lib/filtros_personalizados/fields_padroes/field.rb
Direct Known Subclasses
Boolean, Date, Hora, Idade, Integer, Select2, String, StringOptions, TrueOrFalse
Constant Summary collapse
- TODOS =
"Prenchidos"- NENHUM =
"Não preenchidos"- IGUAL =
"Igual a"- DIFERENTE =
"Diferente de"- ENTRE =
"Entre"- MAIOR_QUE =
"Maior que"- MENOR_QUE =
"Menor que"
Instance Attribute Summary collapse
-
#association ⇒ Object
Returns the value of attribute association.
-
#autocomplete_path ⇒ Object
Returns the value of attribute autocomplete_path.
-
#collection ⇒ Object
Returns the value of attribute collection.
-
#collection_id ⇒ Object
Returns the value of attribute collection_id.
-
#collection_name ⇒ Object
Returns the value of attribute collection_name.
-
#field_name ⇒ Object
Returns the value of attribute field_name.
-
#field_type ⇒ Object
Returns the value of attribute field_type.
-
#is_open ⇒ Object
Returns the value of attribute is_open.
-
#noactions ⇒ Object
Returns the value of attribute noactions.
-
#options ⇒ Object
Returns the value of attribute options.
-
#partial_name ⇒ Object
Returns the value of attribute partial_name.
-
#relation ⇒ Object
Returns the value of attribute relation.
-
#tipo_selecionado ⇒ Object
Returns the value of attribute tipo_selecionado.
-
#values ⇒ Object
Returns the value of attribute values.
Instance Method Summary collapse
- #caption ⇒ Object
-
#initialize(relation, field_name, args = {}) ⇒ Field
constructor
A new instance of Field.
Constructor Details
#initialize(relation, field_name, args = {}) ⇒ Field
Returns a new instance of Field.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 17 def initialize(relation, field_name, args={}) self.relation = relation self.field_name = field_name self.tipo_selecionado = args[:tipo_selecionado] self.values = args[:values] self.collection = args[:collection] self.collection_id = args[:collection_id] self.collection_name = args[:collection_name] self.partial_name = args[:partial_name] self.autocomplete_path= args[:autocomplete_path] self. = args[:options] self.noactions = args[:noactions] || [] if args[:association_relation].present? && args[:association_name].present? && args[:association_search].present? self.association = FiltrosPersonalizados::Association.new( args[:association_relation], args[:association_name], args[:association_search] ) end end |
Instance Attribute Details
#association ⇒ Object
Returns the value of attribute association.
5 6 7 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 5 def association @association end |
#autocomplete_path ⇒ Object
Returns the value of attribute autocomplete_path.
5 6 7 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 5 def autocomplete_path @autocomplete_path end |
#collection ⇒ Object
Returns the value of attribute collection.
5 6 7 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 5 def collection @collection end |
#collection_id ⇒ Object
Returns the value of attribute collection_id.
5 6 7 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 5 def collection_id @collection_id end |
#collection_name ⇒ Object
Returns the value of attribute collection_name.
5 6 7 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 5 def collection_name @collection_name end |
#field_name ⇒ Object
Returns the value of attribute field_name.
5 6 7 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 5 def field_name @field_name end |
#field_type ⇒ Object
Returns the value of attribute field_type.
5 6 7 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 5 def field_type @field_type end |
#is_open ⇒ Object
Returns the value of attribute is_open.
5 6 7 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 5 def is_open @is_open end |
#noactions ⇒ Object
Returns the value of attribute noactions.
5 6 7 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 5 def noactions @noactions end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 5 def @options end |
#partial_name ⇒ Object
Returns the value of attribute partial_name.
5 6 7 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 5 def partial_name @partial_name end |
#relation ⇒ Object
Returns the value of attribute relation.
5 6 7 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 5 def relation @relation end |
#tipo_selecionado ⇒ Object
Returns the value of attribute tipo_selecionado.
5 6 7 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 5 def tipo_selecionado @tipo_selecionado end |
#values ⇒ Object
Returns the value of attribute values.
5 6 7 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 5 def values @values end |
Instance Method Details
#caption ⇒ Object
38 39 40 41 |
# File 'lib/filtros_personalizados/fields_padroes/field.rb', line 38 def caption I18n.t("activerecord.attributes.#{self.relation.singularize}.#{self.field_name}", default: I18n.t(self.field_name)) rescue self.field_name end |