pg_rails 7.6.41 → 7.6.43
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 +4 -4
- data/pg_associable/app/helpers/pg_associable/form_builder_methods.rb +1 -1
- data/pg_engine/app/controllers/admin/simple_user_notifiers_controller.rb +0 -1
- data/pg_engine/app/controllers/concerns/pg_engine/resource.rb +13 -6
- data/pg_engine/app/controllers/concerns/pg_engine/tenant_helper.rb +0 -1
- data/pg_engine/app/controllers/pg_engine/health_controller.rb +8 -1
- data/pg_engine/app/decorators/pg_engine/base_record_decorator.rb +1 -1
- data/pg_engine/app/helpers/pg_engine/form_helper.rb +0 -1
- data/pg_engine/lib/pg_engine/active_job_extensions.rb +1 -1
- data/pg_engine/lib/pg_engine/mailgun/log_sync.rb +1 -1
- data/pg_engine/lib/pg_engine/navigator.rb +0 -1
- data/pg_engine/lib/pg_engine/test/dummy_brand.rb +2 -2
- data/pg_engine/spec/mailers/pg_engine/base_mailer_spec.rb +1 -1
- data/pg_engine/spec/requests/base_controller_requests_spec.rb +3 -3
- data/pg_engine/spec/system/signup_spec.rb +1 -1
- data/pg_layout/app/lib/navbar.rb +10 -2
- data/pg_layout/app/views/layouts/pg_layout/base.html.slim +2 -0
- data/pg_layout/app/views/pg_layout/_signed_in_links.html.slim +7 -0
- data/pg_rails/lib/version.rb +1 -1
- data/pg_scaffold/lib/generators/pg_factory_bot/model/model_generator.rb +1 -1
- data/pg_scaffold/lib/generators/pg_rspec/scaffold/scaffold_generator.rb +2 -2
- data/pg_scaffold/spec/generators_spec.rb +2 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a32df0403ce2d6750bef9c081329cf0b64d50170aa9419784c69196781c43a03
|
4
|
+
data.tar.gz: c14290d74b1c8e382dfeacdf0d6d507116d5abbd8f48196e77b2893199a212a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd4228c52176a156318f9f25fffdbdfa3095192d7a18e85b9adb4c70f5b14ef71317e7a6fdfb3ac014cbd614f1a08c3c3486f1a75825d5f8c7584503e638aef7
|
7
|
+
data.tar.gz: d47e45800ff171164c443b924f6f7b7d40347ef57aaf7c15419aa378f1c3ddf1dc00642cfffe3661e0cd3ac2f299903124a092e5603450e645c940642556981f
|
@@ -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) ==
|
24
|
+
object.send(atributo) == template.nested_record
|
25
25
|
options[:disabled] = true
|
26
26
|
end
|
27
27
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module PgEngine
|
2
2
|
module Resource
|
3
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
4
3
|
def self.included(clazz)
|
5
4
|
class << clazz
|
6
5
|
# This is a per class variable, all subclasses of clazz inherit it
|
@@ -86,7 +85,6 @@ module PgEngine
|
|
86
85
|
|
87
86
|
clazz.layout :set_layout
|
88
87
|
end
|
89
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
90
88
|
|
91
89
|
def column_options_for(_object, _attribute)
|
92
90
|
{ class: 'text-nowrap' }
|
@@ -293,7 +291,14 @@ module PgEngine
|
|
293
291
|
protected
|
294
292
|
|
295
293
|
def discard_undiscard(method)
|
294
|
+
object = instancia_modelo
|
296
295
|
if instancia_modelo.send(method)
|
296
|
+
if method == :discard
|
297
|
+
ActiveSupport::Notifications.instrument("record_discarded.pg_engine", object)
|
298
|
+
else
|
299
|
+
ActiveSupport::Notifications.instrument("record_restored.pg_engine", object)
|
300
|
+
end
|
301
|
+
|
297
302
|
if accepts_turbo_stream?
|
298
303
|
body = <<~HTML.html_safe
|
299
304
|
<pg-event data-event-name="pg:record-updated" data-reload="true" data-turbo-temporary>
|
@@ -382,7 +387,9 @@ module PgEngine
|
|
382
387
|
|
383
388
|
def pg_respond_update
|
384
389
|
object = instancia_modelo
|
390
|
+
# Maybe lock! to ensure consistency of audits
|
385
391
|
if (@saved = object.save)
|
392
|
+
ActiveSupport::Notifications.instrument("record_updated.pg_engine", object)
|
386
393
|
respond_to do |format|
|
387
394
|
format.html do
|
388
395
|
if params[:inline_attribute].present?
|
@@ -419,6 +426,7 @@ module PgEngine
|
|
419
426
|
def pg_respond_create
|
420
427
|
object = instancia_modelo
|
421
428
|
if (@saved = object.save)
|
429
|
+
ActiveSupport::Notifications.instrument("record_created.pg_engine", object)
|
422
430
|
if in_modal?
|
423
431
|
body = <<~HTML.html_safe
|
424
432
|
<pg-event data-event-name="pg:record-created" data-turbo-temporary
|
@@ -472,9 +480,9 @@ module PgEngine
|
|
472
480
|
end
|
473
481
|
end
|
474
482
|
|
475
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
476
483
|
def pg_respond_destroy(model, land_on = nil)
|
477
484
|
if destroy_model(model)
|
485
|
+
ActiveSupport::Notifications.instrument("record_destroyed.pg_engine", model)
|
478
486
|
# TODO!!: rename to main
|
479
487
|
if turbo_frame? && current_turbo_frame != 'top'
|
480
488
|
body = <<~HTML.html_safe
|
@@ -509,7 +517,6 @@ module PgEngine
|
|
509
517
|
redirect_back(fallback_location: root_path, status: 303)
|
510
518
|
end
|
511
519
|
end
|
512
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
513
520
|
|
514
521
|
def destroy_model(model)
|
515
522
|
@error_message = I18n.t('pg_engine.resource_not_destroyed', model: model.class)
|
@@ -581,12 +588,12 @@ module PgEngine
|
|
581
588
|
if action_name == 'new'
|
582
589
|
params.permit(atributos_permitidos)
|
583
590
|
else
|
584
|
-
params.require(
|
591
|
+
params.require(clase_modelo.model_name.param_key).permit(atributos_permitidos)
|
585
592
|
end
|
586
593
|
end
|
587
594
|
|
588
595
|
def nombre_modelo
|
589
|
-
clase_modelo.
|
596
|
+
clase_modelo.model_name.element
|
590
597
|
end
|
591
598
|
|
592
599
|
def filtros_y_policy(campos, dflt_sort = nil, archived: false)
|
@@ -11,11 +11,19 @@ module PgEngine
|
|
11
11
|
check_postgres
|
12
12
|
check_websocket
|
13
13
|
check_ssl
|
14
|
+
# FIXME: make configurable
|
15
|
+
check_good_job unless ENV.fetch("HEALTH_CHECK_SKIP_GOOD_JOB", nil) == "1"
|
14
16
|
render_up
|
15
17
|
end
|
16
18
|
|
17
19
|
private
|
18
20
|
|
21
|
+
def check_good_job
|
22
|
+
return if GoodJob::Process.active.count.positive?
|
23
|
+
|
24
|
+
raise PgEngine::Error, 'good_job is down'
|
25
|
+
end
|
26
|
+
|
19
27
|
def check_postgres
|
20
28
|
return if User.count.is_a? Integer
|
21
29
|
|
@@ -28,7 +36,6 @@ module PgEngine
|
|
28
36
|
raise PgEngine::Error, 'redis is down'
|
29
37
|
end
|
30
38
|
|
31
|
-
# rubocop:disable Metrics/MethodLength
|
32
39
|
def check_websocket
|
33
40
|
result = nil
|
34
41
|
begin
|
@@ -8,7 +8,7 @@ module PgEngine
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def deserialize(job_data)
|
11
|
-
::Current.app_name = job_data.delete('app_name')
|
11
|
+
::Current.app_name = job_data.delete('app_name')&.to_sym
|
12
12
|
::Current.user = User.find(job_data.delete('user_id')) if job_data['user_id'].present?
|
13
13
|
|
14
14
|
super
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module PgEngine
|
2
2
|
module Test
|
3
3
|
class DummyBrand < PgEngine::SiteBrand
|
4
|
-
def initialize(
|
4
|
+
def initialize(skip_default_url_options: Rails.env.test?)
|
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
|
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(
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
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
|
data/pg_layout/app/lib/navbar.rb
CHANGED
@@ -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'
|
data/pg_rails/lib/version.rb
CHANGED
@@ -82,7 +82,7 @@ module PgFactoryBot
|
|
82
82
|
'Faker::Lorem.sentence'
|
83
83
|
elsif attribute.type == :date
|
84
84
|
'Faker::Date.backward'
|
85
|
-
elsif
|
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:
|
19
|
-
class_option :request_specs, type: :boolean, default:
|
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/
|
37
|
-
expect(content).to match(/
|
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.
|
4
|
+
version: 7.6.43
|
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-
|
11
|
+
date: 2025-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|