pg_rails 7.1.3 → 7.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/pg_engine/app/assets/stylesheets/pg_rails_b5.scss +13 -0
- data/pg_engine/app/controllers/concerns/pg_engine/resource.rb +2 -1
- data/pg_engine/app/controllers/pg_engine/base_controller.rb +1 -1
- data/pg_engine/app/helpers/pg_engine/index_helper.rb +5 -2
- data/pg_engine/app/lib/pg_engine/filtros_builder.rb +11 -8
- data/pg_rails/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0aaf9f6d48a4411856efca24dfbe0e1f27fe03202c2f5fc5f5c45b628f5142e9
|
4
|
+
data.tar.gz: a342d47cac9298e1a29ffab6222f7c66cf36aa48c15119330eed2efb258c369d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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);
|
@@ -318,7 +318,8 @@ module PgEngine
|
|
318
318
|
scope = if scope.model.respond_to? "order_by_#{field}"
|
319
319
|
scope.send "order_by_#{field}", direction
|
320
320
|
else
|
321
|
-
scope.
|
321
|
+
sql = scope.model.arel_table[field.to_sym].send(direction).to_sql + ' nulls last'
|
322
|
+
scope.order(sql)
|
322
323
|
end
|
323
324
|
instance_variable_set(:@field, field)
|
324
325
|
instance_variable_set(:@direction, direction)
|
@@ -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(
|
41
|
+
link_to(human_name, uri.to_s) + " #{symbol}".html_safe
|
39
42
|
else
|
40
|
-
|
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
|
-
"#{
|
185
|
+
"#{humann} #{I18n.t(suf, scope: 'ransack.predicates')}".strip.tap { _1[0] = _1[0].capitalize }
|
183
186
|
else
|
184
|
-
|
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,
|
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'
|
data/pg_rails/lib/version.rb
CHANGED