Class: FiltrosPersonalizados::FieldsPadroes::Hora

Inherits:
Field
  • Object
show all
Defined in:
lib/filtros_personalizados/fields_padroes/hora.rb

Constant Summary

Constants inherited from Field

Field::DIFERENTE, Field::ENTRE, Field::IGUAL, Field::MAIOR_QUE, Field::MENOR_QUE, Field::NENHUM, Field::TODOS

Instance Attribute Summary

Attributes inherited from Field

#association, #autocomplete_path, #collection, #collection_id, #collection_name, #field_name, #field_type, #is_open, #noactions, #options, #partial_name, #relation, #tipo_selecionado, #values

Instance Method Summary collapse

Methods inherited from Field

#caption, #initialize

Constructor Details

This class inherits a constructor from FiltrosPersonalizados::FieldsPadroes::Field

Instance Method Details

#acoes_disponiveisObject



5
6
7
# File 'lib/filtros_personalizados/fields_padroes/hora.rb', line 5

def acoes_disponiveis
  [ENTRE]
end

#fileObject



17
18
19
# File 'lib/filtros_personalizados/fields_padroes/hora.rb', line 17

def file
  "personalizaveis/hora.html.erb"
end

#selecaoObject



21
22
23
# File 'lib/filtros_personalizados/fields_padroes/hora.rb', line 21

def selecao
  self.values.present? ? "#{self.caption}: #{ENTRE.downcase} #{values.first} e #{values.last}" : ""
end

#whereObject



9
10
11
12
13
14
15
# File 'lib/filtros_personalizados/fields_padroes/hora.rb', line 9

def where
  if values.present?
    "#{self.relation}.#{self.field_name} between '#{values.first}' and '#{values.last}'"
  else
    ""
  end
end