pg_rails 7.0.8.pre.alpha.76 → 7.0.8.pre.alpha.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/pg_associable/app/javascript/asociable_controller.tsx +18 -4
- data/pg_associable/app/views/pg_associable/_resultados_inline.html.slim +3 -3
- data/pg_engine/app/decorators/pg_engine/base_record_decorator.rb +2 -1
- data/pg_engine/lib/pg_engine/utils/pg_logger.rb +2 -0
- data/pg_layout/app/javascript/controllers/pg_form_controller.js +8 -0
- data/pg_rails/lib/version.rb +1 -1
- 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: 356134a06d178d1da89941fd57ac424f400adea0d39bfe6a09a635f896380ea2
|
4
|
+
data.tar.gz: b144d8ab6758ccf469d242a3f14b5ac5b98ee892343053fb49f98ddd2555f87a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29d1bb1ec81bd9e6a3d11c84ba76a5cdcf03b1f95d4ecee39057bcc358721fa5ae252b511c09bcb7e1cfd6ed7e270ac20efb264eba325a42ce326c6d022234bc
|
7
|
+
data.tar.gz: 455515106f9dc06e3e1da329b0a7c23eda3da54602b922136b9c54cdd868d629b592098fcce9970c7e11e99aad5b8fdf61a580bdc7a40f332836ebad45bc66dc
|
@@ -10,6 +10,7 @@ export default class extends Controller {
|
|
10
10
|
elemId = null
|
11
11
|
input = null
|
12
12
|
originalPlaceholder = null
|
13
|
+
savedInputState = null
|
13
14
|
|
14
15
|
connect () {
|
15
16
|
// ID único para identificar el campo y el modal
|
@@ -69,8 +70,16 @@ export default class extends Controller {
|
|
69
70
|
|
70
71
|
this.input.addEventListener('blur', () => {
|
71
72
|
this.input.placeholder = this.originalPlaceholder
|
73
|
+
if (!this.element.classList.contains('filled')) {
|
74
|
+
this.savedInputState = this.input.value
|
75
|
+
this.input.value = null
|
76
|
+
}
|
72
77
|
})
|
73
78
|
this.input.onfocus = () => {
|
79
|
+
if (this.savedInputState && !this.input.value) {
|
80
|
+
this.input.value = this.savedInputState
|
81
|
+
}
|
82
|
+
this.savedInputState =
|
74
83
|
this.input.select()
|
75
84
|
if (this.input.value.length === 0) {
|
76
85
|
this.escribiAlgo()
|
@@ -98,7 +107,6 @@ export default class extends Controller {
|
|
98
107
|
}
|
99
108
|
}
|
100
109
|
this.input.onkeydown = (e) => {
|
101
|
-
console.log(e.keyCode)
|
102
110
|
if (e.keyCode === 13) { // Enter
|
103
111
|
e.preventDefault()
|
104
112
|
return false
|
@@ -210,6 +218,7 @@ export default class extends Controller {
|
|
210
218
|
}
|
211
219
|
|
212
220
|
buscando () {
|
221
|
+
// FIXME: spinner
|
213
222
|
this.subWrapper.innerHTML = renderToStaticMarkup(
|
214
223
|
<div className="resultados" tabIndex={-1}>
|
215
224
|
<div className="fst-italic text-secondary px-3">Buscando...</div>
|
@@ -219,7 +228,7 @@ export default class extends Controller {
|
|
219
228
|
|
220
229
|
selectItem (e) {
|
221
230
|
if (e.target.dataset.object) {
|
222
|
-
this.completarCampo(
|
231
|
+
this.completarCampo(e.target)
|
223
232
|
} else {
|
224
233
|
this.completarCampo(null)
|
225
234
|
}
|
@@ -258,10 +267,15 @@ export default class extends Controller {
|
|
258
267
|
form.remove()
|
259
268
|
}
|
260
269
|
|
261
|
-
completarCampo (
|
270
|
+
completarCampo (target) {
|
262
271
|
const textField = this.element.querySelector('input[type=text]')
|
263
272
|
const hiddenField = this.element.querySelector('input[type=hidden]')
|
264
|
-
|
273
|
+
|
274
|
+
if (target && target.dataset.fieldName)
|
275
|
+
hiddenField.name = target.dataset.fieldName
|
276
|
+
|
277
|
+
if (target) {
|
278
|
+
let object = JSON.parse(target.dataset.object)
|
265
279
|
hiddenField.value = object.id
|
266
280
|
textField.value = object.to_s
|
267
281
|
textField.setAttribute('readonly', 'true')
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/ # locals: (collection:, query:)
|
1
|
+
/ # locals: (collection:, query:, field_name: nil)
|
2
2
|
.resultados.inline tabindex="-1"
|
3
3
|
ul.list-group.list-group-flush
|
4
4
|
- if collection.any?
|
@@ -6,6 +6,6 @@
|
|
6
6
|
= link_to object.to_s, 'javascript:void(0)',
|
7
7
|
class: 'list-group-item',
|
8
8
|
data: { action: 'asociable#selectItem',
|
9
|
-
id: object.id, object: object.decorate.to_json }
|
9
|
+
id: object.id, object: object.decorate.to_json, field_name: }
|
10
10
|
- else
|
11
|
-
li.px-3.py-1 No hay resultados para "#{query}"
|
11
|
+
li.px-3.py-1 style="font-size: 0.85em" No hay resultados para "#{query}"
|
@@ -53,10 +53,11 @@ module PgEngine
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
# FIXME: default: text: ' Modificar', klass: 'btn-warning')
|
56
57
|
def edit_link(text: '', klass: 'btn-light')
|
57
58
|
return unless Pundit.policy!(Current.user, object).edit?
|
58
59
|
|
59
|
-
helpers.content_tag :span, rel: :tooltip, title: '
|
60
|
+
helpers.content_tag :span, rel: :tooltip, title: 'Modificar' do
|
60
61
|
helpers.link_to edit_object_url, data: { turbo_frame: :main },
|
61
62
|
class: "btn btn-sm #{klass}" do
|
62
63
|
helpers.content_tag(:span, nil, class: clase_icono('pencil')) + text
|
@@ -10,6 +10,14 @@ export default class extends Controller {
|
|
10
10
|
}
|
11
11
|
})
|
12
12
|
})
|
13
|
+
this.element.querySelectorAll('.btn-check').forEach((slct) => {
|
14
|
+
slct.addEventListener('change', (e) => {
|
15
|
+
let invalid = e.target.closest('.is-invalid')
|
16
|
+
if (invalid) {
|
17
|
+
invalid.classList.remove('is-invalid')
|
18
|
+
}
|
19
|
+
})
|
20
|
+
})
|
13
21
|
const errorTitle = this.element.querySelector('.error-title')
|
14
22
|
if (errorTitle) {
|
15
23
|
const invalidField = document.querySelector('.is-invalid')
|
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.77
|
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-05-
|
11
|
+
date: 2024-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|