pg_rails 7.1.9 → 7.1.11
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 +5 -0
- data/pg_engine/app/components/search_bar_component.html.slim +17 -0
- data/pg_engine/app/components/search_bar_component.rb +10 -0
- data/pg_engine/app/components/search_bar_toggler_component.html.slim +8 -0
- data/pg_engine/app/components/search_bar_toggler_component.rb +4 -0
- data/pg_engine/app/controllers/pg_engine/require_sign_in.rb +2 -0
- data/pg_engine/app/lib/pg_engine/filtros_builder.rb +14 -5
- data/pg_engine/app/views/pg_engine/base/index.html.slim +4 -27
- data/pg_engine/config/initializers/ransack_memory.rb +4 -0
- data/pg_engine/config/initializers/view_component.rb +3 -0
- data/pg_engine/lib/pg_engine.rb +1 -0
- data/pg_rails/lib/version.rb +1 -1
- metadata +21 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f6553a59df0df7aeb2906baac1974c3f2ef6f5b17bd83f4df1b4fbf3f7f2819
|
4
|
+
data.tar.gz: 20e9aa024c6aebb771ebea3c3b852a2e47a6d7583d043bcbc750d3ec2642e336
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5b1ff627eeff7269b53d81a2b8d39184118741001cb4d36d89eba76801910315551ef563d55216f5a2e5b372b7afd3ff66ef7a4bae8428f94b20a28004c727b
|
7
|
+
data.tar.gz: c7af654f04ac7fba7d48e9c220f9396bb5ab24508350035447c792f0fd0afe213ccb529ed5360db4e1baa4f27cd5cbf387d6f3b4a71877edccf10395359fc8a6
|
@@ -0,0 +1,17 @@
|
|
1
|
+
- if helpers.show_filters?
|
2
|
+
.border-bottom#filtros
|
3
|
+
.d-flex.align-items-center.px-3.py-2
|
4
|
+
.px-2.d-none.d-sm-inline-block
|
5
|
+
span.bi.bi-funnel-fill
|
6
|
+
= helpers.search_form_for @q, url: url_for do |f|
|
7
|
+
.row.g-1
|
8
|
+
.col
|
9
|
+
.row.g-1
|
10
|
+
= @builder.filtros_html(form: f)
|
11
|
+
.col-auto.gap-1.d-flex.align-items-start
|
12
|
+
= helpers.button_tag class: 'btn btn-sm btn-primary col-auto' do
|
13
|
+
span.bi.bi-search
|
14
|
+
span.d-none.d-sm-inline
|
15
|
+
|  
|
16
|
+
span.text Buscar
|
17
|
+
= helpers.clear_filter(title: 'Limpiar', class: 'btn btn-sm btn-secondary col-auto')
|
@@ -0,0 +1,8 @@
|
|
1
|
+
- if helpers.show_filters?
|
2
|
+
= link_to url_for(ocultar_filtros: 1, cancel_filter: 'true'),
|
3
|
+
class: 'btn btn-sm btn-outline-primary col-auto' do
|
4
|
+
| Ocultar filtros
|
5
|
+
- else
|
6
|
+
= link_to url_for(mostrar_filtros: 1),
|
7
|
+
class: 'btn btn-sm btn-outline-primary col-auto' do
|
8
|
+
| Filtrar
|
@@ -231,7 +231,7 @@ module PgEngine
|
|
231
231
|
map = scope.map { |o| [o.to_s, o.id] }
|
232
232
|
|
233
233
|
content_tag :div, class: 'col-auto' do
|
234
|
-
content_tag :div, class:
|
234
|
+
content_tag :div, class: "filter #{active_class(campo)}" do
|
235
235
|
suf = extraer_sufijo(campo)
|
236
236
|
if suf.in? %w[in]
|
237
237
|
@form.select campo, map, { multiple: true }, placeholder:, 'data-controller': 'selectize',
|
@@ -249,7 +249,7 @@ module PgEngine
|
|
249
249
|
key.value]
|
250
250
|
end
|
251
251
|
content_tag :div, class: 'col-auto' do
|
252
|
-
content_tag :div, class:
|
252
|
+
content_tag :div, class: "filter #{active_class(campo)}" do
|
253
253
|
suf = extraer_sufijo(campo)
|
254
254
|
if suf.in? %w[in]
|
255
255
|
@form.select(campo, map, { multiple: true }, placeholder:, class: 'form-control form-control-sm pg-input-lg', 'data-controller': 'selectize')
|
@@ -262,7 +262,7 @@ module PgEngine
|
|
262
262
|
|
263
263
|
def filtro_texto(campo, placeholder = '')
|
264
264
|
content_tag :div, class: 'col-auto' do
|
265
|
-
content_tag :div, class:
|
265
|
+
content_tag :div, class: "filter #{active_class(campo)}" do
|
266
266
|
@form.search_field(
|
267
267
|
campo, class: 'form-control form-control-sm allow-enter-submit', placeholder:, autocomplete: 'off'
|
268
268
|
)
|
@@ -276,7 +276,7 @@ module PgEngine
|
|
276
276
|
include_blank = "¿#{placeholder.titleize}?"
|
277
277
|
|
278
278
|
content_tag :div, class: 'col-auto' do
|
279
|
-
content_tag :div, class:
|
279
|
+
content_tag :div, class: "filter #{active_class(campo)}" do
|
280
280
|
@form.select campo.to_sym, map, { include_blank: }, class: 'form-select form-select-sm pg-input-lg'
|
281
281
|
end
|
282
282
|
end
|
@@ -284,7 +284,7 @@ module PgEngine
|
|
284
284
|
|
285
285
|
def filtro_fecha(campo, placeholder = '')
|
286
286
|
content_tag :div, class: 'col-auto' do
|
287
|
-
content_tag :div, class:
|
287
|
+
content_tag :div, class: "filter #{active_class(campo)}" do
|
288
288
|
label_tag(nil, placeholder, class: 'text-body-secondary') +
|
289
289
|
@form.date_field(
|
290
290
|
campo, class: 'form-control form-control-sm d-inline-block w-auto ms-1', placeholder:, autocomplete: 'off'
|
@@ -293,6 +293,15 @@ module PgEngine
|
|
293
293
|
end
|
294
294
|
end
|
295
295
|
|
296
|
+
def active_class(campo)
|
297
|
+
if parametros_controller[:q] &&
|
298
|
+
[parametros_controller[:q][campo.to_sym]].flatten.compact_blank.any?
|
299
|
+
'active'
|
300
|
+
else
|
301
|
+
''
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
296
305
|
def parametros_controller
|
297
306
|
params
|
298
307
|
end
|
@@ -3,36 +3,13 @@
|
|
3
3
|
- @actions&.each do |link_args|
|
4
4
|
= link_to(*link_args)
|
5
5
|
- if @filtros.present?
|
6
|
-
|
7
|
-
= link_to namespaced_path(@clase_modelo, ocultar_filtros: 1),
|
8
|
-
class: 'btn btn-sm btn-outline-primary col-auto' do
|
9
|
-
| Ocultar filtros
|
10
|
-
- else
|
11
|
-
= link_to namespaced_path(@clase_modelo, mostrar_filtros: 1),
|
12
|
-
class: 'btn btn-sm btn-outline-primary col-auto' do
|
13
|
-
| Filtrar
|
6
|
+
= render SearchBarTogglerComponent.new
|
14
7
|
.ms-1
|
15
8
|
= @clase_modelo.new.decorate.new_link
|
16
9
|
|
17
|
-
- if @filtros.present?
|
18
|
-
.
|
19
|
-
|
20
|
-
.px-2.d-none.d-sm-inline-block
|
21
|
-
span.bi.bi-funnel-fill
|
22
|
-
= search_form_for @q, url: namespaced_path(@clase_modelo) do |f|
|
23
|
-
.row.g-1
|
24
|
-
.col
|
25
|
-
.row.g-1
|
26
|
-
= @filtros.filtros_html(form: f)
|
27
|
-
.col-auto.gap-1.d-flex.align-items-start
|
28
|
-
= button_tag class: 'btn btn-sm btn-primary col-auto' do
|
29
|
-
span.bi.bi-search
|
30
|
-
span.d-none.d-sm-inline
|
31
|
-
|  
|
32
|
-
span.text Buscar
|
33
|
-
= link_to namespaced_path(@clase_modelo, mostrar_filtros: 1),
|
34
|
-
class: 'btn btn-sm btn-secondary col-auto' do
|
35
|
-
| Limpiar
|
10
|
+
- if @filtros.present?
|
11
|
+
= render SearchBarComponent.new(@q, @filtros)
|
12
|
+
|
36
13
|
div
|
37
14
|
- if @collection.any?
|
38
15
|
.table-responsive
|
@@ -0,0 +1,4 @@
|
|
1
|
+
RansackMemory::Core.config = {
|
2
|
+
param: :q, # this means the default Ransack param name for searching. You can change it
|
3
|
+
session_key_format: '%controller_name%_%action_name%_%request_format%' # this means how the key used to store the information to the session will be stored. Currently it interpolates request parameters. You can customize it and use these vars to build a key that fits your needs
|
4
|
+
}
|
data/pg_engine/lib/pg_engine.rb
CHANGED
data/pg_rails/lib/version.rb
CHANGED
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
|
+
version: 7.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martín Rosso
|
@@ -528,6 +528,20 @@ dependencies:
|
|
528
528
|
- - "~>"
|
529
529
|
- !ruby/object:Gem::Version
|
530
530
|
version: 2.3.6
|
531
|
+
- !ruby/object:Gem::Dependency
|
532
|
+
name: ransack_memory
|
533
|
+
requirement: !ruby/object:Gem::Requirement
|
534
|
+
requirements:
|
535
|
+
- - "~>"
|
536
|
+
- !ruby/object:Gem::Version
|
537
|
+
version: '0.1'
|
538
|
+
type: :runtime
|
539
|
+
prerelease: false
|
540
|
+
version_requirements: !ruby/object:Gem::Requirement
|
541
|
+
requirements:
|
542
|
+
- - "~>"
|
543
|
+
- !ruby/object:Gem::Version
|
544
|
+
version: '0.1'
|
531
545
|
- !ruby/object:Gem::Dependency
|
532
546
|
name: view_component
|
533
547
|
requirement: !ruby/object:Gem::Requirement
|
@@ -603,6 +617,10 @@ files:
|
|
603
617
|
- pg_engine/app/components/notification_component.rb
|
604
618
|
- pg_engine/app/components/notifications_bell_component.rb
|
605
619
|
- pg_engine/app/components/page_not_found_component.rb
|
620
|
+
- pg_engine/app/components/search_bar_component.html.slim
|
621
|
+
- pg_engine/app/components/search_bar_component.rb
|
622
|
+
- pg_engine/app/components/search_bar_toggler_component.html.slim
|
623
|
+
- pg_engine/app/components/search_bar_toggler_component.rb
|
606
624
|
- pg_engine/app/controllers/admin/accounts_controller.rb
|
607
625
|
- pg_engine/app/controllers/admin/email_logs_controller.rb
|
608
626
|
- pg_engine/app/controllers/admin/emails_controller.rb
|
@@ -704,8 +722,10 @@ files:
|
|
704
722
|
- pg_engine/config/initializers/cable_ready.rb
|
705
723
|
- pg_engine/config/initializers/devise.rb
|
706
724
|
- pg_engine/config/initializers/ransack.rb
|
725
|
+
- pg_engine/config/initializers/ransack_memory.rb
|
707
726
|
- pg_engine/config/initializers/rollbar.rb
|
708
727
|
- pg_engine/config/initializers/simple_form_monkey_patch.rb
|
728
|
+
- pg_engine/config/initializers/view_component.rb
|
709
729
|
- pg_engine/config/initializers/zeitwerk.rb
|
710
730
|
- pg_engine/config/locales/devise.en.yml
|
711
731
|
- pg_engine/config/locales/es.yml
|