templus_models 2.0.15 → 2.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4c3261e33c32d29539818bc4f9df911b5ea8105
4
- data.tar.gz: 0eed8196e4d499761c82238ed5843f99c6c84b4d
3
+ metadata.gz: a87c047b42820aa87baba1d59157623e25602827
4
+ data.tar.gz: d0a10386ada91e1281c4577d9c75a556b17b6b4d
5
5
  SHA512:
6
- metadata.gz: 5d6d65de90ec66af6bbc6bd221757061cf28a3ed562f5decdf9dcb915282e0ae5e829c20eb7b9be1148fd4454c8f12d45977dc717418ea22502367d68c913c60
7
- data.tar.gz: df420b44e56be37579c29a69cfcdfd8546234de5d03a40e79deb7a76d198f6b92be744f6adc27c1971c8f0f2b5194c07860b33b9746f42f87f5fc3fbe8f9d68a
6
+ metadata.gz: ad3263d6b8082eeb382a3cbf0c89f32348ec09cfa86338dd33883849dedf943d92f08ff10f7fb2f0e78b8bc5b98b253ff120db81215704575d49ae2d717c2bc9
7
+ data.tar.gz: b8621fe894e86228491e7f00b402d2e63677027dad24ae1b10a5bb11e51d252bcf5c40cee31062d80a9a6561ffec4e5f00f26aa6590fd9a0da20228d4bfc710f
@@ -89,7 +89,7 @@ module SearchHelper
89
89
  when :string
90
90
  raro_text_field(name, opts)
91
91
  when :range
92
- raro_range(name)
92
+ raro_range(name, opts)
93
93
  when :monthyear
94
94
  raro_monthyear(name, opts)
95
95
  when :check_boxes
@@ -231,13 +231,21 @@ module SearchHelper
231
231
  </div></div>"
232
232
  end
233
233
 
234
- def raro_range(name)
234
+ def raro_range(name, opts={})
235
+ attrs_gteq, attrs_lteq = "", ""
236
+
237
+ if opts[:placeholders]
238
+ placeholders = opts[:placeholders]
239
+ attrs_gteq << "placeholder='#{placeholders.first}' "
240
+ attrs_lteq << "placeholder='#{placeholders.last}' "
241
+ end
242
+
235
243
  buffer = ""
236
244
  buffer += "<div class='col-sm-4'>"
237
- buffer += "<input type='text' name='q[#{name}_gteq]' class='form-control'/>"
245
+ buffer += "<input type='text' name='q[#{name}_gteq]' class='form-control' #{attrs_gteq}/>"
238
246
  buffer += "</div>"
239
247
  buffer += "<div class='col-sm-4 range-separator'>"
240
- buffer += "<input type='text' name='q[#{name}_lteq]' class='form-control'/>"
248
+ buffer += "<input type='text' name='q[#{name}_lteq]' class='form-control' #{attrs_lteq}/>"
241
249
  buffer += "</div>"
242
250
  buffer
243
251
  end
@@ -281,6 +289,7 @@ module SearchHelper
281
289
  <option value=not_cont>#{I18n.t('not_contains')}</option>
282
290
  <option value=start>#{I18n.t('begins')}</option>
283
291
  <option value=end>#{I18n.t('ends')}</option>
292
+ <option value=has_any_term>#{I18n.t('word')}</option>
284
293
  </select>"
285
294
  end
286
295
 
@@ -12,6 +12,13 @@ Ransack.configure do |config|
12
12
  validator: proc { |v| v.present? },
13
13
  compounds: true,
14
14
  type: :string
15
+
16
+ config.add_predicate 'has_any_term',
17
+ arel_predicate: 'matches_any',
18
+ formatter: proc { |v| ["% #{v} %", "% #{v}", "#{v} %", "#{v}"] },
19
+ validator: proc { |v| v.present? },
20
+ compounds: true,
21
+ type: :string
15
22
  end
16
23
 
17
24
  module Kaminari
@@ -1,3 +1,3 @@
1
1
  module TemplusModels
2
- VERSION = "2.0.15"
2
+ VERSION = "2.0.16"
3
3
  end
@@ -144,6 +144,7 @@
144
144
  not_contains: "Não Contém"
145
145
  begins: "Começa"
146
146
  ends: "Termina"
147
+ word: "Palavra"
147
148
  menu:
148
149
  entitys: "Cadastros"
149
150
  true: Sim
@@ -158,7 +159,7 @@
158
159
  - Sex
159
160
  - Sáb
160
161
  abbr_month_names:
161
- -
162
+ -
162
163
  - Jan
163
164
  - Fev
164
165
  - Mar
@@ -184,7 +185,7 @@
184
185
  long: ! '%d de %B de %Y'
185
186
  short: ! '%d de %B'
186
187
  month_names:
187
- -
188
+ -
188
189
  - Janeiro
189
190
  - Fevereiro
190
191
  - Março
@@ -358,4 +359,4 @@
358
359
  <<: *errors
359
360
  activerecord:
360
361
  errors:
361
- <<: *errors
362
+ <<: *errors
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: templus_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.15
4
+ version: 2.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Sol
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-01-22 00:00:00.000000000 Z
13
+ date: 2018-03-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails