pg_rails 7.0.8.pre.alpha.88 → 7.0.8.pre.alpha.89
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/pg_engine/app/components/alert_component.html.slim +15 -0
- data/pg_engine/app/components/alert_component.rb +50 -0
- data/pg_engine/app/components/bad_request_component.rb +16 -0
- data/pg_engine/app/components/base_component.rb +12 -0
- data/pg_engine/app/components/flash_container_component.rb +9 -0
- data/pg_engine/app/components/internal_error_component.rb +24 -0
- data/pg_engine/app/controllers/pg_engine/base_controller.rb +32 -13
- data/pg_engine/app/helpers/pg_engine/flash_helper.rb +0 -15
- data/pg_engine/lib/pg_engine.rb +1 -0
- data/pg_engine/spec/components/alert_component_spec.rb +37 -0
- data/pg_engine/spec/components/internal_error_component_spec.rb +17 -0
- data/pg_engine/spec/components/previews/alert_component_preview/default.html.slim +29 -0
- data/pg_engine/spec/components/previews/alert_component_preview/dismisible.html.slim +2 -0
- data/pg_engine/spec/components/previews/alert_component_preview.rb +8 -0
- data/pg_engine/spec/components/previews/internal_error_preview/default.html.slim +2 -0
- data/pg_engine/spec/components/previews/internal_error_preview.rb +5 -0
- data/pg_engine/spec/controllers/pg_engine/base_controller_spec.rb +1 -2
- data/pg_engine/spec/requests/base_controller_requests_spec.rb +68 -0
- data/pg_engine/spec/system/alerts_spec.rb +21 -0
- data/pg_engine/spec/system/destroy_spec.rb +1 -1
- data/pg_engine/spec/system/signup_spec.rb +1 -1
- data/pg_layout/app/views/devise/sessions/new.html.erb +2 -1
- data/pg_layout/app/views/layouts/pg_layout/base.html.slim +10 -6
- data/pg_layout/app/views/layouts/pg_layout/centered.html.slim +6 -0
- data/pg_layout/app/views/pg_layout/_flash.html.slim +4 -1
- data/pg_rails/lib/version.rb +1 -1
- metadata +32 -7
- data/pg_layout/app/views/pg_layout/_default_error_message.html.erb +0 -13
- data/pg_layout/app/views/pg_layout/_error.html.erb +0 -13
- data/pg_layout/app/views/pg_layout/_flash_container.html.slim +0 -5
- data/pg_layout/app/views/pg_layout/_flash_inner.html.slim +0 -24
- data/pg_layout/app/views/pg_layout/error.html.erb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8141d5335d0993a419e183b7cb6ae3d30c89d77b2f0e620b03279f5971e6d21
|
4
|
+
data.tar.gz: 93f2de289e395627774991e6464d212430ca264cf5b7ec6ab5e89d007ed82353
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc6fa69e44fb872daae120dbadfa520789670fa96028e638de435b39cf44d9c183e5a42de0efe631849131b06c2f58808c5b2a207141f3c6c84cd92bb9e807da
|
7
|
+
data.tar.gz: 2a8f1e7b7d327364f58be8844f1d9b77468cb6154b0526b5ce4ccaa80037e89a07df9d6927471a37587425a9c634dbbfc45a567dbe7f022dc6a124cf97bec628
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/ El mt-2 es necesario para que en modo sticky (FlashContainerComponent)
|
2
|
+
/ no quede pegado al borde superior
|
3
|
+
.alert.mt-2.d-inline-block[
|
4
|
+
class=@klass
|
5
|
+
data-bs-autohide="true"
|
6
|
+
aria-live="assertive" aria-atomic="true" role="alert"
|
7
|
+
]
|
8
|
+
.d-flex.align-items-center
|
9
|
+
.bi class=icon_class
|
10
|
+
|
11
|
+
= content
|
12
|
+
|
13
|
+
- if @dismissible
|
14
|
+
button(type="button" class="btn-close"
|
15
|
+
data-bs-dismiss="alert" aria-label="Close")
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AlertComponent < ViewComponent::Base
|
4
|
+
def initialize(type:, toast: false, dismissible: true)
|
5
|
+
@type = type.to_s
|
6
|
+
|
7
|
+
# rubocop:disable Style/IfUnlessModifier
|
8
|
+
unless @type.in? ApplicationController._flash_types.map(&:to_s)
|
9
|
+
raise PgEngine::Error, 'el type no es válido'
|
10
|
+
end
|
11
|
+
# rubocop:enable Style/IfUnlessModifier
|
12
|
+
|
13
|
+
@toast = toast
|
14
|
+
@dismissible = dismissible
|
15
|
+
@klass = [
|
16
|
+
"alert-#{flash_type_to_class}",
|
17
|
+
('alert-dismissible' if @dismissible),
|
18
|
+
('position-absolute pg-toast' if @toast)
|
19
|
+
].join(' ')
|
20
|
+
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def icon_class
|
25
|
+
{
|
26
|
+
'critical' => 'bi-emoji-dizzy me-3 fs-2',
|
27
|
+
'alert' => 'bi-exclamation-triangle-fill me-2',
|
28
|
+
'warning' => 'bi-exclamation-circle me-2',
|
29
|
+
'success' => 'bi-check-lg me-2',
|
30
|
+
'notice' => 'bi-info-circle me-2'
|
31
|
+
}[@type]
|
32
|
+
end
|
33
|
+
|
34
|
+
def flash_type_to_class
|
35
|
+
case @type
|
36
|
+
when 'notice'
|
37
|
+
'info'
|
38
|
+
when 'critical', 'alert'
|
39
|
+
'danger'
|
40
|
+
when 'warning'
|
41
|
+
'warning'
|
42
|
+
when 'success'
|
43
|
+
'success'
|
44
|
+
else
|
45
|
+
# :nocov:
|
46
|
+
pg_err 'no debería pasar'
|
47
|
+
# :nocov:
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class BadRequestComponent < BaseComponent
|
2
|
+
def self.alert_type
|
3
|
+
:alert
|
4
|
+
end
|
5
|
+
|
6
|
+
erb_template <<~ERB
|
7
|
+
<div>
|
8
|
+
<div class="mb-1">
|
9
|
+
Solicitud incorrecta
|
10
|
+
</div>
|
11
|
+
Por favor, recargá la página e intentá nuevamente
|
12
|
+
<br>
|
13
|
+
o <a class="text-decoration-underline" href="<%= new_public_mensaje_contacto_path %>">ponete en contacto con nosotros</a>
|
14
|
+
</div>
|
15
|
+
ERB
|
16
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class BaseComponent < ViewComponent::Base
|
2
|
+
def self.alert_wrapped(view_context)
|
3
|
+
AlertComponent.new(type: alert_type)
|
4
|
+
.with_content(new.render_in(view_context))
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.alert_type
|
8
|
+
# :nocov:
|
9
|
+
raise 'implement in subclass'
|
10
|
+
# :nocov:
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class FlashContainerComponent < ViewComponent::Base
|
2
|
+
erb_template <<~HTML
|
3
|
+
<div id="flash-container" class="d-flex justify-content-around sticky-top">
|
4
|
+
<div id="flash" class="flash position-relative w-100 d-flex justify-content-center">
|
5
|
+
<%= content || render(partial: 'pg_layout/flash') %>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
HTML
|
9
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class InternalErrorComponent < BaseComponent
|
2
|
+
def initialize(error_msg: nil)
|
3
|
+
@error_msg = error_msg
|
4
|
+
super
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.alert_type
|
8
|
+
:critical
|
9
|
+
end
|
10
|
+
|
11
|
+
erb_template <<~ERB
|
12
|
+
<div>
|
13
|
+
<div class="mb-1">
|
14
|
+
<%= @error_msg || 'Ocurrió algo inesperado' %>
|
15
|
+
</div>
|
16
|
+
Por favor, intentá nuevamente
|
17
|
+
<br>
|
18
|
+
o <a class="text-decoration-underline" href="<%= new_public_mensaje_contacto_path %>">dejá un mensaje</a>
|
19
|
+
para que te avisemos
|
20
|
+
<br>
|
21
|
+
cuando el problema esté resuelto 🙏
|
22
|
+
</div>
|
23
|
+
ERB
|
24
|
+
end
|
@@ -23,6 +23,9 @@ module PgEngine
|
|
23
23
|
protect_from_forgery with: :exception
|
24
24
|
|
25
25
|
rescue_from StandardError, with: :internal_error
|
26
|
+
rescue_from ActionController::InvalidAuthenticityToken,
|
27
|
+
with: :invalid_authenticity_token
|
28
|
+
|
26
29
|
rescue_from Pundit::NotAuthorizedError, with: :not_authorized
|
27
30
|
rescue_from Redirect do |e|
|
28
31
|
redirect_to e.url
|
@@ -31,19 +34,13 @@ module PgEngine
|
|
31
34
|
def internal_error(error)
|
32
35
|
pg_err error
|
33
36
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
status: :internal_server_error
|
42
|
-
end
|
43
|
-
format.any do
|
44
|
-
head :internal_server_error
|
45
|
-
end
|
46
|
-
end
|
37
|
+
render_my_component(InternalErrorComponent, :internal_server_error)
|
38
|
+
end
|
39
|
+
|
40
|
+
def invalid_authenticity_token(err)
|
41
|
+
pg_warn err
|
42
|
+
|
43
|
+
render_my_component(BadRequestComponent, :bad_request)
|
47
44
|
end
|
48
45
|
|
49
46
|
before_action do
|
@@ -94,6 +91,28 @@ module PgEngine
|
|
94
91
|
|
95
92
|
protected
|
96
93
|
|
94
|
+
def render_my_component(component, status) # rubocop:disable Metrics/AbcSize
|
95
|
+
respond_to do |format|
|
96
|
+
format.html do
|
97
|
+
render component.alert_wrapped(view_context),
|
98
|
+
layout: 'pg_layout/centered',
|
99
|
+
status:
|
100
|
+
end
|
101
|
+
|
102
|
+
format.turbo_stream do
|
103
|
+
flash.now[component.alert_type] = component.new.render_in(view_context)
|
104
|
+
|
105
|
+
render turbo_stream: (turbo_stream.remove_all('.modal') +
|
106
|
+
render_turbo_stream_flash_messages),
|
107
|
+
status:
|
108
|
+
end
|
109
|
+
|
110
|
+
format.any do
|
111
|
+
head status
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
97
116
|
def not_authorized(_arg_required_for_active_admin)
|
98
117
|
respond_to do |format|
|
99
118
|
format.json do
|
@@ -9,20 +9,5 @@ module PgEngine
|
|
9
9
|
turbo_stream.update_all 'title', title
|
10
10
|
# rubocop:enable Rails/SkipsModelValidations
|
11
11
|
end
|
12
|
-
|
13
|
-
def flash_type_to_class(flash_type)
|
14
|
-
case flash_type
|
15
|
-
when 'notice'
|
16
|
-
'info'
|
17
|
-
when 'critical', 'alert'
|
18
|
-
'danger'
|
19
|
-
when 'warning'
|
20
|
-
'warning'
|
21
|
-
when 'success'
|
22
|
-
'success'
|
23
|
-
else
|
24
|
-
flash_type
|
25
|
-
end
|
26
|
-
end
|
27
12
|
end
|
28
13
|
end
|
data/pg_engine/lib/pg_engine.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_helper'
|
4
|
+
|
5
|
+
RSpec.fdescribe AlertComponent, type: :component do
|
6
|
+
subject do
|
7
|
+
render_inline(alert).to_html
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:type) { 'notice' }
|
11
|
+
|
12
|
+
let(:toast) { true }
|
13
|
+
let(:dismissible) { true }
|
14
|
+
let(:content) { 'pasaron cosas' }
|
15
|
+
|
16
|
+
let(:alert) do
|
17
|
+
described_class.new(type:, toast:, dismissible:).with_content(content)
|
18
|
+
end
|
19
|
+
|
20
|
+
%w[critical alert notice warning success].each do |flash_type|
|
21
|
+
context "cuando el type es #{flash_type}" do
|
22
|
+
let(:type) { flash_type }
|
23
|
+
|
24
|
+
it do
|
25
|
+
expect(subject).to have_text 'pasaron cosas'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'cuando el type no es válido' do
|
31
|
+
let(:type) { %w[info danger].sample }
|
32
|
+
|
33
|
+
it do
|
34
|
+
expect { subject }.to raise_error(PgEngine::Error)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe InternalErrorComponent, type: :component do
|
4
|
+
subject do
|
5
|
+
render_inline(internal_error).to_html
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:internal_error) do
|
9
|
+
described_class.new(error_msg:)
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:error_msg) { 'internal error' }
|
13
|
+
|
14
|
+
it do
|
15
|
+
expect(subject).to have_text(error_msg)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
= render FlashContainerComponent.new do
|
2
|
+
= render AlertComponent.new(type: :critical, toast: false) do
|
3
|
+
| Mal las cosas
|
4
|
+
= render AlertComponent.new(type: :success, toast: false) do
|
5
|
+
| Un simple flash success
|
6
|
+
= render AlertComponent.new(type: :alert, toast: true) \
|
7
|
+
.with_content(BadRequestComponent.new.render_in(self))
|
8
|
+
.row
|
9
|
+
.col Dismissible
|
10
|
+
.col No dismissible
|
11
|
+
.col
|
12
|
+
div Toasts
|
13
|
+
p cuando se agregan dinámicamente, tienen que estar dentro de #flash
|
14
|
+
- %i[alert warning notice success critical].each do |type|
|
15
|
+
.row
|
16
|
+
- [true, false].each do |dismissible|
|
17
|
+
.col
|
18
|
+
= render AlertComponent.new(type:, dismissible:) do
|
19
|
+
span = type
|
20
|
+
.col
|
21
|
+
= render AlertComponent.new(type:, toast: true) do
|
22
|
+
span Los toasts van a desaparecer
|
23
|
+
= render AlertComponent.new(type: :critical) \
|
24
|
+
.with_content(InternalErrorComponent.new.render_in(self))
|
25
|
+
br
|
26
|
+
= render AlertComponent.new(type: :alert) \
|
27
|
+
.with_content(BadRequestComponent.new.render_in(self))
|
28
|
+
|
29
|
+
div style="margin-top: 40em" cosas
|
@@ -20,10 +20,9 @@ class DummyBaseController < PgEngine::BaseController
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
# rubocop:disable RSpec/MultipleExpectations
|
24
23
|
# rubocop:disable RSpec/FilePath
|
25
24
|
# rubocop:disable RSpec/SpecFilePathFormat
|
26
|
-
|
25
|
+
fdescribe DummyBaseController do
|
27
26
|
render_views
|
28
27
|
|
29
28
|
describe 'PgEngine::BaseController::Redirect' do
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
fdescribe 'Base requests' do
|
4
|
+
describe 'invalid authenticity token' do
|
5
|
+
subject { get '/admin/cosas', headers: }
|
6
|
+
|
7
|
+
before do
|
8
|
+
sign_in create(:user, :developer)
|
9
|
+
allow_any_instance_of(Admin::CosasController).to \
|
10
|
+
receive(:index).and_raise(ActionController::InvalidAuthenticityToken)
|
11
|
+
end
|
12
|
+
|
13
|
+
shared_examples 'manda el status correcto' do
|
14
|
+
it do
|
15
|
+
subject
|
16
|
+
expect(response).to have_http_status(:bad_request)
|
17
|
+
end
|
18
|
+
|
19
|
+
it do
|
20
|
+
subject
|
21
|
+
expect(response).to have_http_status(:bad_request)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it do
|
26
|
+
expect { subject }.to have_warned
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'cuando pide html' do
|
30
|
+
let(:headers) do
|
31
|
+
{ 'ACCEPT' => 'text/html' }
|
32
|
+
end
|
33
|
+
|
34
|
+
include_examples 'manda el status correcto'
|
35
|
+
|
36
|
+
it 'no manda el flash' do
|
37
|
+
subject
|
38
|
+
expect(flash).to be_empty
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'muestra el mensaje' do
|
42
|
+
subject
|
43
|
+
expect(response.body).to include 'Solicitud incorrecta'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'cuando pide turbo_stream' do
|
48
|
+
let(:headers) do
|
49
|
+
{ 'ACCEPT' => 'text/vnd.turbo-stream.html' }
|
50
|
+
end
|
51
|
+
|
52
|
+
include_examples 'manda el status correcto'
|
53
|
+
|
54
|
+
it 'manda el flash' do
|
55
|
+
subject
|
56
|
+
expect(flash[:alert]).to include 'Solicitud incorrecta'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'cuando pide json' do
|
61
|
+
let(:headers) do
|
62
|
+
{ 'ACCEPT' => 'application/json' }
|
63
|
+
end
|
64
|
+
|
65
|
+
include_examples 'manda el status correcto'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
fdescribe 'Alertas' do
|
4
|
+
before do
|
5
|
+
driven_by ENV['DRIVER']&.to_sym || :selenium_chrome_headless_iphone
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'los toasts desaparecen' do
|
9
|
+
visit '/rails/view_components/alert_component/default'
|
10
|
+
expect(page).to have_text('Los toasts van a desaparecer').exactly(5)
|
11
|
+
# Desaparecieron
|
12
|
+
expect(page).to have_no_text('Los toasts van a desaparecer', wait: 10)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'los dismissibles se cierran' do
|
16
|
+
visit '/rails/view_components/alert_component/dismisible'
|
17
|
+
expect(page).to have_text('este dismisible se va a cerrar')
|
18
|
+
find('.btn-close').click
|
19
|
+
expect(page).to have_no_text('este dismisible se va a cerrar')
|
20
|
+
end
|
21
|
+
end
|
@@ -50,7 +50,7 @@ describe 'Al Registrarse' do
|
|
50
50
|
visit '/users/edit'
|
51
51
|
end
|
52
52
|
|
53
|
-
it do
|
53
|
+
it do
|
54
54
|
expect { subject }.to change { user.reload.nombre }.to('despues')
|
55
55
|
expect(page).to have_text('Tu cuenta se ha actualizado')
|
56
56
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
<h2><%= t(".sign_in") %></h2>
|
2
2
|
|
3
|
-
<%= render
|
3
|
+
<%= render FlashContainerComponent.new %>
|
4
|
+
|
4
5
|
<%= pg_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
5
6
|
<div class="form-inputs">
|
6
7
|
<%= f.input :email,
|
@@ -45,13 +45,15 @@ html
|
|
45
45
|
}
|
46
46
|
|
47
47
|
body
|
48
|
-
=
|
48
|
+
- sidebar_present = @navbar.present? && @sidebar != false
|
49
|
+
- if sidebar_present
|
50
|
+
= render partial: 'pg_layout/sidebar_mobile'
|
49
51
|
|
50
|
-
div class="#{
|
51
|
-
-
|
52
|
+
div class="#{ 'with-sidebar' if sidebar_present }"
|
53
|
+
- if sidebar_present
|
52
54
|
= render partial: 'pg_layout/sidebar'
|
53
55
|
div
|
54
|
-
= render partial: 'pg_layout/navbar'
|
56
|
+
= render partial: 'pg_layout/navbar' if @navbar.present?
|
55
57
|
div
|
56
58
|
- if user_signed_in? && breadcrumbs.any?
|
57
59
|
.d-flex.align-items-center.justify-content-between.px-3.py-1.d-print-none[
|
@@ -63,8 +65,10 @@ html
|
|
63
65
|
= yield(:actions)
|
64
66
|
hr.my-0
|
65
67
|
- content = content_for?(:content) ? yield(:content) : yield
|
66
|
-
- unless content.include? 'flash-
|
67
|
-
= render
|
68
|
+
- unless content.include? 'flash-container'
|
69
|
+
= render FlashContainerComponent.new
|
70
|
+
/ TODO: si hay varios flashes toast, se superponen. habría que
|
71
|
+
hacer un container con position absolute para los toasts
|
68
72
|
= content
|
69
73
|
div style="width:100%; height: 10em"
|
70
74
|
= render_turbo_stream_title
|
@@ -1,5 +1,8 @@
|
|
1
1
|
/ slim-lint:disable LineLength
|
2
2
|
- flash_to_show = flash.select { |fm| fm[0].to_sym.in?(ApplicationController._flash_types) && fm[1].present? }
|
3
3
|
/ slim-lint:enable LineLength
|
4
|
+
|
5
|
+
- toast = flash[:toast]
|
4
6
|
- flash_to_show.each do |flash_type, message|
|
5
|
-
= render
|
7
|
+
= render AlertComponent.new(type: flash_type, toast:, dismissible: true) do
|
8
|
+
= message
|
data/pg_rails/lib/version.rb
CHANGED
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.0.8.pre.alpha.
|
4
|
+
version: 7.0.8.pre.alpha.89
|
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-06-
|
11
|
+
date: 2024-06-05 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: view_component
|
533
|
+
requirement: !ruby/object:Gem::Requirement
|
534
|
+
requirements:
|
535
|
+
- - "~>"
|
536
|
+
- !ruby/object:Gem::Version
|
537
|
+
version: 3.12.1
|
538
|
+
type: :runtime
|
539
|
+
prerelease: false
|
540
|
+
version_requirements: !ruby/object:Gem::Requirement
|
541
|
+
requirements:
|
542
|
+
- - "~>"
|
543
|
+
- !ruby/object:Gem::Version
|
544
|
+
version: 3.12.1
|
531
545
|
- !ruby/object:Gem::Dependency
|
532
546
|
name: vcr
|
533
547
|
requirement: !ruby/object:Gem::Requirement
|
@@ -955,6 +969,12 @@ files:
|
|
955
969
|
- pg_engine/app/assets/javascripts/active_admin.js
|
956
970
|
- pg_engine/app/assets/stylesheets/active_admin.scss
|
957
971
|
- pg_engine/app/assets/stylesheets/pg_rails_b5.scss
|
972
|
+
- pg_engine/app/components/alert_component.html.slim
|
973
|
+
- pg_engine/app/components/alert_component.rb
|
974
|
+
- pg_engine/app/components/bad_request_component.rb
|
975
|
+
- pg_engine/app/components/base_component.rb
|
976
|
+
- pg_engine/app/components/flash_container_component.rb
|
977
|
+
- pg_engine/app/components/internal_error_component.rb
|
958
978
|
- pg_engine/app/controllers/admin/accounts_controller.rb
|
959
979
|
- pg_engine/app/controllers/admin/email_logs_controller.rb
|
960
980
|
- pg_engine/app/controllers/admin/emails_controller.rb
|
@@ -1073,6 +1093,13 @@ files:
|
|
1073
1093
|
- pg_engine/lib/pg_engine/utils/pdf_preview_generator.rb
|
1074
1094
|
- pg_engine/lib/pg_engine/utils/pg_logger.rb
|
1075
1095
|
- pg_engine/lib/tasks/auto_anotar_modelos.rake
|
1096
|
+
- pg_engine/spec/components/alert_component_spec.rb
|
1097
|
+
- pg_engine/spec/components/internal_error_component_spec.rb
|
1098
|
+
- pg_engine/spec/components/previews/alert_component_preview.rb
|
1099
|
+
- pg_engine/spec/components/previews/alert_component_preview/default.html.slim
|
1100
|
+
- pg_engine/spec/components/previews/alert_component_preview/dismisible.html.slim
|
1101
|
+
- pg_engine/spec/components/previews/internal_error_preview.rb
|
1102
|
+
- pg_engine/spec/components/previews/internal_error_preview/default.html.slim
|
1076
1103
|
- pg_engine/spec/controllers/admin/accounts_controller_spec.rb
|
1077
1104
|
- pg_engine/spec/controllers/admin/email_logs_controller_spec.rb
|
1078
1105
|
- pg_engine/spec/controllers/admin/emails_controller_spec.rb
|
@@ -1108,6 +1135,8 @@ files:
|
|
1108
1135
|
- pg_engine/spec/models/user_account_spec.rb
|
1109
1136
|
- pg_engine/spec/models/user_spec.rb
|
1110
1137
|
- pg_engine/spec/pg_engine/pdf_preview_generator_spec.rb
|
1138
|
+
- pg_engine/spec/requests/base_controller_requests_spec.rb
|
1139
|
+
- pg_engine/spec/system/alerts_spec.rb
|
1111
1140
|
- pg_engine/spec/system/destroy_spec.rb
|
1112
1141
|
- pg_engine/spec/system/login_spec.rb
|
1113
1142
|
- pg_engine/spec/system/send_mail_spec.rb
|
@@ -1157,20 +1186,16 @@ files:
|
|
1157
1186
|
- pg_layout/app/views/kaminari/_paginator.html.slim
|
1158
1187
|
- pg_layout/app/views/kaminari/_prev_page.html.slim
|
1159
1188
|
- pg_layout/app/views/layouts/pg_layout/base.html.slim
|
1189
|
+
- pg_layout/app/views/layouts/pg_layout/centered.html.slim
|
1160
1190
|
- pg_layout/app/views/layouts/pg_layout/container_logo.html.slim
|
1161
1191
|
- pg_layout/app/views/layouts/pg_layout/containerized.html.slim
|
1162
1192
|
- pg_layout/app/views/layouts/pg_layout/devise.html.slim
|
1163
1193
|
- pg_layout/app/views/layouts/pg_layout/mailer.html.slim
|
1164
1194
|
- pg_layout/app/views/layouts/pg_layout/mailer.text.slim
|
1165
|
-
- pg_layout/app/views/pg_layout/_default_error_message.html.erb
|
1166
|
-
- pg_layout/app/views/pg_layout/_error.html.erb
|
1167
1195
|
- pg_layout/app/views/pg_layout/_flash.html.slim
|
1168
|
-
- pg_layout/app/views/pg_layout/_flash_container.html.slim
|
1169
|
-
- pg_layout/app/views/pg_layout/_flash_inner.html.slim
|
1170
1196
|
- pg_layout/app/views/pg_layout/_navbar.html.erb
|
1171
1197
|
- pg_layout/app/views/pg_layout/_sidebar.html.erb
|
1172
1198
|
- pg_layout/app/views/pg_layout/_sidebar_mobile.html.erb
|
1173
|
-
- pg_layout/app/views/pg_layout/error.html.erb
|
1174
1199
|
- pg_layout/lib/pg_layout.rb
|
1175
1200
|
- pg_layout/lib/pg_layout/engine.rb
|
1176
1201
|
- pg_layout/spec/lib/navbar_spec.rb
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<%# locals: (error_msg: nil) %>
|
2
|
-
|
3
|
-
<div>
|
4
|
-
<div class="mb-1">
|
5
|
-
<%= error_msg || 'Ocurrió algo inesperado' %>
|
6
|
-
</div>
|
7
|
-
Por favor, intentá nuevamente
|
8
|
-
<br>
|
9
|
-
o <a class="text-decoration-underline" href="<%= new_public_mensaje_contacto_path %>">dejá un mensaje</a>
|
10
|
-
para que te avisemos
|
11
|
-
<br>
|
12
|
-
cuando el problema esté resuelto 🙏
|
13
|
-
</div>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<%# locals: (error_msg: nil) %>
|
2
|
-
|
3
|
-
<div class="d-flex justify-content-around mt-2">
|
4
|
-
<div class="alert alert-danger d-flex align-items-center">
|
5
|
-
<div>
|
6
|
-
<span class="bi bi-emoji-dizzy fs-1 me-3"></span>
|
7
|
-
<%# <span class="bi bi-exclamation-triangle fs-1 me-3"></span> %>
|
8
|
-
</div>
|
9
|
-
<div>
|
10
|
-
<%= render partial: 'pg_layout/default_error_message', locals: { error_msg: } %>
|
11
|
-
</div>
|
12
|
-
</div>
|
13
|
-
</div>
|
@@ -1,5 +0,0 @@
|
|
1
|
-
#flash-wrapper.d-flex.justify-content-around.sticky-top
|
2
|
-
#flash.flash.position-relative.w-100.d-flex.justify-content-center
|
3
|
-
= render partial: 'pg_layout/flash'
|
4
|
-
/ TODO: si hay varios flashes toast, se superponen. habría que hacer un container
|
5
|
-
con position absolute para los toasts
|
@@ -1,24 +0,0 @@
|
|
1
|
-
/ # locals: (flash_type:, message:, toast: false)
|
2
|
-
|
3
|
-
.alert.alert-dismissible[
|
4
|
-
class="
|
5
|
-
mt-2 d-flex align-items-center
|
6
|
-
alert-#{flash_type_to_class(flash_type)}
|
7
|
-
#{'position-absolute pg-toast' if toast}"
|
8
|
-
data-bs-autohide="true"
|
9
|
-
aria-live="assertive" aria-atomic="true" role="alert"
|
10
|
-
]
|
11
|
-
- case flash_type
|
12
|
-
- when 'critical'
|
13
|
-
/ .bi.bi-emoji-dizzy.me-3.fs-2
|
14
|
-
.bi.bi-exclamation-triangle-fill.me-3.fs-2
|
15
|
-
- when 'alert'
|
16
|
-
.bi.bi-exclamation-triangle-fill.me-2
|
17
|
-
- when 'warning'
|
18
|
-
.bi.bi-exclamation-circle.me-2
|
19
|
-
- when 'success'
|
20
|
-
.bi.bi-check-lg.me-2
|
21
|
-
- when 'notice'
|
22
|
-
.bi.bi-info-circle.me-2
|
23
|
-
= message
|
24
|
-
button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"
|