visual_condition_builder 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97cee479630d485dd9d7c81df722e6a07bfbb701
4
- data.tar.gz: 5355a6541eead0031d7d0add3bf1be7f3f1278bd
3
+ metadata.gz: ccc5de806d1a4cf9ef077225054ebe26c6f80150
4
+ data.tar.gz: 735e442bfbe57814e71e4fd4f218e99c0045e365
5
5
  SHA512:
6
- metadata.gz: f9681137a3b7c9efccc7006fb8cc5c69a7441a43ed753265813629f0d6686d3347b8c588719545414311b749902564ca0c33c2e187b7c80f6e2486b639aaa5c6
7
- data.tar.gz: 65b2df904ab1e9ab8cf7fd54910abe039d813f489cf47930b0f0a8138775b530baef2000abe792ad82ae7b2644f9c80bf7da1746a4119869a7f692021aedea51
6
+ metadata.gz: 52a80f4a49e6d7edce309174e05a3bdae69cbf247878ea652f3e2fbfc811a4055c63de213167dc57c26b42bc55900b25ee22903fb92a743cbe7ac140fe2c3d45
7
+ data.tar.gz: 14337527f974dd0df23961a446b3648cd0eb49a826c615b93deaedc377f86e8d2159a2d764e743f14aed5746a15bc8caede33b4ecb7e652a36b6b963edadf4d6
@@ -0,0 +1,71 @@
1
+ pt-BR:
2
+ condition_builder:
3
+ dropdown: 'Filtros'
4
+ operators:
5
+ between: 'Entre ... e ...'
6
+ today: 'Hoje'
7
+ yesterday: 'Ontem'
8
+ tomorrow: 'Amanhã'
9
+ this_week: 'Essa Semana'
10
+ last_week: 'Semana Passada'
11
+ next_week: 'Próxima xxx Semana'
12
+ eq: 'Igual'
13
+ not_eq: 'Diferente'
14
+ matches: 'Parecido'
15
+ does_not_match: 'Não é Parecido'
16
+ lt: 'Menor'
17
+ gt: 'Maior'
18
+ lteq: 'Menor ou Igual'
19
+ gteq: 'Maior ou Igual'
20
+ in: 'Possui todos'
21
+ not_in: 'Não possui todos'
22
+ cont: 'Contém'
23
+ not_cont: 'Não Contém'
24
+ cont_any: 'Contém algum'
25
+ not_cont_any: 'Não Contém algum'
26
+ cont_all: 'Contém todos'
27
+ not_cont_all: 'Não contém todos'
28
+ start: 'Começa com'
29
+ not_start: 'Não começa com'
30
+ end: 'Termina com'
31
+ not_end: 'Não termina com'
32
+ true: 'Verdadeiro'
33
+ not_true: 'Não Verdadeiro'
34
+ false: 'Falso'
35
+ not_false: 'Não Falso'
36
+ present: 'Presente'
37
+ blank: 'Não Presente'
38
+ null: 'Nulo'
39
+ not_null: 'Não Nulo'
40
+ placeholder:
41
+ operators: 'Selecione um operador'
42
+ values: 'Selecione um valor'
43
+ dictionaries:
44
+ fluxo_de_trabalho: 'Fluxo de Trabalho'
45
+ obrigacao: 'Obrigação'
46
+ condition_dictionaries:
47
+ fluxo_de_trabalho:
48
+ descricao: 'Descrição'
49
+ obrigacao:
50
+ nome: 'Nomezinho'
51
+ obrigacao:
52
+ nome: 'Nome'
53
+ descricao: 'Descrição'
54
+ periodicidade: 'Periodicidade'
55
+ obrigatoriedade: 'Obrigatoriedade'
56
+ ambito: 'Âmbito'
57
+ legislacao: 'Legislação'
58
+ centralizacao: 'Centralização'
59
+ tipo: 'Tipo'
60
+ apuracao_lucro: 'Apuração de Lucro'
61
+ exigido_para_simples_nacional: 'Simples Nacional?'
62
+ exigido_para_mei: 'MEI?'
63
+ dt_inicio: 'Data início'
64
+ dt_fim: 'Data fim'
65
+ estado_id: 'Estado'
66
+ municipio_id: 'Município'
67
+ conta_id: 'Conta'
68
+ fluxo_de_trablaho_id: 'Fluxo de Trabalho Padrão'
69
+ meses_entrega: 'Mês(es) de Entrega'
70
+ cnaes: 'CNAEs'
71
+ meu_campo: 'Meu Campo'
@@ -4,17 +4,32 @@ module VisualConditionBuilder
4
4
  ransack_q = {}
5
5
  conditions = params.is_a?(Array) ? params : JSON.parse(params ||= '[]')
6
6
  conditions.map do |p|
7
- #TODO: Verificar se o código deve ser inserido com inteligência para juntar os campos de mesmo operador
8
- if ransack_q["#{p[0]}_#{p[1]}"].present?
9
- old_value = ransack_q["#{p[0]}_#{p[1]}"]
10
- ransack_q.delete("#{p[0]}_#{p[1]}")
11
- ransack_q["#{p[0]}_in"] = []
12
- ransack_q["#{p[0]}_in"] << old_value
13
- ransack_q["#{p[0]}_in"] << p[2]
14
- else
15
- ransack_q["#{p[0]}_#{p[1]}"] = p[2]
7
+ case p[1].to_s.downcase.to_sym
8
+ when :between
9
+ if p[2].is_a?(Array)
10
+ ransack_q["#{p[0]}_gteq"] = p[2][0] if p[2][0]
11
+ ransack_q["#{p[0]}_lteq"] = p[2][1] if p[2][1]
12
+ end
13
+ when :today
14
+ ransack_q["#{p[0]}_eq"] = Date.today
15
+ when :yesterday
16
+ ransack_q["#{p[0]}_eq"] = Date.yesterday
17
+ when :tomorrow
18
+ ransack_q["#{p[0]}_eq"] = Date.tomorrow
19
+ when :this_week
20
+ ransack_q["#{p[0]}_gteq"] = Date.today.beginning_of_week
21
+ ransack_q["#{p[0]}_lteq"] = Date.today.end_of_week
22
+ when :last_week
23
+ ransack_q["#{p[0]}_gteq"] = 1.week.ago.beginning_of_week
24
+ ransack_q["#{p[0]}_lteq"] = 1.week.ago.end_of_week
25
+ when :next_week
26
+ ransack_q["#{p[0]}_gteq"] = Date.today.next_week.beginning_of_week
27
+ ransack_q["#{p[0]}_lteq"] = Date.today.next_week.end_of_week
28
+ when :not_null, :null, :blank, :true, :not_true, :false, :not_false, :present
29
+ ransack_q["#{p[0]}_#{p[1]}"] = '1'
30
+ else
31
+ ransack_q["#{p[0]}_#{p[1]}"] = p[2]
16
32
  end
17
- # ransack_q["#{p[0]}_#{p[1]}"] = p[2]
18
33
  end
19
34
  ransack_q
20
35
  end
@@ -57,7 +57,7 @@ module VisualConditionBuilder
57
57
  type = type.present? ? type.to_s.downcase.to_sym : 'string'
58
58
  operators = case type
59
59
  when :date, :datetime
60
- [:eq, :between, :today, :yesterday, :this_week, :last_week, :present, :blank]
60
+ [:eq, :between, :today, :yesterday, :tomorrow, :this_week, :last_week, :next_week, :present, :blank]
61
61
  when :time
62
62
  [:eq, :between, :present, :blank]
63
63
  when :decimal, :integer
@@ -85,8 +85,10 @@ module VisualConditionBuilder
85
85
  between: {multiple: 2},
86
86
  today: {no_value: true},
87
87
  yesterday: {no_value: true},
88
+ tomorrow: {no_value: true},
88
89
  this_week: {no_value: true},
89
- last_wee: {no_value: true},
90
+ last_week: {no_value: true},
91
+ next_week: {no_value: true},
90
92
 
91
93
  eq: {multiple: false},
92
94
  not_eq: {multiple: false},
@@ -1,3 +1,3 @@
1
1
  module VisualConditionBuilder
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visual_condition_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Porto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-17 00:00:00.000000000 Z
11
+ date: 2016-11-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A great and easy visual condition builder to your rails project
14
14
  email:
@@ -87,6 +87,7 @@ files:
87
87
  - app/views/visual_condition_builder/widgets/index.html.erb
88
88
  - config/initializers/assets.rb
89
89
  - config/initializers/visual_condition_builder.rb
90
+ - config/locales/visual_condition_builder.yml
90
91
  - config/routes.rb
91
92
  - lib/generators/templates/create_taxweb_widgets_users.rb
92
93
  - lib/generators/templates/generic_widget.erb