pg_rails 7.0.8.pre.alpha.17 → 7.0.8.pre.alpha.19
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/initializers/cable_ready.rb +0 -2
- 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/pg_rails/dotenv_support.rb +1 -0
- data/pg_rails/lib/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a72200e2e6949c04a272d651064a3a69130d65844bda01f62e61e90765d7df1a
|
4
|
+
data.tar.gz: fbd00f4f53a6b637e79314ffc7cf1cd1aab2bc8ca0637aa80720e56d2115334e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0275e61f1134103afad1ba6ca86f2c6e03bdc5342affe492b582cc6dca3f520e6a9fe37666849248dda4bbac703c26d72ac3cbb6462417dc171360bc811e73e
|
7
|
+
data.tar.gz: 50f2e304328af6da2894eca1c8767f82e355228812fea38ebcff0ccfba09a422d08eebf43a9f8c231663fc95441296d6fbd1d29a08e92f42c038aca52ec507bb
|
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
|
@@ -0,0 +1 @@
|
|
1
|
+
Dotenv.load('.env.test.local', '.env.test', '.env')
|
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.19
|
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-03-
|
11
|
+
date: 2024-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Rails goodies.
|
14
14
|
email:
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- pg_rails/js/index.js
|
186
186
|
- pg_rails/lib/pg_rails.rb
|
187
187
|
- pg_rails/lib/pg_rails/capybara_support.rb
|
188
|
+
- pg_rails/lib/pg_rails/dotenv_support.rb
|
188
189
|
- pg_rails/lib/pg_rails/vcr_support.rb
|
189
190
|
- pg_rails/lib/version.rb
|
190
191
|
- pg_rails/scss/pg_rails.scss
|