pg_rails 7.2.3 → 7.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/pg_associable/app/helpers/pg_associable/form_builder_methods.rb +9 -2
  3. data/pg_associable/app/helpers/pg_associable/helpers.rb +4 -5
  4. data/pg_associable/app/javascript/modal_controller.js +80 -6
  5. data/pg_associable/spec/system/associable_spec.rb +30 -7
  6. data/pg_engine/app/assets/stylesheets/pg_rails_b5.scss +5 -0
  7. data/pg_engine/app/components/actions_component.rb +14 -0
  8. data/pg_engine/app/components/asociable_modal_component.html.slim +6 -0
  9. data/pg_engine/app/components/asociable_modal_component.rb +7 -0
  10. data/pg_engine/app/components/date_selector_component.rb +2 -2
  11. data/pg_engine/app/components/modal_component.html.slim +5 -0
  12. data/pg_engine/app/components/modal_component.rb +11 -0
  13. data/pg_engine/app/components/modal_content_component.rb +29 -0
  14. data/pg_engine/app/components/search_bar_component.html.slim +1 -1
  15. data/pg_engine/app/controllers/admin/accounts_controller.rb +1 -1
  16. data/pg_engine/app/controllers/admin/email_logs_controller.rb +1 -1
  17. data/pg_engine/app/controllers/admin/emails_controller.rb +4 -21
  18. data/pg_engine/app/controllers/admin/user_accounts_controller.rb +1 -1
  19. data/pg_engine/app/controllers/admin/users_controller.rb +1 -1
  20. data/pg_engine/app/controllers/concerns/pg_engine/resource.rb +288 -133
  21. data/pg_engine/app/controllers/pg_engine/base_controller.rb +5 -0
  22. data/pg_engine/app/controllers/public/mensaje_contactos_controller.rb +1 -1
  23. data/pg_engine/app/decorators/pg_engine/base_record_decorator.rb +36 -10
  24. data/pg_engine/app/helpers/pg_engine/flash_helper.rb +6 -2
  25. data/pg_engine/app/helpers/pg_engine/form_helper.rb +15 -2
  26. data/pg_engine/app/helpers/pg_engine/frame_helper.rb +52 -0
  27. data/pg_engine/app/lib/pg_engine/bootstrap5_breadcrumbs_builder.rb +22 -0
  28. data/pg_engine/app/lib/pg_engine/filtros_builder.rb +3 -2
  29. data/pg_engine/app/models/current.rb +1 -1
  30. data/pg_engine/app/models/email.rb +2 -0
  31. data/pg_engine/app/models/pg_engine/base_record.rb +13 -0
  32. data/pg_engine/app/views/admin/accounts/_form.html.slim +1 -4
  33. data/pg_engine/app/views/admin/email_logs/_form.html.slim +2 -5
  34. data/pg_engine/app/views/admin/emails/_form.html.slim +13 -13
  35. data/pg_engine/app/views/admin/emails/_send.html.slim +0 -1
  36. data/pg_engine/app/views/admin/emails/show.html.slim +19 -20
  37. data/pg_engine/app/views/admin/eventos/new.html.slim +0 -2
  38. data/pg_engine/app/views/admin/user_accounts/_form.html.slim +1 -4
  39. data/pg_engine/app/views/admin/users/_form.html.slim +1 -4
  40. data/pg_engine/app/views/pg_engine/base/edit.html.slim +1 -2
  41. data/pg_engine/app/views/pg_engine/base/index.html.slim +6 -3
  42. data/pg_engine/app/views/pg_engine/base/new.html.slim +1 -2
  43. data/pg_engine/app/views/public/mensaje_contactos/new.html.slim +2 -5
  44. data/pg_engine/config/initializers/kaminari.rb +3 -0
  45. data/pg_engine/config/initializers/ransack_memory.rb +13 -2
  46. data/pg_engine/config/locales/es.yml +1 -1
  47. data/pg_engine/lib/pg_engine/utils/pg_logger.rb +10 -10
  48. data/pg_engine/spec/controllers/admin/accounts_controller_spec.rb +2 -2
  49. data/pg_engine/spec/controllers/admin/email_logs_controller_spec.rb +2 -2
  50. data/pg_engine/spec/controllers/admin/emails_controller_spec.rb +2 -2
  51. data/pg_engine/spec/controllers/admin/user_accounts_controller_spec.rb +2 -2
  52. data/pg_engine/spec/controllers/admin/users_controller_spec.rb +2 -2
  53. data/pg_engine/spec/controllers/concerns/pg_engine/resource_helper_spec.rb +0 -2
  54. data/pg_engine/spec/lib/pg_engine/form_helper_spec.rb +51 -0
  55. data/pg_engine/spec/system/breadcrumbs_spec.rb +61 -0
  56. data/pg_engine/spec/system/destroy_spec.rb +1 -1
  57. data/pg_engine/spec/system/login_spec.rb +1 -1
  58. data/pg_engine/spec/system/modal_windows_spec.rb +89 -0
  59. data/pg_engine/spec/system/send_mail_spec.rb +1 -1
  60. data/pg_layout/app/javascript/application.js +38 -0
  61. data/pg_layout/app/javascript/config/turbo_rails/index.js +4 -1
  62. data/pg_layout/app/javascript/controllers/embedded_frame_controller.js +10 -0
  63. data/pg_layout/app/javascript/controllers/index.js +2 -0
  64. data/pg_layout/app/javascript/controllers/popover_toggler_controller.js +3 -2
  65. data/pg_layout/app/javascript/controllers/tooltip_controller.js +8 -0
  66. data/pg_layout/app/javascript/elements/index.js +1 -0
  67. data/pg_layout/app/javascript/elements/pg_event.js +13 -0
  68. data/pg_layout/app/views/devise/confirmations/new.html.erb +0 -1
  69. data/pg_layout/app/views/devise/passwords/edit.html.erb +0 -2
  70. data/pg_layout/app/views/devise/passwords/new.html.erb +0 -2
  71. data/pg_layout/app/views/devise/registrations/edit.html.erb +0 -2
  72. data/pg_layout/app/views/devise/registrations/new.html.erb +0 -2
  73. data/pg_layout/app/views/devise/unlocks/new.html.erb +0 -1
  74. data/pg_layout/app/views/layouts/pg_layout/base.html.slim +45 -17
  75. data/pg_layout/app/views/layouts/pg_layout/containerized.html.slim +1 -1
  76. data/pg_rails/lib/version.rb +1 -1
  77. data/pg_rails/scss/bootstrap_overrides.scss +2 -1
  78. data/pg_rails/scss/pg_rails.scss +8 -1
  79. data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/controller_spec.rb +2 -2
  80. data/pg_scaffold/lib/generators/pg_scaffold/templates/controller.rb +2 -4
  81. data/pg_scaffold/lib/generators/pg_slim/templates/_form.html.slim +2 -5
  82. data/pg_scaffold/lib/generators/pg_slim/templates/show.html.slim +1 -1
  83. metadata +17 -4
  84. data/pg_associable/app/views/pg_engine/base/_pg_associable_modal.html.slim +0 -14
  85. data/pg_layout/app/views/pg_layout/_modal_show.html.slim +0 -14
@@ -0,0 +1,61 @@
1
+ # Initially generated with PgRails::SystemSpecGenerator
2
+ # https://github.com/martin-rosso/pg_rails
3
+
4
+ require 'rails_helper'
5
+
6
+ # By default uses selenium_chrome_headless_iphone driver
7
+ # run with DRIVER environment variable to override, eg:
8
+ #
9
+ # DRIVER=selenium rspec
10
+ describe 'Breadcrumbs' do
11
+ subject(:visitar) do
12
+ visit path
13
+ end
14
+
15
+ let(:path) { "/admin/cosas/#{cosa.id}" }
16
+ let(:cosa) { create :cosa }
17
+ let(:logged_user) { create :user, :developer }
18
+ let(:account) { logged_user.current_account }
19
+
20
+ before do
21
+ login_as logged_user
22
+ end
23
+
24
+ describe 'some case' do
25
+ it do
26
+ visitar
27
+
28
+ expect(page).to have_css('nav ol.breadcrumb li').exactly(2)
29
+ expect(page).to have_css('nav ol.breadcrumb li a').exactly(1)
30
+ end
31
+
32
+ context 'cuando es con nested' do
33
+ let(:path) do
34
+ hashid = cosa.categoria_de_cosa.hashid
35
+ "/admin/categoria_de_cosas/#{hashid}/cosas/#{cosa.id}"
36
+ end
37
+
38
+ it do
39
+ visitar
40
+
41
+ expect(page).to have_css('nav ol.breadcrumb li').exactly(3)
42
+ expect(page).to have_css('nav ol.breadcrumb li a').exactly(1)
43
+ end
44
+ end
45
+
46
+ context 'cuando es con nested y modal' do
47
+ let(:path) do
48
+ hashid = cosa.categoria_de_cosa.hashid
49
+ "/admin/categoria_de_cosas/#{hashid}"
50
+ end
51
+
52
+ it do
53
+ visitar
54
+ find('td span[title=Ver] a').click
55
+
56
+ expect(page).to have_css('.modal nav ol.breadcrumb li').exactly(3)
57
+ expect(page).to have_no_css('.modal nav ol.breadcrumb li a')
58
+ end
59
+ end
60
+ end
61
+ end
@@ -43,7 +43,7 @@ describe 'Sign in' do
43
43
  visit "/frontend/cosas/#{cosa.to_param}"
44
44
  end
45
45
 
46
- it do
46
+ it 'muestra el flash' do
47
47
  subject
48
48
  expect(page).to have_current_path('/frontend/cosas')
49
49
  expect(page).to have_text('Coso borrado')
@@ -16,7 +16,7 @@ describe 'Sign in' do
16
16
 
17
17
  it do
18
18
  subject
19
- expect(page).to have_text :all, 'No hay categorías de cosas aún'
19
+ expect(page).to have_text :all, 'No hay categorías de cosas que mostrar'
20
20
  end
21
21
  end
22
22
 
@@ -0,0 +1,89 @@
1
+ # Initially generated with PgRails::SystemSpecGenerator
2
+ # https://github.com/martin-rosso/pg_rails
3
+
4
+ require 'rails_helper'
5
+
6
+ # By default uses selenium_chrome_headless_iphone driver
7
+ # run with DRIVER environment variable to override, eg:
8
+ #
9
+ # DRIVER=selenium rspec
10
+ describe 'Modal windows' do
11
+ subject(:visitar) do
12
+ visit '/admin/cosas'
13
+ end
14
+
15
+ let(:logged_user) { create :user, :developer }
16
+ let(:account) { logged_user.current_account }
17
+ let!(:categoria_de_cosa) { create :categoria_de_cosa }
18
+
19
+ before do
20
+ login_as logged_user
21
+ end
22
+
23
+ describe 'crear con modal' do
24
+ it do
25
+ visitar
26
+ click_on 'Cargar coso'
27
+ select 'Completar', from: 'cosa_tipo'
28
+ select categoria_de_cosa.to_s, from: 'cosa_categoria_de_cosa_id'
29
+ find('.modal input[type=submit]').click
30
+ expect(page).to have_text 'Por favor, revisá los campos obligatorios'
31
+ fill_in 'cosa_nombre', with: 'bla'
32
+ find('.modal input[type=submit]').click
33
+ expect(page).to have_text 'bla'
34
+ end
35
+ end
36
+
37
+ describe 'show con modal' do
38
+ let!(:cosa) { create :cosa, categoria_de_cosa: }
39
+
40
+ it do
41
+ visit '/admin/cosas/' + cosa.to_param
42
+ click_on 'Ver categoría'
43
+ expect(page).to have_css '.modal', text: categoria_de_cosa.nombre
44
+ end
45
+ end
46
+
47
+ describe 'edit con modal' do
48
+ let!(:cosa) { create :cosa, categoria_de_cosa: }
49
+
50
+ it do
51
+ visit '/admin/cosas/' + cosa.to_param
52
+ click_on 'Modificar'
53
+ fill_in 'Nombre', with: ''
54
+ find('.modal input[type=submit]').click
55
+ expect(page).to have_text 'Por favor, revisá los campos obligatorios'
56
+ fill_in 'Nombre', with: 'bla'
57
+ find('.modal input[type=submit]').click
58
+ expect(page).to have_text 'bla'
59
+ end
60
+ end
61
+
62
+ describe 'destroy con modal' do
63
+ before { create :cosa, categoria_de_cosa: }
64
+
65
+ it do
66
+ visit '/admin/cosas'
67
+ find('span[title=Ver] a').click
68
+ accept_confirm do
69
+ find('.modal span[title=Eliminar] a').click
70
+ end
71
+ expect(page).to have_text 'No hay cosos que mostrar'
72
+ end
73
+
74
+ context 'cuando da error' do
75
+ before do
76
+ allow_any_instance_of(Cosa).to receive(:discard).and_return(false)
77
+ end
78
+
79
+ it do
80
+ visit '/admin/cosas'
81
+ find('span[title=Ver] a').click
82
+ accept_confirm do
83
+ find('.modal span[title=Eliminar] a').click
84
+ end
85
+ expect(page).to have_text 'No se pudo eliminar el registro'
86
+ end
87
+ end
88
+ end
89
+ end
@@ -13,7 +13,7 @@ describe 'Enviar email' do
13
13
  # click_on 'Enviar'
14
14
  # expect(page).to have_text 'revisá los campos obligatorios'
15
15
  fill_in 'email_to', with: Faker::Internet.email
16
- click_on 'Enviar'
16
+ click_on 'Crear Email'
17
17
  end
18
18
 
19
19
  around do |example|
@@ -1,3 +1,41 @@
1
1
  import './config'
2
2
  import './channels'
3
3
  import './controllers'
4
+ import './elements'
5
+
6
+ import { Turbo } from '@hotwired/turbo-rails'
7
+
8
+ document.addEventListener('pg:record-created', (ev) => {
9
+ Turbo.visit(window.location)
10
+ setTimeout(() => {
11
+ Turbo.cache.clear()
12
+ }, 1000)
13
+ })
14
+
15
+ document.addEventListener('pg:record-updated', (ev) => {
16
+ Turbo.visit(window.location)
17
+ setTimeout(() => {
18
+ Turbo.cache.clear()
19
+ }, 1000)
20
+ })
21
+
22
+ document.addEventListener('pg:record-destroyed', (ev) => {
23
+ Turbo.visit(window.location)
24
+ setTimeout(() => {
25
+ Turbo.cache.clear()
26
+ }, 1000)
27
+ })
28
+
29
+ document.addEventListener('turbo:before-fetch-request', (ev) => {
30
+ // Si es POST, quito la opción text/vnd.turbo-stream.html para que
31
+ // on successful redirect no haya posibilidad de que se abra un modal
32
+ // FIXME: buscar una manera mejor de hacerlo porque es para problemas
33
+ // quizás, con la movida de abrir modales desde JS
34
+ if (ev.detail.fetchOptions.method === 'post') {
35
+ ev.detail.fetchOptions.headers.Accept = 'text/html, application/xhtml+xml'
36
+ }
37
+
38
+ if (document.querySelector('.modal.show')) {
39
+ ev.detail.fetchOptions.headers['Modal-Opened'] = true
40
+ }
41
+ })
@@ -9,7 +9,10 @@ import '@hotwired/turbo-rails'
9
9
  // TODO: testear con capybara
10
10
  document.addEventListener('turbo:before-cache', () => {
11
11
  document.querySelectorAll('#flash .alert').forEach((el) => {
12
- el.remove()
12
+ // FIXME: en los destroy desde main frame, turbo llama a before-cache
13
+ // después de renderear el redirect, por eso no puedo hacer el remove
14
+ //
15
+ // el.remove()
13
16
  })
14
17
  document.querySelectorAll('.offcanvas-backdrop').forEach((el) => {
15
18
  el.remove()
@@ -0,0 +1,10 @@
1
+ import { Controller } from '@hotwired/stimulus'
2
+
3
+ export default class extends Controller {
4
+ connect () {
5
+ this.element.addEventListener('pg:record-destroyed', (ev) => {
6
+ this.element.querySelector('turbo-frame').reload()
7
+ ev.stopPropagation()
8
+ })
9
+ }
10
+ }
@@ -14,6 +14,7 @@ import TooltipController from './tooltip_controller'
14
14
  import PopoverController from './popover_controller'
15
15
  import PopoverTogglerController from './popover_toggler_controller'
16
16
  import DateSelectorController from './date_selector_controller'
17
+ import EmbeddedFrameController from './embedded_frame_controller'
17
18
 
18
19
  application.register('navbar', NavbarController)
19
20
  application.register('nested', NestedController)
@@ -29,5 +30,6 @@ application.register('tooltip', TooltipController)
29
30
  application.register('popover', PopoverController)
30
31
  application.register('popover-toggler', PopoverTogglerController)
31
32
  application.register('date-selector', DateSelectorController)
33
+ application.register('embedded-frame', EmbeddedFrameController)
32
34
 
33
35
  // TODO: testear con capybara todo lo que se pueda
@@ -5,9 +5,11 @@ export default class extends Controller {
5
5
  popover = null
6
6
 
7
7
  connect () {
8
+ const container = this.element.closest('.modal-body') ? '.modal-body' : 'body'
8
9
  this.popover = new bootstrap.Popover(this.element, {
9
10
  // WARNING: don't use for user input html
10
11
  sanitize: false,
12
+ container,
11
13
  template: `
12
14
  <div class="popover" role="tooltip" data-controller="popover">
13
15
  <div class="popover-arrow"></div>
@@ -16,8 +18,7 @@ export default class extends Controller {
16
18
  <div class="popover-body">
17
19
  </div>
18
20
  </div>
19
- `,
20
- container: 'body'
21
+ `
21
22
  })
22
23
  }
23
24
 
@@ -20,6 +20,14 @@ export default class extends Controller {
20
20
  }
21
21
  }
22
22
 
23
+ setContent (content) {
24
+ this.tooltip.setContent({ '.tooltip-inner': content })
25
+ }
26
+
27
+ hide () {
28
+ this.tooltip.hide()
29
+ }
30
+
23
31
  disconnect () {
24
32
  if (this.tooltip) {
25
33
  this.tooltip.dispose()
@@ -0,0 +1 @@
1
+ import './pg_event'
@@ -0,0 +1,13 @@
1
+ class PgEventElement extends HTMLElement {
2
+ connectedCallback () {
3
+ const event = new MessageEvent(this.dataset.eventName, { bubbles: true, data: this })
4
+ this.dispatchEvent(event)
5
+ }
6
+
7
+ disconnectedCallback () {
8
+ }
9
+ }
10
+
11
+ if (customElements.get('pg-event') === undefined) {
12
+ customElements.define('pg-event', PgEventElement)
13
+ }
@@ -1,5 +1,4 @@
1
1
  <%= pg_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
2
- <%= f.mensajes_de_error %>
3
2
  <%= f.full_error :confirmation_token %>
4
3
 
5
4
  <div class="form-inputs">
@@ -1,8 +1,6 @@
1
1
  <h2><%= t(".change_your_password") %></h2>
2
2
 
3
3
  <%= pg_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
4
- <%= f.mensajes_de_error %>
5
-
6
4
  <%= f.input :reset_password_token, as: :hidden %>
7
5
  <%= f.full_error :reset_password_token %>
8
6
 
@@ -1,8 +1,6 @@
1
1
  <h2><%= t(".forgot_your_password") %></h2>
2
2
 
3
3
  <%= pg_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
4
- <%= f.mensajes_de_error %>
5
-
6
4
  <div class="form-inputs">
7
5
  <%= f.input :email,
8
6
  required: true,
@@ -1,8 +1,6 @@
1
1
  <h2><%= t(".title", resource: devise_i18n_fix_model_name_case(resource.model_name.human, i18n_key: "registrations.edit.title")) %></h2>
2
2
 
3
3
  <%= pg_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4
- <%= f.mensajes_de_error %>
5
-
6
4
  <div class="form-inputs">
7
5
  <%= f.input :email, required: true, autofocus: true %>
8
6
  <%= f.input :nombre, required: true %>
@@ -1,8 +1,6 @@
1
1
  <h2><%= t(".sign_up") %></h2>
2
2
  <div id="form-signup" data-controller="pg_form">
3
3
  <%= pg_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
4
- <%= f.mensajes_de_error %>
5
-
6
4
  <div class="form-inputs">
7
5
  <%= f.input :nombre, required: true, autofocus: true %>
8
6
  <%= f.input :apellido, required: true %>
@@ -1,7 +1,6 @@
1
1
  <h2><%= t(".resend_unlock_instructions") %></h2>
2
2
 
3
3
  <%= pg_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
4
- <%= f.mensajes_de_error %>
5
4
  <%= f.full_error :unlock_token %>
6
5
 
7
6
  <div class="form-inputs">
@@ -59,23 +59,51 @@ html
59
59
  div
60
60
  = render partial: 'pg_layout/navbar' if @navbar.present?
61
61
  div
62
- - if user_signed_in? && breadcrumbs.any?
63
- .d-flex.px-3.py-1.d-print-none[
64
- class="bg-primary-subtle align-items-center justify-content-between"
65
- style="min-height: 2.5em;"]
66
- nav aria-label="breadcrumb"
67
- = render_breadcrumbs
68
- / = render_breadcrumbs builder: ::Bootstrap4BreadcrumbsBuilder
69
- .btn-toolbar.gap-1
70
- = yield(:actions)
71
- hr.my-0
72
- - content = content_for?(:content) ? yield(:content) : yield
73
- - unless content.include? 'flash-container'
74
- = render FlashContainerComponent.new
75
- / TODO: si hay varios flashes toast, se superponen. habría que
76
- hacer un container con position absolute para los toasts
77
- = yield(:filtros)
78
- = content
62
+ / FIXME: rename to main, use a constant
63
+ = turbo_frame_tag current_turbo_frame || 'top',
64
+ **{ 'data-turbo-action': (turbo_frame? ? nil : :advance) }.compact do
65
+ - if user_signed_in? && breadcrumbs.any?
66
+ .d-flex.d-print-none
67
+ .d-flex.flex-grow-1.px-3.py-1[
68
+ class="#{nav_bg} align-items-center justify-content-between"
69
+ style="min-height: 2.5em;"]
70
+ nav.d-flex aria-label="breadcrumb"
71
+ - unless frame_embedded?
72
+ i.bi-segmented-nav.me-2
73
+ ol.breadcrumb
74
+ = render_breadcrumbs builder: PgEngine::Bootstrap5BreadcrumbsBuilder
75
+
76
+ .btn-toolbar.gap-1
77
+ = yield(:actions)
78
+ - if using_modal?
79
+ .px-2.d-flex.align-items-center.border.border-start-0
80
+ = button_tag type: :button, class: 'btn btn-sm btn-link',
81
+ data: { action: 'modal#maximize',
82
+ controller: :tooltip, 'bs-title': 'Maximizar' } do
83
+ i.bi-fullscreen
84
+ = link_to request.url,
85
+ class: 'btn btn-sm btn-link',
86
+ data: { controller: :tooltip,
87
+ 'turbo-frame': :_top,
88
+ 'bs-title': 'Reemplazar ventana principal' } do
89
+ i.bi-box-arrow-up-right
90
+ = button_tag type: :button, class: 'btn btn-sm btn-link',
91
+ data: { controller: :tooltip,
92
+ 'bs-title': 'Cerrar', 'bs-dismiss': :modal },
93
+ 'aria-label': 'Close' do
94
+ i.bi-x-lg
95
+
96
+ / hr.my-0
97
+ - content = content_for?(:content) ? yield(:content) : yield
98
+ / FIXME: rename to main?
99
+ - if (!turbo_frame? || current_turbo_frame == 'top') && \
100
+ content.exclude?('flash-container')
101
+ = render FlashContainerComponent.new
102
+ / TODO: si hay varios flashes toast, se superponen. habría que
103
+ hacer un container con position absolute para los toasts
104
+ = yield(:filtros)
105
+ = content
106
+
79
107
  div style="width:100%; height: 10em"
80
108
  .d-flex.gap-1.justify-content-center.opacity-50 data-controller="theme"
81
109
  | (Beta) Tema:
@@ -1,5 +1,5 @@
1
1
  - content_for :content do
2
- .container-fluid.pt-3
2
+ div class="pt-3 #{modal_targeted? ? '' : 'container-fluid'}"
3
3
  = content_for?(:containerized_content) ? yield(:containerized_content) : yield
4
4
 
5
5
  = render template: 'layouts/pg_layout/base'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.2.3'
4
+ VERSION = '7.3.1'
5
5
  end
@@ -10,5 +10,6 @@ $warning-border-subtle: tint-color($warning, 20%);
10
10
  $secondary-bg-subtle: tint-color($secondary, 92%);
11
11
  // $warning-bg-subtle: tint-color($warning, 40%);
12
12
 
13
-
14
13
  $btn-close-focus-shadow: none;
14
+
15
+ $breadcrumb-divider: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8'><path d='M2.5 0L1 1.5 3.5 4 1 6.5 2.5 8l4-4-4-4z' fill='#{$breadcrumb-divider-color}'/></svg>");
@@ -31,6 +31,8 @@ $focus-ring-width: .05rem;
31
31
  $alert-padding-y: 0.5rem;
32
32
  $alert-margin-bottom: 0.5rem;
33
33
 
34
+ $breadcrumb-margin-bottom: 0;
35
+
34
36
  @import 'bootstrap_pre';
35
37
  @import 'bootstrap_overrides';
36
38
  @import 'bootstrap_post';
@@ -63,10 +65,15 @@ $alert-margin-bottom: 0.5rem;
63
65
 
64
66
 
65
67
  $warning-border-emphasis: shade-color($yellow, 60%);
66
- .bg-primary-subtle .btn-warning {
68
+ .btn-toolbar .btn-warning {
67
69
  border: 1px solid $warning-border-emphasis;
68
70
  }
69
71
 
72
+ $light-border-emphasis: shade-color($light, 60%);
73
+ .btn-toolbar .btn-light {
74
+ border: 1px solid $light-border-emphasis;
75
+ }
76
+
70
77
  .listado tr:has(td:hover):has(.bi-eye-fill) td {
71
78
  background-color: #f2f2f2;
72
79
  cursor: pointer;
@@ -265,9 +265,9 @@ RSpec.describe <%= controller_class_name %>Controller do
265
265
  end
266
266
 
267
267
  <% end -%>
268
- it 'quita el elemento de la lista' do
268
+ it 'envía el pg-event' do
269
269
  subject
270
- expect(response.body).to include('turbo-stream action="remove"')
270
+ expect(response.body).to include('<pg-event data-event-name="pg:record-destroyed"')
271
271
  end
272
272
 
273
273
  context 'si hay redirect_to' do
@@ -9,16 +9,14 @@ 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
- include PgEngine::Resource
13
-
14
12
  before_action { @clase_modelo = <%= class_name.split('::').last %> }
15
13
 
14
+ include PgEngine::Resource
15
+
16
16
  before_action(only: :index) { authorize <%= class_name.split('::').last %> }
17
17
 
18
18
  before_action :set_instancia_modelo, only: %i[new create show edit update destroy]
19
19
 
20
- add_breadcrumb <%= class_name.split('::').last %>.nombre_plural, :<%= plural_route_name %>_path
21
-
22
20
  private
23
21
 
24
22
  def atributos_permitidos
@@ -1,10 +1,7 @@
1
- / # locals: (object: nil, asociable: false)
1
+ / # locals: (object: nil)
2
2
 
3
3
  div style="max-width: 22em" data-controller="pg_form"
4
- = pg_form_for(@<%= singular_name %> || object, asociable:) do |f|
5
- = f.mensajes_de_error
6
-
7
- = hidden_field_tag :asociable, true if asociable
4
+ = pg_form_for(@<%= singular_name %> || object) do |f|
8
5
  <%- attributes.each do |attribute| -%>
9
6
  = f.<%= attribute.reference? ? :pg_associable : :input %> :<%= attribute.name %>
10
7
  <%- end -%>
@@ -5,7 +5,7 @@
5
5
  .ms-1
6
6
  = @<%= singular_name %>.edit_link
7
7
 
8
- table.table.table-borderless.table-sm.w-auto.mb-0.m-3
8
+ table.table.table-borderless.table-sm.w-auto.mb-0
9
9
  - atributos_para_mostrar.each do |att|
10
10
  tr
11
11
  th = @clase_modelo.human_attribute_name(att)