pg_rails 7.6.17 → 7.6.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/pg_associable/app/javascript/modal_controller.js +17 -1
- data/pg_engine/app/assets/stylesheets/pg_rails_b5.scss +8 -1
- data/pg_engine/app/components/inline_edit/inline_show_component.html.slim +2 -1
- data/pg_engine/app/components/search_bar_toggler_component.html.slim +5 -3
- data/pg_engine/app/controllers/admin/accounts_controller.rb +0 -4
- data/pg_engine/app/controllers/admin/email_logs_controller.rb +0 -4
- data/pg_engine/app/controllers/admin/emails_controller.rb +0 -4
- data/pg_engine/app/controllers/admin/simple_user_notifiers_controller.rb +0 -2
- data/pg_engine/app/controllers/admin/user_accounts_controller.rb +0 -4
- data/pg_engine/app/controllers/admin/users_controller.rb +0 -4
- data/pg_engine/app/controllers/concerns/pg_engine/resource.rb +121 -41
- data/pg_engine/app/controllers/public/mensaje_contactos_controller.rb +0 -4
- data/pg_engine/app/controllers/users/accounts_controller.rb +0 -4
- data/pg_engine/app/decorators/pg_engine/base_record_decorator.rb +39 -13
- data/pg_engine/app/helpers/pg_engine/index_helper.rb +17 -3
- data/pg_engine/app/helpers/pg_engine/route_helper.rb +4 -0
- data/pg_engine/app/lib/pg_engine/filtros_builder.rb +7 -9
- data/pg_engine/app/models/account.rb +2 -0
- data/pg_engine/app/models/concerns/pg_engine/naming.rb +5 -0
- data/pg_engine/app/models/pg_engine/base_record.rb +1 -4
- data/pg_engine/app/models/user.rb +1 -1
- data/pg_engine/app/policies/account_policy.rb +9 -9
- data/pg_engine/app/policies/pg_engine/base_policy.rb +15 -3
- data/pg_engine/app/views/admin/accounts/show.html.slim +0 -7
- data/pg_engine/app/views/admin/email_logs/show.html.slim +0 -7
- data/pg_engine/app/views/admin/emails/show.html.slim +0 -7
- data/pg_engine/app/views/admin/simple_user_notifiers/show.html.slim +0 -5
- data/pg_engine/app/views/admin/user_accounts/show.html.slim +0 -7
- data/pg_engine/app/views/admin/users/show.html.slim +1 -5
- data/pg_engine/app/views/pg_engine/base/index.html.slim +39 -14
- data/pg_engine/config/locales/es.rb +42 -0
- data/pg_engine/config/locales/es.yml +1 -6
- data/pg_engine/lib/pg_engine/route_helpers.rb +5 -0
- data/pg_engine/spec/controllers/admin/accounts_controller_spec.rb +4 -9
- data/pg_engine/spec/controllers/admin/email_logs_controller_spec.rb +4 -4
- data/pg_engine/spec/controllers/admin/emails_controller_spec.rb +4 -4
- data/pg_engine/spec/controllers/admin/user_accounts_controller_spec.rb +4 -4
- data/pg_engine/spec/controllers/admin/users_controller_spec.rb +4 -9
- data/pg_engine/spec/requests/resource_spec.rb +84 -0
- data/pg_engine/spec/requests/users/switcher_spec.rb +2 -2
- data/pg_engine/spec/system/breadcrumbs_spec.rb +9 -21
- data/pg_engine/spec/system/destroy_spec.rb +3 -3
- data/pg_engine/spec/system/login_spec.rb +1 -1
- data/pg_engine/spec/system/modal_windows_spec.rb +5 -5
- data/pg_engine/spec/system/tenants_spec.rb +2 -2
- data/pg_layout/app/javascript/application.js +4 -2
- data/pg_layout/app/javascript/controllers/embedded_frame_controller.js +4 -0
- data/pg_layout/app/views/layouts/pg_layout/base.html.slim +1 -0
- data/pg_layout/app/views/layouts/pg_layout/show.html.slim +10 -0
- data/pg_rails/lib/version.rb +1 -1
- data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/controller_spec.rb +4 -11
- data/pg_scaffold/lib/generators/pg_scaffold/templates/controller.rb +1 -5
- data/pg_scaffold/lib/generators/pg_slim/templates/show.html.slim +0 -7
- metadata +5 -3
- data/pg_engine/app/components/actions_component.rb +0 -14
@@ -8,34 +8,27 @@ require 'rails_helper'
|
|
8
8
|
#
|
9
9
|
# DRIVER=selenium rspec
|
10
10
|
describe 'Breadcrumbs' do
|
11
|
-
subject(:visitar) do
|
12
|
-
visit path
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:path) { "/a/cosas/#{cosa.id}" }
|
16
11
|
let(:cosa) { create :cosa }
|
17
|
-
let(:logged_user) { create :user, :developer }
|
18
12
|
|
19
13
|
before do
|
20
|
-
login_as
|
14
|
+
login_as create :user, :developer
|
15
|
+
|
16
|
+
# just to sort a circumvent a capybara issue
|
17
|
+
create_list :cosa, 1, categoria_de_cosa: cosa.categoria_de_cosa
|
21
18
|
end
|
22
19
|
|
23
20
|
describe 'some case' do
|
24
21
|
it do
|
25
|
-
|
22
|
+
visit "/a/cosas/#{cosa.id}"
|
26
23
|
|
27
24
|
expect(page).to have_css('nav ol.breadcrumb li').exactly(3)
|
28
25
|
expect(page).to have_css('nav ol.breadcrumb li a').exactly(1)
|
29
26
|
end
|
30
27
|
|
31
28
|
context 'cuando es con nested' do
|
32
|
-
let(:path) do
|
33
|
-
hashid = cosa.categoria_de_cosa.hashid
|
34
|
-
"/a/categoria_de_cosas/#{hashid}/cosas/#{cosa.id}"
|
35
|
-
end
|
36
|
-
|
37
29
|
it do
|
38
|
-
|
30
|
+
hashid = cosa.categoria_de_cosa.hashid
|
31
|
+
visit "/a/categoria_de_cosas/#{hashid}/cosas/#{cosa.id}"
|
39
32
|
|
40
33
|
expect(page).to have_css('nav ol.breadcrumb li').exactly(4)
|
41
34
|
expect(page).to have_css('nav ol.breadcrumb li a').exactly(1)
|
@@ -43,14 +36,9 @@ describe 'Breadcrumbs' do
|
|
43
36
|
end
|
44
37
|
|
45
38
|
context 'cuando es con nested y modal' do
|
46
|
-
let(:path) do
|
47
|
-
hashid = cosa.categoria_de_cosa.hashid
|
48
|
-
"/a/categoria_de_cosas/#{hashid}"
|
49
|
-
end
|
50
|
-
|
51
39
|
it do
|
52
|
-
|
53
|
-
|
40
|
+
visit "/a/categoria_de_cosas/#{cosa.categoria_de_cosa.hashid}"
|
41
|
+
find_all('td span[title=Ver] a').first.click
|
54
42
|
|
55
43
|
expect(page).to have_css('.modal nav ol.breadcrumb li').exactly(4)
|
56
44
|
expect(page).to have_no_css('.modal nav ol.breadcrumb li a')
|
@@ -8,7 +8,7 @@ describe 'Sign in' do
|
|
8
8
|
shared_examples 'destroy from index' do
|
9
9
|
subject do
|
10
10
|
accept_confirm do
|
11
|
-
find("##{dom_id(cosa)} span[title
|
11
|
+
find("##{dom_id(cosa)} span[title=\"Eliminar definitivamente\"] a").click
|
12
12
|
end
|
13
13
|
sleep 1
|
14
14
|
end
|
@@ -30,7 +30,7 @@ describe 'Sign in' do
|
|
30
30
|
shared_examples 'destroy from show' do
|
31
31
|
subject do
|
32
32
|
accept_confirm do
|
33
|
-
find('.btn-toolbar span[title=Eliminar] a').click
|
33
|
+
find('.btn-toolbar span[title="Eliminar definitivamente"] a').click
|
34
34
|
end
|
35
35
|
sleep 1
|
36
36
|
end
|
@@ -46,7 +46,7 @@ describe 'Sign in' do
|
|
46
46
|
it 'muestra el flash' do
|
47
47
|
subject
|
48
48
|
expect(page).to have_current_path('/a/cosas')
|
49
|
-
expect(page).to have_text('
|
49
|
+
expect(page).to have_text('Se eliminó el coso')
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -66,23 +66,23 @@ describe 'Modal windows' do
|
|
66
66
|
visit '/a/cosas'
|
67
67
|
find('span[title=Ver] a').click
|
68
68
|
accept_confirm do
|
69
|
-
find('.modal span[title=Eliminar] a').click
|
69
|
+
find('.modal span[title="Eliminar definitivamente"] a').click
|
70
70
|
end
|
71
|
-
expect(page).to have_text 'No hay
|
71
|
+
expect(page).to have_text 'No hay ningún coso que mostrar'
|
72
72
|
end
|
73
73
|
|
74
74
|
context 'cuando da error' do
|
75
75
|
before do
|
76
|
-
allow_any_instance_of(Cosa).to receive(:
|
76
|
+
allow_any_instance_of(Cosa).to receive(:destroy).and_return(false)
|
77
77
|
end
|
78
78
|
|
79
79
|
it do
|
80
80
|
visit '/a/cosas'
|
81
81
|
find('span[title=Ver] a').click
|
82
82
|
accept_confirm do
|
83
|
-
find('.modal span[title=Eliminar] a').click
|
83
|
+
find('.modal span[title="Eliminar definitivamente"] a').click
|
84
84
|
end
|
85
|
-
expect(page).to have_text '
|
85
|
+
expect(page).to have_text 'Hubo un error al intentar eliminar el coso'
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
@@ -22,7 +22,7 @@ describe 'Tenants' do
|
|
22
22
|
it do
|
23
23
|
visitar
|
24
24
|
|
25
|
-
expect(page).to have_text 'No hay
|
25
|
+
expect(page).to have_text 'No hay ningún coso que mostrar'
|
26
26
|
end
|
27
27
|
|
28
28
|
context 'when belongs to multiple accounts' do
|
@@ -45,7 +45,7 @@ describe 'Tenants' do
|
|
45
45
|
|
46
46
|
click_on other_account.to_s
|
47
47
|
visit '/u/categoria_de_cosas'
|
48
|
-
expect(page).to have_text 'No hay
|
48
|
+
expect(page).to have_text 'No hay ninguna categoría de cosa que mostrar'
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'shows the profile form' do
|
@@ -65,10 +65,12 @@ document.addEventListener('pg:record-destroyed', (ev) => {
|
|
65
65
|
|
66
66
|
document.addEventListener('turbo:before-fetch-request', (ev) => {
|
67
67
|
// Si es POST, quito la opción text/vnd.turbo-stream.html para que
|
68
|
-
// on successful redirect no haya posibilidad de que se abra un modal
|
68
|
+
// on successful redirect no haya posibilidad de que se abra un modal.
|
69
|
+
// Si el link o form tiene data-turbo-stream entonces no se pisa el header.
|
69
70
|
// FIXME: buscar una manera mejor de hacerlo porque es para problemas
|
70
71
|
// quizás, con la movida de abrir modales desde JS
|
71
|
-
if (ev.detail.fetchOptions.method.toLowerCase() === 'post'
|
72
|
+
if (ev.detail.fetchOptions.method.toLowerCase() === 'post' &&
|
73
|
+
ev.target.dataset.turboStream === undefined) {
|
72
74
|
ev.detail.fetchOptions.headers.Accept = 'text/html, application/xhtml+xml'
|
73
75
|
}
|
74
76
|
|
@@ -6,5 +6,9 @@ export default class extends Controller {
|
|
6
6
|
this.element.querySelector('turbo-frame').reload()
|
7
7
|
ev.stopPropagation()
|
8
8
|
})
|
9
|
+
this.element.addEventListener('pg:record-updated', (ev) => {
|
10
|
+
this.element.querySelector('turbo-frame').reload()
|
11
|
+
ev.stopPropagation()
|
12
|
+
})
|
9
13
|
}
|
10
14
|
}
|
data/pg_rails/lib/version.rb
CHANGED
@@ -243,11 +243,11 @@ RSpec.describe <%= controller_class_name %>Controller do
|
|
243
243
|
describe 'DELETE #destroy' do
|
244
244
|
subject do
|
245
245
|
request.headers['Accept'] = 'text/vnd.turbo-stream.html,text/html'
|
246
|
-
delete :destroy, params: { id: <%= file_name %>.to_param,
|
246
|
+
delete :destroy, params: { id: <%= file_name %>.to_param, land_on: }
|
247
247
|
end
|
248
248
|
|
249
249
|
let!(:<%= nombre_tabla_completo_singular %>) { create :<%= nombre_tabla_completo_singular %> }
|
250
|
-
let(:
|
250
|
+
let(:land_on) { nil }
|
251
251
|
|
252
252
|
it 'destroys the requested <%= nombre_tabla_completo_singular %>' do
|
253
253
|
<% if options[:discard] -%>
|
@@ -259,20 +259,13 @@ RSpec.describe <%= controller_class_name %>Controller do
|
|
259
259
|
<% end -%>
|
260
260
|
end
|
261
261
|
|
262
|
-
<% if options[:discard] -%>
|
263
|
-
it 'setea el discarded_at' do
|
264
|
-
subject
|
265
|
-
expect(<%= nombre_tabla_completo_singular %>.reload.discarded_at).to be_present
|
266
|
-
end
|
267
|
-
|
268
|
-
<% end -%>
|
269
262
|
it 'envía el pg-event' do
|
270
263
|
subject
|
271
264
|
expect(response.body).to include('<pg-event data-event-name="pg:record-destroyed"')
|
272
265
|
end
|
273
266
|
|
274
|
-
context 'si hay
|
275
|
-
let(:
|
267
|
+
context 'si hay land_on' do
|
268
|
+
let(:land_on) { :index }
|
276
269
|
|
277
270
|
it 'redirects to the <%= table_name %> list' do
|
278
271
|
subject
|
@@ -9,13 +9,9 @@ require_dependency "<%= namespaced_path %>/application_controller"
|
|
9
9
|
<% module_namespacing do -%>
|
10
10
|
<% module_namespacing_2 do -%>
|
11
11
|
class <%= controller_class_name.split('::').last %>Controller < <%= parent_controller %>
|
12
|
-
before_action { @clase_modelo = <%= class_name.split('::').last %> }
|
13
|
-
|
14
12
|
include PgEngine::Resource
|
15
13
|
|
16
|
-
|
17
|
-
|
18
|
-
before_action :set_instancia_modelo, only: %i[new create show edit update destroy]
|
14
|
+
self.clase_modelo = <%= class_name.split('::').last %>
|
19
15
|
|
20
16
|
private
|
21
17
|
|
@@ -1,10 +1,3 @@
|
|
1
|
-
- content_for :title do
|
2
|
-
= @<%= singular_name %>.to_s
|
3
|
-
- content_for :actions do
|
4
|
-
= @<%= singular_name %>.destroy_link_redirect
|
5
|
-
.ms-1
|
6
|
-
= @<%= singular_name %>.edit_link
|
7
|
-
|
8
1
|
table.table.table-borderless.table-sm.w-auto.mb-0
|
9
2
|
- atributos_para_mostrar.each do |att|
|
10
3
|
tr
|
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.18
|
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-10-
|
11
|
+
date: 2024-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -663,7 +663,6 @@ files:
|
|
663
663
|
- pg_engine/app/assets/stylesheets/active_admin.scss
|
664
664
|
- pg_engine/app/assets/stylesheets/notifications.scss
|
665
665
|
- pg_engine/app/assets/stylesheets/pg_rails_b5.scss
|
666
|
-
- pg_engine/app/components/actions_component.rb
|
667
666
|
- pg_engine/app/components/alert_component.html.slim
|
668
667
|
- pg_engine/app/components/alert_component.rb
|
669
668
|
- pg_engine/app/components/asociable_modal_component.html.slim
|
@@ -816,6 +815,7 @@ files:
|
|
816
815
|
- pg_engine/config/initializers/view_component.rb
|
817
816
|
- pg_engine/config/initializers/zeitwerk.rb
|
818
817
|
- pg_engine/config/locales/devise.en.yml
|
818
|
+
- pg_engine/config/locales/es.rb
|
819
819
|
- pg_engine/config/locales/es.yml
|
820
820
|
- pg_engine/config/routes.rb
|
821
821
|
- pg_engine/config/simple_form/simple_form.rb
|
@@ -904,6 +904,7 @@ files:
|
|
904
904
|
- pg_engine/spec/requests/current_attributes_spec.rb
|
905
905
|
- pg_engine/spec/requests/devise_spec.rb
|
906
906
|
- pg_engine/spec/requests/public/webhooks_spec.rb
|
907
|
+
- pg_engine/spec/requests/resource_spec.rb
|
907
908
|
- pg_engine/spec/requests/users/accounts_spec.rb
|
908
909
|
- pg_engine/spec/requests/users/base_controller_spec.rb
|
909
910
|
- pg_engine/spec/requests/users/dashboard_spec.rb
|
@@ -987,6 +988,7 @@ files:
|
|
987
988
|
- pg_layout/app/views/layouts/pg_layout/devise.html.slim
|
988
989
|
- pg_layout/app/views/layouts/pg_layout/mailer.html.slim
|
989
990
|
- pg_layout/app/views/layouts/pg_layout/mailer.text.erb
|
991
|
+
- pg_layout/app/views/layouts/pg_layout/show.html.slim
|
990
992
|
- pg_layout/app/views/pg_layout/_flash.html.slim
|
991
993
|
- pg_layout/app/views/pg_layout/_navbar.html.erb
|
992
994
|
- pg_layout/app/views/pg_layout/_sidebar.html.erb
|