pg_rails 7.0.8.pre.alpha.17 → 7.0.8.pre.alpha.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/index.js +6 -2
- data/pg_engine/app/decorators/pg_engine/base_decorator.rb +25 -25
- data/pg_engine/app/views/pg_engine/base/index.html.slim +3 -4
- data/pg_engine/config/locales/es.yml +2 -0
- data/pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb +6 -0
- data/pg_layout/app/javascript/controllers/application.js +4 -1
- data/pg_rails/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe2517c50a77409c6c90dc4378588e7b5bfc8cfa227859bdd7a163979c1b8e0d
|
4
|
+
data.tar.gz: dd5da55fffc24abb9bbb4942a2e6de0a7e52184cca97e54ec16500afb556f043
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3d214ad9f2a591590582d92b8c409a593ef5d5a6b0a3bc207aca5dc37944ab0be4f72ad785d119beb1c56fc954ef74c43d7da8418b06a45688330127ff4c6ff
|
7
|
+
data.tar.gz: be03f50c19c74783a6c2bce2d371ed9b58a41eefa87addeecfddbb79e5999906a9e6456017b1a318e8d2c4f492d1b488e9f6d9aba9215f0a3eb9b31d4c183e38
|
data/pg_associable/index.js
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
import AsociableController from './app/javascript/asociable_controller'
|
2
2
|
import ModalController from './app/javascript/modal_controller'
|
3
3
|
|
4
|
-
window.Stimulus
|
5
|
-
window.Stimulus.register('
|
4
|
+
if (window.Stimulus) {
|
5
|
+
window.Stimulus.register('asociable', AsociableController)
|
6
|
+
window.Stimulus.register('modal', ModalController)
|
7
|
+
} else {
|
8
|
+
console.error('window.Stimulus must be set')
|
9
|
+
}
|
@@ -31,58 +31,62 @@ module PgEngine
|
|
31
31
|
end
|
32
32
|
# rubocop:enable Style/MissingRespondToMissing
|
33
33
|
|
34
|
-
def destroy_link(
|
34
|
+
def destroy_link(confirm_text: '¿Estás seguro?', klass: 'btn-light')
|
35
35
|
return unless Pundit.policy!(helpers.send(PgEngine.configuracion.current_user_method), object).destroy?
|
36
36
|
|
37
37
|
helpers.content_tag :span, rel: :tooltip, title: 'Eliminar' do
|
38
|
-
helpers.link_to object_url, data: { 'turbo-confirm':
|
39
|
-
class: "btn #{
|
40
|
-
helpers.content_tag :span, nil, class: clase_icono(
|
38
|
+
helpers.link_to object_url, data: { 'turbo-confirm': confirm_text, 'turbo-method': :delete },
|
39
|
+
class: "btn btn-sm #{klass}" do
|
40
|
+
helpers.content_tag :span, nil, class: clase_icono('trash-fill')
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
def edit_link(
|
45
|
+
def edit_link(text: '', klass: 'btn-light')
|
46
46
|
return unless Pundit.policy!(helpers.send(PgEngine.configuracion.current_user_method), object).edit?
|
47
47
|
|
48
48
|
helpers.content_tag :span, rel: :tooltip, title: 'Editar' do
|
49
49
|
helpers.link_to edit_object_url, data: { turbo_frame: :main },
|
50
|
-
class: "btn #{
|
51
|
-
helpers.content_tag(:span, nil, class: clase_icono(
|
50
|
+
class: "btn btn-sm #{klass}" do
|
51
|
+
helpers.content_tag(:span, nil, class: clase_icono('pencil')) + text
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
def show_link(
|
56
|
+
def show_link(text: '', klass: 'btn-light')
|
57
57
|
return unless Pundit.policy!(helpers.send(PgEngine.configuracion.current_user_method), object).show?
|
58
58
|
|
59
59
|
helpers.content_tag :span, rel: :tooltip, title: 'Ver' do
|
60
60
|
helpers.link_to object_url, data: { turbo_frame: :main },
|
61
|
-
class: "btn #{
|
62
|
-
helpers.content_tag(:span, nil, class: clase_icono(
|
61
|
+
class: "btn btn-sm #{klass}" do
|
62
|
+
helpers.content_tag(:span, nil, class: clase_icono('eye-fill')) + text
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
def export_link(url,
|
68
|
-
return unless Pundit.policy!(helpers.
|
67
|
+
def export_link(url, text: '', klass: 'btn-info')
|
68
|
+
return unless Pundit.policy!(helpers.current_user, object).export?
|
69
69
|
|
70
|
-
helpers.content_tag :span, rel: :tooltip, title: 'Exportar' do
|
70
|
+
helpers.content_tag :span, rel: :tooltip, title: 'Exportar en excel' do
|
71
71
|
helpers.content_tag :a, target: '_blank',
|
72
|
-
class: "btn #{
|
73
|
-
"#{helpers.content_tag(:span, nil, class: clase_icono('file-earmark-excel-fill'))} #{
|
72
|
+
class: "btn btn-sm #{klass}", href: url_change_format(url, 'xlsx') do
|
73
|
+
"#{helpers.content_tag(:span, nil, class: clase_icono('file-earmark-excel-fill'))} #{text}".html_safe
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
def new_link(
|
78
|
+
def new_link(remote: nil, klass: 'btn-warning')
|
79
79
|
return unless Pundit.policy!(helpers.send(PgEngine.configuracion.current_user_method), object).new?
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
word_to_create = I18n.t("form.#{object.class.nombre_singular.downcase}.create", default: :'form.create')
|
82
|
+
|
83
|
+
full_text = "#{word_to_create} #{object.class.nombre_singular.downcase}"
|
84
|
+
|
85
|
+
helpers.content_tag :span, rel: :tooltip, title: word_to_create do
|
86
|
+
helpers.link_to(new_object_url, class: "btn btn-sm #{klass}",
|
87
|
+
remote:) do
|
84
88
|
helpers.content_tag(:span, nil,
|
85
|
-
class: clase_icono('plus').to_s) + "<span class='d-none d-sm-inline'>
|
89
|
+
class: clase_icono('plus').to_s) + "<span class='d-none d-sm-inline'> #{full_text}</span>".html_safe
|
86
90
|
end
|
87
91
|
end
|
88
92
|
end
|
@@ -109,12 +113,8 @@ module PgEngine
|
|
109
113
|
|
110
114
|
private
|
111
115
|
|
112
|
-
def _config
|
113
|
-
PgEngine.configuracion
|
114
|
-
end
|
115
|
-
|
116
116
|
def clase_icono(icono)
|
117
|
-
"
|
117
|
+
"bi bi-#{icono}"
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
@@ -1,14 +1,13 @@
|
|
1
1
|
- content_for(:title, @clase_modelo.nombre_plural)
|
2
2
|
- content_for :actions do
|
3
|
-
button.btn.btn-sm.btn-primary[type="button" data-bs-toggle="collapse"
|
3
|
+
button.btn.btn-sm.btn-outline-primary[type="button" data-bs-toggle="collapse"
|
4
4
|
data-bs-target="#filtros" aria-expanded="false"
|
5
5
|
aria-controls="filtros"]
|
6
6
|
span.bi.bi-funnel-fill
|
7
7
|
span.d-none.d-sm-inline Filtrar
|
8
8
|
.ms-1
|
9
9
|
= @clase_modelo.new.decorate.new_link
|
10
|
-
|
11
|
-
= @clase_modelo.new.decorate.export_link(request.url)
|
10
|
+
|
12
11
|
.collapse.border-bottom#filtros class="#{ 'show' if any_filter? }"
|
13
12
|
.d-flex.align-items-center.p-2
|
14
13
|
.px-2.d-none.d-sm-inline-block
|
@@ -33,7 +32,7 @@ div
|
|
33
32
|
tr
|
34
33
|
- atributos_para_listar.each do |att|
|
35
34
|
th = encabezado att, ordenable: true
|
36
|
-
th
|
35
|
+
th.text-end = @clase_modelo.new.decorate.export_link(request.url)
|
37
36
|
tbody
|
38
37
|
- @collection.each do |object|
|
39
38
|
- object = object.decorate
|
@@ -11,6 +11,12 @@ describe PgEngine::PgLogger do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
around do |example|
|
15
|
+
described_class.raise_errors = false
|
16
|
+
example.run
|
17
|
+
described_class.raise_errors = true
|
18
|
+
end
|
19
|
+
|
14
20
|
shared_examples 'logger' do |type|
|
15
21
|
it do
|
16
22
|
expect(Rails.logger).to have_received(type).twice
|
data/pg_rails/lib/version.rb
CHANGED