pg_rails 7.6.41 → 7.6.42

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: 64c0c348910ec6e2795eebf4add22342e4f99c1e0a190a9a8f37299b542c5804
4
- data.tar.gz: d128c7801a01c1beb02c52c3033b90128a6a33e2a93737972f4475a18e7d0112
3
+ metadata.gz: 519ff463ff0b6b54cc215587c8b526a9ac0385b0f084ef40e67379d88a1d7f35
4
+ data.tar.gz: 6a2ecec603c7daafaef6ee31da7b734b5e5fd810d2da4b43dc8bda4132bc6def
5
5
  SHA512:
6
- metadata.gz: 1561850b970f4c782facbdca1169edda0264795e3f67c7be1525a08bd4bb6405b2b43e57b54ba5d0e24d62423185b205f3e9491b98559da444515aa9e79d6a10
7
- data.tar.gz: e57dfba1fbbe3adbbcf8019807bfd5cdddc3fc7a97a2081e381ab369ebf7b8c35cda2fcd97fa22af64c030140c5c51caa4fb257444fa4d662dbc4d2a85a6449c
6
+ metadata.gz: c113f2b3d27671bd93409e82c234be4a0dbcf595140b2dd2b5be95da5b5e0e115045127ce1f00d560d0973579f2befcf692ed8079d28459b870ed5256e40b04e
7
+ data.tar.gz: efd482246afc90ecfbd885041f62446d337c084a12af4ba71d7f1142a63060384cac0b7b01ebcd21e037efde1339458bb8aa46b9df080b731ca2fff400ad29cb
@@ -21,7 +21,7 @@ module PgAssociable
21
21
  # porque de todos modos se pisaría en el create
22
22
  if !object.persisted? &&
23
23
  template.nested_record.present? &&
24
- object.send(atributo) == (template.nested_record)
24
+ object.send(atributo) == template.nested_record
25
25
  options[:disabled] = true
26
26
  end
27
27
 
@@ -382,7 +382,9 @@ module PgEngine
382
382
 
383
383
  def pg_respond_update
384
384
  object = instancia_modelo
385
+ # Maybe lock! to ensure consistency of audits
385
386
  if (@saved = object.save)
387
+ ActiveSupport::Notifications.instrument("record_updated.pg_engine", object)
386
388
  respond_to do |format|
387
389
  format.html do
388
390
  if params[:inline_attribute].present?
@@ -419,6 +421,7 @@ module PgEngine
419
421
  def pg_respond_create
420
422
  object = instancia_modelo
421
423
  if (@saved = object.save)
424
+ ActiveSupport::Notifications.instrument("record_created.pg_engine", object)
422
425
  if in_modal?
423
426
  body = <<~HTML.html_safe
424
427
  <pg-event data-event-name="pg:record-created" data-turbo-temporary
@@ -475,6 +478,7 @@ module PgEngine
475
478
  # rubocop:disable Metrics/PerceivedComplexity
476
479
  def pg_respond_destroy(model, land_on = nil)
477
480
  if destroy_model(model)
481
+ ActiveSupport::Notifications.instrument("record_destroyed.pg_engine", model)
478
482
  # TODO!!: rename to main
479
483
  if turbo_frame? && current_turbo_frame != 'top'
480
484
  body = <<~HTML.html_safe
@@ -581,12 +585,12 @@ module PgEngine
581
585
  if action_name == 'new'
582
586
  params.permit(atributos_permitidos)
583
587
  else
584
- params.require(nombre_modelo).permit(atributos_permitidos)
588
+ params.require(clase_modelo.model_name.param_key).permit(atributos_permitidos)
585
589
  end
586
590
  end
587
591
 
588
592
  def nombre_modelo
589
- clase_modelo.name.underscore
593
+ clase_modelo.model_name.element
590
594
  end
591
595
 
592
596
  def filtros_y_policy(campos, dflt_sort = nil, archived: false)
@@ -196,7 +196,7 @@ module PgEngine
196
196
  end
197
197
 
198
198
  def target_new
199
- mod_name_sing = object.class.model_name.singular.to_sym
199
+ mod_name_sing = object.class.model_name.singular_route_key.to_sym
200
200
  [:new, pg_namespace, nested_record, mod_name_sing]
201
201
  end
202
202
 
@@ -1,7 +1,7 @@
1
1
  module PgEngine
2
2
  module Test
3
3
  class DummyBrand < PgEngine::SiteBrand
4
- def initialize(include_all: false) # rubocop:disable Metrics/MethodLength
4
+ def initialize(skip_default_url_options: Rails.env.test?) # rubocop:disable Metrics/MethodLength
5
5
  super()
6
6
 
7
7
  @default_site_brand = :factura
@@ -48,7 +48,7 @@ module PgEngine
48
48
  }
49
49
  }
50
50
 
51
- return unless Rails.env.development? || include_all
51
+ return if skip_default_url_options
52
52
 
53
53
  @options.merge!({
54
54
  default_url_options: {
@@ -27,7 +27,7 @@ describe PgEngine::BaseMailer do
27
27
  # rubocop:disable Style/GlobalVars
28
28
  before do
29
29
  $site_brand_before = PgEngine.site_brand
30
- PgEngine.site_brand = PgEngine::Test::DummyBrand.new(include_all: true)
30
+ PgEngine.site_brand = PgEngine::Test::DummyBrand.new(skip_default_url_options: false)
31
31
  end
32
32
 
33
33
  after do
@@ -42,7 +42,7 @@ describe 'Base requests' do
42
42
  { 'ACCEPT' => 'text/html' }
43
43
  end
44
44
 
45
- include_examples 'manda el status correcto'
45
+ it_behaves_like 'manda el status correcto'
46
46
 
47
47
  it 'no manda el flash' do
48
48
  subject
@@ -60,7 +60,7 @@ describe 'Base requests' do
60
60
  { 'ACCEPT' => 'text/vnd.turbo-stream.html' }
61
61
  end
62
62
 
63
- include_examples 'manda el status correcto'
63
+ it_behaves_like 'manda el status correcto'
64
64
 
65
65
  it 'manda el flash' do
66
66
  subject
@@ -73,7 +73,7 @@ describe 'Base requests' do
73
73
  { 'ACCEPT' => 'application/json' }
74
74
  end
75
75
 
76
- include_examples 'manda el status correcto'
76
+ it_behaves_like 'manda el status correcto'
77
77
  end
78
78
  end
79
79
 
@@ -6,7 +6,7 @@ describe 'Al Registrarse' do
6
6
  include ActiveJob::TestHelper
7
7
 
8
8
  find_scroll = proc do |selector, options = {}|
9
- elem = find(selector, **options.merge(visible: :all))
9
+ elem = find(selector, **options, visible: :all)
10
10
  script = 'arguments[0].scrollIntoView({ behavior: "instant", block: "start", inline: "nearest" });'
11
11
  page.execute_script(script, elem)
12
12
  sleep 0.5
@@ -31,6 +31,14 @@ class Navbar
31
31
  @configured = true
32
32
  end
33
33
 
34
+ def topbar_signed_in_links
35
+ return [] if @user.blank?
36
+
37
+ configure
38
+
39
+ bar('topbar.signed_in')
40
+ end
41
+
34
42
  def sidebar
35
43
  configure
36
44
 
@@ -43,13 +51,13 @@ class Navbar
43
51
  bar_data = @yaml_data[key]
44
52
  return [] if bar_data.blank?
45
53
 
46
- # rubocop:disable Style/MultilineBlockChain:
54
+ # rubocop:disable Style/MultilineBlockChain
47
55
  orig_idx = 0
48
56
  bar_data.map do |item|
49
57
  orig_idx += 1
50
58
  evaluate_node(item, orig_idx)
51
59
  end.sort_by { |a| [a[:priority], a[:orig_idx]] }
52
- # rubocop:enable Style/MultilineBlockChain:
60
+ # rubocop:enable Style/MultilineBlockChain
53
61
  end
54
62
 
55
63
  def evaluate_node(item, orig_idx = nil)
@@ -33,6 +33,8 @@ html
33
33
  meta name="view-transition" content="same-origin"
34
34
  meta name="cable-history-timestamp" content="#{Time.now.to_i}"
35
35
 
36
+ / Para qué era esto? Tenía que ver con la cache, no sé si del browser o de nginx, o de Rails
37
+ / Pero no sé si sigue siendo necesario. Se usa en las páginas estáticas de legales y history
36
38
  - unless @skip_csrf_meta_tags
37
39
  = csrf_meta_tags
38
40
 
@@ -60,5 +60,12 @@ ul.navbar-nav.gap-3.align-items-center class="gap-#{@breakpoint_navbar_expand}-0
60
60
  li = link_to Account.nombre_plural, users_accounts_path(tid: nil), class: 'dropdown-item'
61
61
  - if Current.user.developer?
62
62
  li = link_to 'Admin', admin_users_path, class: 'dropdown-item'
63
+
64
+ - if @navbar.present?
65
+ - @navbar.topbar_signed_in_links.each do |entry|
66
+ - next if @navbar.hide_entry?(entry)
67
+ li
68
+ a href=entry[:path] class="dropdown-item #{@navbar.active_entry?(entry, request) ? 'active' : ''} #{entry[:attributes]}"
69
+ = entry[:title]
63
70
  li = link_to 'Cerrar sesión', destroy_user_session_path(tid: nil),
64
71
  'data-turbo-method': :delete, class: 'dropdown-item'
@@ -2,6 +2,6 @@
2
2
 
3
3
  # :nocov:
4
4
  module PgRails
5
- VERSION = '7.6.41'
5
+ VERSION = '7.6.42'
6
6
  end
7
7
  # :nocov:
@@ -82,7 +82,7 @@ module PgFactoryBot
82
82
  'Faker::Lorem.sentence'
83
83
  elsif attribute.type == :date
84
84
  'Faker::Date.backward'
85
- elsif attribute.type == :float || attribute.type == :decimal
85
+ elsif %i[float decimal].include?(attribute.type)
86
86
  'Faker::Number.decimal(l_digits: 3, r_digits: 2)'
87
87
  elsif attribute.type == :integer
88
88
  'rand(1..9999)'
@@ -15,8 +15,8 @@ module PgRspec
15
15
  class_option :trackeo_de_usuarios, type: :boolean, default: true,
16
16
  desc: 'Genera campos creado_por y actualizado_por.'
17
17
 
18
- class_option :controller_specs, type: :boolean, default: true
19
- class_option :request_specs, type: :boolean, default: false
18
+ class_option :controller_specs, type: :boolean, default: false
19
+ class_option :request_specs, type: :boolean, default: true
20
20
  class_option :view_specs, type: :boolean, default: false
21
21
 
22
22
  # remove_hook_for :integration_tool, as: :integration
@@ -33,9 +33,8 @@ describe 'Generators', type: :generator do
33
33
  it do
34
34
  run_generator(['users/modelo', 'bla:integer'])
35
35
 
36
- my_assert_file 'spec/controllers/users/modelos_controller_spec.rb' do |content|
37
- expect(content).to match(/routing/)
38
- expect(content).to match(/sign_in/)
36
+ my_assert_file 'spec/requests/users/modelos_spec.rb' do |content|
37
+ expect(content).to match(/valid_attributes/)
39
38
  end
40
39
  end
41
40
  end
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.6.41
4
+ version: 7.6.42
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: 2025-04-08 00:00:00.000000000 Z
11
+ date: 2025-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails