pg_rails 7.1.1.pre.3 → 7.1.1.pre.5
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/assets/stylesheets/pg_rails_b5.scss +1 -2
- data/pg_engine/app/controllers/concerns/pg_engine/resource.rb +5 -3
- data/pg_engine/app/controllers/pg_engine/base_controller.rb +11 -0
- data/pg_engine/app/controllers/users/confirmations_controller.rb +1 -1
- data/pg_engine/app/decorators/pg_engine/base_record_decorator.rb +4 -0
- data/pg_engine/app/views/admin/eventos/new.html.slim +1 -1
- data/pg_engine/app/views/pg_engine/base/index.html.slim +5 -4
- data/pg_engine/db/seeds.rb +3 -5
- data/pg_engine/lib/pg_engine/email_observer.rb +1 -1
- data/pg_engine/spec/factories/users.rb +2 -2
- data/pg_layout/app/javascript/utils/cookies.js +3 -0
- data/pg_layout/app/javascript/utils/utils.ts +22 -0
- data/pg_layout/app/views/layouts/pg_layout/base.html.slim +3 -0
- data/pg_layout/app/views/pg_layout/_modal_show.html.slim +9 -4
- data/pg_rails/lib/version.rb +1 -1
- data/pg_scaffold/lib/generators/pg_slim/templates/index.html.slim +4 -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: 8ed654c2ed0008b0a029aafcf59fbf1fb11d681b091852cdf91075eb59027b4e
|
4
|
+
data.tar.gz: 8c5030277d34251d6e214697475c1e79121a40b1c5c9b757eb9ca95d04261bfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2a334fbf6cf1e62e629bb231ab9ecca2300b30db6f04e1fb6360e7d9d2688a9399398d860cc0930418889b5960dfe900eb6e7bd8a7be8ff0e32d8e48513244b
|
7
|
+
data.tar.gz: f3686b6c215d38d54147e1506d7645b36ccf29ed2fde0dae04574662a649550d952deb5bce503a6ff3403dc98c77235364485e04e3dc4171f39af7ee4db672cf
|
@@ -64,8 +64,7 @@ input[type=datetime-local], input[type=datetime] {
|
|
64
64
|
padding: 0.25rem 1rem;
|
65
65
|
}
|
66
66
|
}
|
67
|
-
.listado
|
68
|
-
// FIXME: rompe porque es una tabla y tiene que tener su propio display
|
67
|
+
.listado .actions-wrapper {
|
69
68
|
display: flex;
|
70
69
|
justify-content: flex-end;
|
71
70
|
gap: 4px;
|
@@ -24,7 +24,7 @@ module PgEngine
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def show
|
27
|
-
add_breadcrumb instancia_modelo, instancia_modelo.target_object
|
27
|
+
add_breadcrumb instancia_modelo.to_s_short, instancia_modelo.target_object
|
28
28
|
|
29
29
|
pg_respond_show
|
30
30
|
end
|
@@ -34,7 +34,7 @@ module PgEngine
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def edit
|
37
|
-
add_breadcrumb instancia_modelo, instancia_modelo.target_object
|
37
|
+
add_breadcrumb instancia_modelo.to_s_short, instancia_modelo.target_object
|
38
38
|
add_breadcrumb 'Editando'
|
39
39
|
end
|
40
40
|
|
@@ -160,7 +160,9 @@ module PgEngine
|
|
160
160
|
end
|
161
161
|
else
|
162
162
|
format.turbo_stream do
|
163
|
-
|
163
|
+
# Esto no es totalmente limpio pero funciona tanto en los listados como en los
|
164
|
+
# modal show
|
165
|
+
render turbo_stream: turbo_stream.remove(model) + turbo_stream.remove_all('.modal')
|
164
166
|
end
|
165
167
|
format.html do
|
166
168
|
redirect_back(fallback_location: root_path, notice: msg, status: 303)
|
@@ -113,6 +113,12 @@ module PgEngine
|
|
113
113
|
protected
|
114
114
|
|
115
115
|
def render_my_component(component, status)
|
116
|
+
# Esto es para que saltee los turbo frames y genere
|
117
|
+
# un full reload. El turbo_no_cache no es estrictamente necesario
|
118
|
+
# pero lo dejo por las dudas
|
119
|
+
@turbo_page_requires_reload = true
|
120
|
+
@turbo_no_cache = true
|
121
|
+
|
116
122
|
respond_to do |format|
|
117
123
|
format.html do
|
118
124
|
render component.alert_wrapped(view_context),
|
@@ -128,6 +134,11 @@ module PgEngine
|
|
128
134
|
status:
|
129
135
|
end
|
130
136
|
|
137
|
+
format.json do
|
138
|
+
html = component.render_in(view_context)
|
139
|
+
render json: { html: }, status:
|
140
|
+
end
|
141
|
+
|
131
142
|
format.any do
|
132
143
|
head status
|
133
144
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Users
|
2
2
|
class ConfirmationsController < Devise::ConfirmationsController
|
3
3
|
# GET /resource/confirmation?confirmation_token=abcdef
|
4
|
-
def show
|
4
|
+
def show
|
5
5
|
self.resource = resource_class.confirm_by_token(params[:confirmation_token])
|
6
6
|
yield resource if block_given?
|
7
7
|
|
@@ -22,6 +22,10 @@ module PgEngine
|
|
22
22
|
object.as_json(options).tap { |o| o[:to_s] = to_s }
|
23
23
|
end
|
24
24
|
|
25
|
+
def to_s_short
|
26
|
+
truncate(object.to_s)
|
27
|
+
end
|
28
|
+
|
25
29
|
# rubocop:disable Style/MissingRespondToMissing
|
26
30
|
def method_missing(method_name, *args, &)
|
27
31
|
valor = object.attributes[method_name.to_s]
|
@@ -6,7 +6,7 @@
|
|
6
6
|
= f.input :message, as: :text
|
7
7
|
- else
|
8
8
|
= f.rich_text_area :message
|
9
|
-
= f.input :message_text, as: :text
|
9
|
+
= f.input :message_text, as: :text, hint: 'Solo para emails, para la plain/text part'
|
10
10
|
= f.input :tooltip
|
11
11
|
= f.input :subject
|
12
12
|
= f.input :record_type
|
@@ -53,10 +53,11 @@ div
|
|
53
53
|
- atributos_para_listar.each do |att|
|
54
54
|
td.text-nowrap = object.send(att)
|
55
55
|
td.text-nowrap.text-end.ps-5
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
.actions-wrapper
|
57
|
+
= object.extra_actions(size: :sm) if object.respond_to? :extra_actions
|
58
|
+
= object.show_link
|
59
|
+
= object.edit_link(text: '', klass: 'btn-light')
|
60
|
+
= object.destroy_link
|
60
61
|
|
61
62
|
.ps-3.justify-content-center
|
62
63
|
= paginate(@collection)
|
data/pg_engine/db/seeds.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
DatabaseCleaner.clean_with(:truncation, except: %w(ar_internal_metadata))
|
2
2
|
|
3
|
-
|
3
|
+
FactoryBot.create :user, email: 'mrosso10@gmail.com', nombre: 'Martín', apellido: 'Rosso', password: 'admin123',
|
4
|
+
confirmed_at: Time.now, developer: true
|
4
5
|
|
5
|
-
|
6
|
-
FactoryBot.create :user, email: MAIL, nombre: 'Martín', apellido: 'Rosso', password: 'admin123',
|
7
|
-
confirmed_at: Time.now, developer: true
|
8
|
-
end
|
6
|
+
Account.first.users << FactoryBot.create(:user, orphan: true)
|
@@ -37,8 +37,8 @@
|
|
37
37
|
|
38
38
|
FactoryBot.define do
|
39
39
|
factory :user, class: 'User' do
|
40
|
-
nombre { Faker::Name.
|
41
|
-
apellido { Faker::Name.
|
40
|
+
nombre { Faker::Name.first_name }
|
41
|
+
apellido { Faker::Name.last_name }
|
42
42
|
email { Faker::Internet.email }
|
43
43
|
password { "password#{rand(99_999)}" }
|
44
44
|
confirmed_at { Faker::Date.backward }
|
@@ -1,5 +1,7 @@
|
|
1
|
+
// TODO: borrar deprecated file
|
1
2
|
export default class {
|
2
3
|
setCookie (cname, cvalue, exdays) {
|
4
|
+
console.log('DEPRECATED setCookie')
|
3
5
|
const d = new Date()
|
4
6
|
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000))
|
5
7
|
const expires = 'expires=' + d.toUTCString()
|
@@ -7,6 +9,7 @@ export default class {
|
|
7
9
|
}
|
8
10
|
|
9
11
|
getCookie (cname) {
|
12
|
+
console.log('DEPRECATED getCookie')
|
10
13
|
const name = cname + '='
|
11
14
|
const ca = document.cookie.split(';')
|
12
15
|
for (let i = 0; i < ca.length; i++) {
|
@@ -1,3 +1,25 @@
|
|
1
|
+
export function setCookie (cname, cvalue, exdays) {
|
2
|
+
const d = new Date()
|
3
|
+
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000))
|
4
|
+
const expires = 'expires=' + d.toUTCString()
|
5
|
+
document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'
|
6
|
+
}
|
7
|
+
|
8
|
+
export function getCookie (cname) {
|
9
|
+
const name = cname + '='
|
10
|
+
const ca = document.cookie.split(';')
|
11
|
+
for (let i = 0; i < ca.length; i++) {
|
12
|
+
let c = ca[i]
|
13
|
+
while (c.charAt(0) === ' ') {
|
14
|
+
c = c.substring(1)
|
15
|
+
}
|
16
|
+
if (c.indexOf(name) === 0) {
|
17
|
+
return c.substring(name.length, c.length)
|
18
|
+
}
|
19
|
+
}
|
20
|
+
return ''
|
21
|
+
}
|
22
|
+
|
1
23
|
export function round (value) {
|
2
24
|
return Math.round(value * 100) / 100
|
3
25
|
}
|
@@ -5,6 +5,9 @@ html
|
|
5
5
|
meta charset="UTF-8"
|
6
6
|
meta http-equiv="X-UA-Compatible" content="IE=edge"
|
7
7
|
meta name="viewport" content="width=device-width,initial-scale=1"
|
8
|
+
- if @turbo_page_requires_reload
|
9
|
+
meta name="turbo-visit-control" content="reload"
|
10
|
+
|
8
11
|
- cache :title_icon
|
9
12
|
title = t('app_name')
|
10
13
|
- begin
|
@@ -1,9 +1,14 @@
|
|
1
|
-
.modal.modal-lg.modal-asociable[tabindex="-1" data-controller="modal"
|
1
|
+
.modal.modal-lg.modal-asociable[tabindex="-1" data-controller="modal"
|
2
|
+
data-remove-on-hide="true" data-turbo-temporary="true"]
|
2
3
|
.modal-dialog
|
3
4
|
.modal-content
|
4
5
|
.modal-header
|
5
|
-
.
|
6
|
-
|
6
|
+
= link_to object.target_object do
|
7
|
+
| Ir al #{object.class.nombre_singular.downcase}
|
7
8
|
a.btn-close[type="button" data-bs-dismiss="modal" aria-label="Close"]
|
8
9
|
.modal-body
|
9
|
-
=
|
10
|
+
= turbo_frame_tag :modal_generic, target: :_top do
|
11
|
+
.float-end
|
12
|
+
= object.edit_link
|
13
|
+
= object.destroy_link
|
14
|
+
= render object
|
data/pg_rails/lib/version.rb
CHANGED
@@ -41,9 +41,10 @@ div
|
|
41
41
|
- atributos_para_listar.each do |att|
|
42
42
|
th = object.send(att)
|
43
43
|
td.text-nowrap.text-end.ps-5
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
.actions-wrapper
|
45
|
+
= object.show_link
|
46
|
+
= object.edit_link(text: '', klass: 'btn-light')
|
47
|
+
= object.destroy_link
|
47
48
|
|
48
49
|
.ps-3.justify-content-center
|
49
50
|
= paginate(@collection)
|
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.1.1.pre.
|
4
|
+
version: 7.1.1.pre.5
|
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-07-
|
11
|
+
date: 2024-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|