pg_rails 7.1.8 → 7.1.10

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
  SHA256:
3
- metadata.gz: 191011edebc40d5f12ef69b1dc820b578051ceaa04f44b8cc2d484d34eb702b9
4
- data.tar.gz: 8d31123f512ab1e8e75ccd779911a9d91ccc704efce6d8ee00c8108f444734e9
3
+ metadata.gz: 671c1939e1e9cae615f0b025c14af1b2c7e25d725782bc28aa7a0416c6b9138b
4
+ data.tar.gz: 9ef68287946ee5aa453beec59bb1ffbcfd6a5acee7bac7c34b993313535b158c
5
5
  SHA512:
6
- metadata.gz: 930662b242df39cd0b10e125a7132c176f3d264f355eb7cb0e750e1998304c54858b14c99cdda286ce94f01503b1ccfed4a3b81a192c40e560b1803a8e14bcd7
7
- data.tar.gz: 9097148fea5b072ddacf4f8aaf84b5c8ddb6cd71cc9f61e5e27cab061aeee0b0f5d395f14c82cc9990dd2fd0bfd1a3ec80aadcbf552dbe064079616a1adb1e8b
6
+ metadata.gz: 85c0900adc13bfb4955f46da877756864940b6e00e5a3a3f65b9c07d6792b068b5acb5d9baa3fc674bb51ab722f21c826e10c564644d60fae52780214c7c2493
7
+ data.tar.gz: 90a1bdfb038b4c9d0c5004ff854384669aa537e1efa1895c9f4bf9756a2deef9083552a152a870db0e43bf01c48b247ad8e6b10fe051cc40ee838c3b080437dc
@@ -84,6 +84,11 @@ input[type=datetime-local], input[type=datetime] {
84
84
  vertical-align: top;
85
85
  // max-width: 17em;
86
86
  }
87
+ .filter.active {
88
+ .form-select, .form-control {
89
+ background-color: #ffb40157;
90
+ }
91
+ }
87
92
 
88
93
  .filter label {
89
94
  font-size: 0.8em;
@@ -3,7 +3,9 @@
3
3
  module PgEngine
4
4
  module RequireSignIn
5
5
  def self.included(clazz)
6
+ clazz.include RansackMemory::Concern
6
7
  clazz.before_action :authenticate_user!
8
+ clazz.before_action :save_and_load_filters
7
9
  end
8
10
  end
9
11
  end
@@ -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: 'filter' do
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: 'filter' do
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: 'filter' do
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: 'filter' do
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: 'filter' do
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
@@ -30,9 +30,8 @@
30
30
  span.d-none.d-sm-inline
31
31
  | &nbsp
32
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
33
+ = clear_filter(title: 'Limpiar', class: 'btn btn-sm btn-secondary col-auto')
34
+
36
35
  div
37
36
  - if @collection.any?
38
37
  .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
+ }
@@ -52,6 +52,7 @@ require 'mailgun-ruby'
52
52
  require 'pg_search'
53
53
  require 'view_component'
54
54
  require 'noticed'
55
+ require 'ransack_memory'
55
56
 
56
57
  if Rails.env.local?
57
58
  require 'letter_opener'
@@ -74,7 +74,7 @@ html
74
74
  = render FlashContainerComponent.new
75
75
  / TODO: si hay varios flashes toast, se superponen. habría que
76
76
  hacer un container con position absolute para los toasts
77
- / FIXME: el yield(filtros)
77
+ = yield(:filtros)
78
78
  = content
79
79
  div style="width:100%; height: 10em"
80
80
  = render partial: 'layouts/footer'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.1.8'
4
+ VERSION = '7.1.10'
5
5
  end
@@ -13,6 +13,7 @@ describe '<%= name %>' do
13
13
  end
14
14
 
15
15
  let(:logged_user) { create :user }
16
+ let(:account) { logged_user.current_account }
16
17
 
17
18
  before do
18
19
  login_as logged_user
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.8
4
+ version: 7.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-02 00:00:00.000000000 Z
11
+ date: 2024-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -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
@@ -704,6 +718,7 @@ files:
704
718
  - pg_engine/config/initializers/cable_ready.rb
705
719
  - pg_engine/config/initializers/devise.rb
706
720
  - pg_engine/config/initializers/ransack.rb
721
+ - pg_engine/config/initializers/ransack_memory.rb
707
722
  - pg_engine/config/initializers/rollbar.rb
708
723
  - pg_engine/config/initializers/simple_form_monkey_patch.rb
709
724
  - pg_engine/config/initializers/zeitwerk.rb
@@ -858,8 +873,6 @@ files:
858
873
  - pg_layout/lib/pg_layout.rb
859
874
  - pg_layout/lib/pg_layout/engine.rb
860
875
  - pg_layout/spec/lib/navbar_spec.rb
861
- - pg_rails/dist/types/pg_associable/app/javascript/asociable_controller.d.ts
862
- - pg_rails/dist/types/pg_layout/app/javascript/utils/utils.d.ts
863
876
  - pg_rails/js/index.js
864
877
  - pg_rails/lib/pg_rails.rb
865
878
  - pg_rails/lib/pg_rails/capybara_support.rb
@@ -1,17 +0,0 @@
1
- import { Controller } from '@hotwired/stimulus'
2
- export default class extends Controller {
3
- static outlets: string[]
4
- lastValue: any
5
- subWrapper: any
6
- elemId: any
7
- input: any
8
- connect(): void;
9
- resetResultados(): void;
10
- setMaxHeight(): void;
11
- crearItem(): void;
12
- escribiAlgo(): void;
13
- buscando(): void;
14
- selectItem(e: any): void;
15
- doSearch(force?: boolean): void;
16
- completarCampo(object: any): void;
17
- }
@@ -1,7 +0,0 @@
1
- export declare function round(value: any): number;
2
- export declare function printCurrency(value: any, simboloMoneda?: string): string;
3
- export declare function showPercentage(value: any): string;
4
- export declare function numberWithDots(x: any): any;
5
- export declare function flashMessage(message: any, flashType?: string, toast?: boolean): void;
6
- export declare function fadeOut(e: any): void;
7
- export declare function fadeIn(e: any): void;