pg_rails 7.1.4 → 7.1.5

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
  SHA256:
3
- metadata.gz: 97005ad0cfff2f7088c2dbfe667e1fc8339b8873c3935580d374069fdda0c463
4
- data.tar.gz: 938afdb82665e744d1c352e5879523329064bb5cadc7c9becdd88bb6aa85505e
3
+ metadata.gz: 0aaf9f6d48a4411856efca24dfbe0e1f27fe03202c2f5fc5f5c45b628f5142e9
4
+ data.tar.gz: a342d47cac9298e1a29ffab6222f7c66cf36aa48c15119330eed2efb258c369d
5
5
  SHA512:
6
- metadata.gz: ce4389f063db55a1761fa50c4335a5b7c98825222b7c541accd5f3e8b4e65c13f9a7ebe3a65787b7c90219f90f11370136faf1efb98f2b2996d9047fc8707e86
7
- data.tar.gz: 6a510173f026e874693cc471f9eb251b733164f3cfc1fd72f105b9b556e7cf918962340584e1479d47d130ba723d0c5642a97f3b8097f417c84d7bf495a53c97
6
+ metadata.gz: 4de79ebcc76b2d4d04b0709d18f0ae5106019a16eec4cee8272708b33aba4476980d0563f7c0569bde685638614b91a5ee5197fb750f21bbd10862176ea429e8
7
+ data.tar.gz: 2f3b8bd20aee78bd24133777fd6660a919cfa10b66d581ff13b0a0ce60adae8061401e08966c994aed86bedaa08d5cfbc4bcb90c4d07217c39f3a3654e7d58ba
@@ -80,6 +80,19 @@ input[type=datetime-local], input[type=datetime] {
80
80
  // max-width: 17em;
81
81
  }
82
82
 
83
+ .filter label {
84
+ font-size: 0.8em;
85
+ font-weight: bold;
86
+ max-width: 5em;
87
+ text-align: right;
88
+ line-height: 1.2em;
89
+ vertical-align: middle;
90
+ opacity: 0.5;
91
+ min-width: 1em!important;
92
+ padding-left: 0.5em;
93
+ width: min-content;
94
+ }
95
+
83
96
  // Modal
84
97
  .modal-content {
85
98
  box-shadow: 15px 15px 9px 0px rgba(0, 0, 0, 0.6);
@@ -91,7 +91,7 @@ module PgEngine
91
91
  end
92
92
 
93
93
  if Current.user.present?
94
- @notifications = Current.user.notifications.order(id: :desc)
94
+ @notifications = Current.user.notifications.order(id: :desc).includes(:event)
95
95
  .where(type: 'SimpleUserNotifier::Notification')
96
96
  unseen = @notifications.unseen.any?
97
97
  # FIXME: testear y fixear, buscar el primero que esté present
@@ -6,6 +6,9 @@ module PgEngine
6
6
  campo = campo.to_s.sub(/_f\z/, '')
7
7
  campo = campo.to_s.sub(/_text\z/, '')
8
8
  clase = options[:clase] || @clase_modelo
9
+ key = [controller_name, action_name, 'listado_header', campo].join('.')
10
+ dflt = :"activerecord.attributes.#{clase.model_name.i18n_key}.#{campo}"
11
+ human_name = clase.human_attribute_name(key, default: dflt)
9
12
  if options[:ordenable]
10
13
  field = controller.instance_variable_get(:@field)
11
14
  direction = controller.instance_variable_get(:@direction)
@@ -35,9 +38,9 @@ module PgEngine
35
38
 
36
39
  uri.query = cgi.transform_values { |b| (b.length == 1 ? b.first : b) }.to_query
37
40
 
38
- link_to(clase.human_attribute_name(campo), uri.to_s) + " #{symbol}".html_safe
41
+ link_to(human_name, uri.to_s) + " #{symbol}".html_safe
39
42
  else
40
- clase.human_attribute_name(campo)
43
+ human_name
41
44
  end
42
45
  end
43
46
  end
@@ -7,7 +7,7 @@ module PgEngine
7
7
  include PostgresHelper
8
8
  attr_accessor :controller
9
9
 
10
- SUFIJOS = %w[desde hasta incluye es_igual_a in cont eq].freeze
10
+ SUFIJOS = %w[desde hasta gt gte lt lte incluye es_igual_a in cont cont_all eq].freeze
11
11
 
12
12
  def initialize(controller, clase_modelo, campos)
13
13
  @clase_modelo = clase_modelo
@@ -178,10 +178,13 @@ module PgEngine
178
178
 
179
179
  def placeholder_campo(campo)
180
180
  suf = extraer_sufijo(campo)
181
+ key = [controller_name, action_name, 'filter', sin_sufijo(campo)].join('.')
182
+ dflt = :"activerecord.attributes.#{@clase_modelo.model_name.i18n_key}.#{sin_sufijo(campo)}"
183
+ humann = @clase_modelo.human_attribute_name(key, default: dflt)
181
184
  if suf.present?
182
- "#{@clase_modelo.human_attribute_name(sin_sufijo(campo))} #{suf}"
185
+ "#{humann} #{I18n.t(suf, scope: 'ransack.predicates')}".strip.tap { _1[0] = _1[0].capitalize }
183
186
  else
184
- @clase_modelo.human_attribute_name(campo)
187
+ humann
185
188
  end
186
189
  end
187
190
 
@@ -238,7 +241,7 @@ module PgEngine
238
241
  end
239
242
  end
240
243
 
241
- def filtro_asociacion(campo, _placeholder = '')
244
+ def filtro_asociacion(campo, placeholder = '')
242
245
  asociacion = obtener_asociacion(campo)
243
246
  nombre_clase = asociacion.options[:class_name]
244
247
  nombre_clase = asociacion.name.to_s.camelize if nombre_clase.nil?
@@ -256,7 +259,7 @@ module PgEngine
256
259
 
257
260
  content_tag :div, class: 'col-auto' do
258
261
  content_tag :div, class: 'filter' do
259
- placeholder = ransack_placeholder(campo)
262
+ # placeholder = ransack_placeholder(campo)
260
263
  suf = extraer_sufijo(campo)
261
264
  if suf.in? %w[in]
262
265
  @form.select sin_sufijo(campo) + '_id_in', map, { multiple: true }, placeholder:, 'data-controller': 'selectize',
@@ -276,7 +279,7 @@ module PgEngine
276
279
  end
277
280
  content_tag :div, class: 'col-auto' do
278
281
  content_tag :div, class: 'filter' do
279
- placeholder = ransack_placeholder(campo)
282
+ # placeholder = ransack_placeholder(campo)
280
283
  suf = extraer_sufijo(campo)
281
284
  if suf.in? %w[in]
282
285
  @form.select(campo, map, { multiple: true }, placeholder:, class: 'form-control form-control-sm pg-input-lg', 'data-controller': 'selectize')
@@ -305,7 +308,7 @@ module PgEngine
305
308
  def filtro_texto(campo, placeholder = '')
306
309
  content_tag :div, class: 'col-auto' do
307
310
  content_tag :div, class: 'filter' do
308
- placeholder = ransack_placeholder(campo)
311
+ # placeholder = ransack_placeholder(campo)
309
312
  @form.search_field(
310
313
  campo, class: 'form-control form-control-sm allow-enter-submit', placeholder:, autocomplete: 'off'
311
314
  )
@@ -330,7 +333,7 @@ module PgEngine
330
333
  def filtro_fecha(campo, placeholder = '')
331
334
  content_tag :div, class: 'col-auto' do
332
335
  content_tag :div, class: 'filter' do
333
- placeholder = ransack_placeholder(campo)
336
+ # placeholder = ransack_placeholder(campo)
334
337
  label_tag(nil, placeholder, class: 'text-body-secondary') +
335
338
  @form.date_field(
336
339
  campo, class: 'form-control form-control-sm d-inline-block w-auto ms-1', placeholder:, autocomplete: 'off'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.1.4'
4
+ VERSION = '7.1.5'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.4
4
+ version: 7.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso