pg_rails 7.0.8.pre.alpha.77 → 7.0.8.pre.alpha.78
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/helpers/pg_associable/helpers.rb +2 -1
- data/pg_associable/app/javascript/asociable_controller.tsx +25 -13
- data/pg_associable/app/views/pg_associable/_resultados_inline.html.slim +3 -1
- data/pg_engine/app/decorators/pg_engine/base_record_decorator.rb +1 -2
- data/pg_engine/lib/pg_engine/utils/pg_logger.rb +3 -1
- data/pg_layout/app/javascript/controllers/clear_timeout_controller.js +5 -3
- data/pg_layout/app/javascript/controllers/pg_form_controller.js +2 -2
- data/pg_rails/lib/version.rb +1 -1
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 871482c5c249da4284c330d128e8f9d3bb456ba55b2b434fd5ae7f7620402643
|
4
|
+
data.tar.gz: e12f78759a856ebd5f020f44e744e5d894fa5e5cba3e6fcc97751d3df6eecdaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2259c319165804262def78cfb9ea6fb60eb9d3ac813b85f2787c9388aa0127dd905019c964b4fece97ca8a193ac514205b1768f51eac850a78c40c8ce7719503
|
7
|
+
data.tar.gz: 216652a6d27af8b4f17fffa6799215dd07d2d960483e40141f0d12db189558f1234c77138ed8e3939e9c99112c7b52832d0634bb47e9c73a494097d6d516a227
|
@@ -14,10 +14,11 @@ module PgAssociable
|
|
14
14
|
partial = 'pg_associable/resultados_inline'
|
15
15
|
resultados_prefix = 'resultados-inline'
|
16
16
|
query = params[:query]
|
17
|
+
timeout_id = params[:timeout_id]
|
17
18
|
@collection = policy_scope(@clase_modelo).kept.query(query).limit(MAX_RESULTS)
|
18
19
|
render turbo_stream:
|
19
20
|
turbo_stream.update("#{resultados_prefix}-#{params[:id]}",
|
20
|
-
partial:, locals: { collection: @collection, query: })
|
21
|
+
partial:, locals: { collection: @collection, query:, timeout_id: })
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
@@ -79,7 +79,6 @@ export default class extends Controller {
|
|
79
79
|
if (this.savedInputState && !this.input.value) {
|
80
80
|
this.input.value = this.savedInputState
|
81
81
|
}
|
82
|
-
this.savedInputState =
|
83
82
|
this.input.select()
|
84
83
|
if (this.input.value.length === 0) {
|
85
84
|
this.escribiAlgo()
|
@@ -172,6 +171,18 @@ export default class extends Controller {
|
|
172
171
|
)
|
173
172
|
}
|
174
173
|
|
174
|
+
mostrarError () {
|
175
|
+
// TODO: link a contacto
|
176
|
+
this.subWrapper.innerHTML = renderToStaticMarkup(
|
177
|
+
<div className="resultados" tabIndex={-1}>
|
178
|
+
<div className="text-center p-2 text-danger d-flex align-items-center">
|
179
|
+
<i className="bi-exclamation-circle me-2"></i>
|
180
|
+
Ocurrió algo inesperado. Por favor, intentá nuevamente o ponete en contacto con nosotros.
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
)
|
184
|
+
}
|
185
|
+
|
175
186
|
setMaxHeight () {
|
176
187
|
let maxHeight
|
177
188
|
if (!this.element.closest('.modal')) {
|
@@ -218,10 +229,9 @@ export default class extends Controller {
|
|
218
229
|
}
|
219
230
|
|
220
231
|
buscando () {
|
221
|
-
// FIXME: spinner
|
222
232
|
this.subWrapper.innerHTML = renderToStaticMarkup(
|
223
|
-
<div className="resultados" tabIndex={-1}>
|
224
|
-
<
|
233
|
+
<div className="resultados text-center p-2" tabIndex={-1}>
|
234
|
+
<span className="spinner-border" role="status"></span>
|
225
235
|
</div>
|
226
236
|
)
|
227
237
|
}
|
@@ -247,16 +257,19 @@ export default class extends Controller {
|
|
247
257
|
}
|
248
258
|
this.lastValue = this.input.value
|
249
259
|
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
260
|
+
const timerBuscandoId = setTimeout(() => {
|
261
|
+
this.buscando()
|
262
|
+
}, 200)
|
263
|
+
const timerErrorId = setTimeout(() => {
|
264
|
+
this.mostrarError()
|
265
|
+
}, 15000)
|
266
|
+
const timeouts = `${timerBuscandoId},${timerErrorId}`
|
267
|
+
|
256
268
|
const elem = (
|
257
269
|
<form method="post" action={this.input.dataset.urlSearch} data-turbo-stream="true">
|
258
270
|
<input type="hidden" name="id" value={this.elemId} />
|
259
271
|
<input type="hidden" name="query" value={this.input.value} />
|
272
|
+
<input type="hidden" name="timeout_id" value={timeouts} />
|
260
273
|
<input type="hidden" name="puede_crear" value={this.element.dataset.puedeCrear} />
|
261
274
|
</form>
|
262
275
|
)
|
@@ -271,11 +284,10 @@ export default class extends Controller {
|
|
271
284
|
const textField = this.element.querySelector('input[type=text]')
|
272
285
|
const hiddenField = this.element.querySelector('input[type=hidden]')
|
273
286
|
|
274
|
-
if (target && target.dataset.fieldName)
|
275
|
-
hiddenField.name = target.dataset.fieldName
|
287
|
+
if (target && target.dataset.fieldName) { hiddenField.name = target.dataset.fieldName }
|
276
288
|
|
277
289
|
if (target) {
|
278
|
-
|
290
|
+
const object = JSON.parse(target.dataset.object)
|
279
291
|
hiddenField.value = object.id
|
280
292
|
textField.value = object.to_s
|
281
293
|
textField.setAttribute('readonly', 'true')
|
@@ -1,5 +1,7 @@
|
|
1
|
-
/ # locals: (collection:, query:, field_name: nil)
|
1
|
+
/ # locals: (collection:, query:, field_name: nil, timeout_id: nil)
|
2
2
|
.resultados.inline tabindex="-1"
|
3
|
+
- if timeout_id.present?
|
4
|
+
div data-controller="clear-timeout" data-timeout-id="#{timeout_id}"
|
3
5
|
ul.list-group.list-group-flush
|
4
6
|
- if collection.any?
|
5
7
|
- collection.each do |object|
|
@@ -53,8 +53,7 @@ module PgEngine
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
|
57
|
-
def edit_link(text: '', klass: 'btn-light')
|
56
|
+
def edit_link(text: ' Modificar', klass: 'btn-warning')
|
58
57
|
return unless Pundit.policy!(Current.user, object).edit?
|
59
58
|
|
60
59
|
helpers.content_tag :span, rel: :tooltip, title: 'Modificar' do
|
@@ -6,7 +6,9 @@ require 'rainbow'
|
|
6
6
|
|
7
7
|
def pg_err(*args)
|
8
8
|
raise args.first if ENV.fetch('RAISE_ERRORS', false) && args.first.is_a?(Exception)
|
9
|
-
|
9
|
+
|
10
|
+
byebug if ENV.fetch('BYEBUG_ERRORS', false) # rubocop:disable Lint/Debugger
|
11
|
+
|
10
12
|
pg_log(:error, *args)
|
11
13
|
end
|
12
14
|
|
@@ -3,9 +3,11 @@ import { Controller } from '@hotwired/stimulus'
|
|
3
3
|
// Connects to data-controller="clear-timeout"
|
4
4
|
export default class extends Controller {
|
5
5
|
connect () {
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
this.element.dataset.timeoutId.split(',').forEach((el) => {
|
7
|
+
const timeoutId = parseInt(el)
|
8
|
+
clearTimeout(timeoutId)
|
9
|
+
console.log(`clearedTimeout: ${timeoutId}`)
|
10
|
+
})
|
9
11
|
this.element.remove()
|
10
12
|
}
|
11
13
|
}
|
@@ -12,7 +12,7 @@ export default class extends Controller {
|
|
12
12
|
})
|
13
13
|
this.element.querySelectorAll('.btn-check').forEach((slct) => {
|
14
14
|
slct.addEventListener('change', (e) => {
|
15
|
-
|
15
|
+
const invalid = e.target.closest('.is-invalid')
|
16
16
|
if (invalid) {
|
17
17
|
invalid.classList.remove('is-invalid')
|
18
18
|
}
|
@@ -25,7 +25,7 @@ export default class extends Controller {
|
|
25
25
|
if (!invalidField && !baseAlert) {
|
26
26
|
const errorTitle = this.element.querySelector('.error-title')
|
27
27
|
// TODO!: testear con capybara
|
28
|
-
errorTitle.innerText = '
|
28
|
+
errorTitle.innerText = 'Ocurrió algo inesperado. Por favor, intentá nuevamente o ponete en contacto con nosotros.'
|
29
29
|
// TODO!: link a contacto
|
30
30
|
const form = this.element.querySelector('form')
|
31
31
|
const errorMsg = `${form.id} - ${form.action} - ${form.dataset.errors}`
|
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.78
|
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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -808,6 +808,34 @@ dependencies:
|
|
808
808
|
- - "~>"
|
809
809
|
- !ruby/object:Gem::Version
|
810
810
|
version: 0.22.0
|
811
|
+
- !ruby/object:Gem::Dependency
|
812
|
+
name: simplecov-lcov
|
813
|
+
requirement: !ruby/object:Gem::Requirement
|
814
|
+
requirements:
|
815
|
+
- - "~>"
|
816
|
+
- !ruby/object:Gem::Version
|
817
|
+
version: 0.8.0
|
818
|
+
type: :development
|
819
|
+
prerelease: false
|
820
|
+
version_requirements: !ruby/object:Gem::Requirement
|
821
|
+
requirements:
|
822
|
+
- - "~>"
|
823
|
+
- !ruby/object:Gem::Version
|
824
|
+
version: 0.8.0
|
825
|
+
- !ruby/object:Gem::Dependency
|
826
|
+
name: undercover
|
827
|
+
requirement: !ruby/object:Gem::Requirement
|
828
|
+
requirements:
|
829
|
+
- - "~>"
|
830
|
+
- !ruby/object:Gem::Version
|
831
|
+
version: 0.5.0
|
832
|
+
type: :development
|
833
|
+
prerelease: false
|
834
|
+
version_requirements: !ruby/object:Gem::Requirement
|
835
|
+
requirements:
|
836
|
+
- - "~>"
|
837
|
+
- !ruby/object:Gem::Version
|
838
|
+
version: 0.5.0
|
811
839
|
- !ruby/object:Gem::Dependency
|
812
840
|
name: spring
|
813
841
|
requirement: !ruby/object:Gem::Requirement
|