pg_rails 7.0.8.pre.alpha.77 → 7.0.8.pre.alpha.79
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/pg_associable/app/helpers/pg_associable/helpers.rb +2 -1
- data/pg_associable/app/javascript/asociable_controller.tsx +34 -13
- data/pg_associable/app/views/pg_associable/_resultados_inline.html.slim +2 -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: d09fbc215c11289297d4f68d0c757492382490591e45e555ad6bd9347dd5a48f
|
4
|
+
data.tar.gz: 31677fedfd7ff1eb0d02fdaf038f1b97995b979d96ba066ba4bad6f2c87a60ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52cc06a4a2e3843abc3fbe5344bc913276556c8bbc9f0945f10843c188ad92e92e02955738715a18e4f09526e4759d0db716fef414941a086eda36347279e312
|
7
|
+
data.tar.gz: 712ff73b644360b0f05f133d172af8cb3a827116439ea10352b56272313b4e06a39092f322e666569609c7b0ab173e3f1ab1f2ddb3ae6e37e1e5964baa8c660d
|
@@ -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,21 @@ export default class extends Controller {
|
|
172
171
|
)
|
173
172
|
}
|
174
173
|
|
174
|
+
mostrarError () {
|
175
|
+
if (this.element.querySelector('.resultados .spinner-border')) {
|
176
|
+
Rollbar.error('Time out de asociable.js')
|
177
|
+
// TODO: link a contacto
|
178
|
+
this.subWrapper.innerHTML = renderToStaticMarkup(
|
179
|
+
<div className="resultados" tabIndex={-1}>
|
180
|
+
<div className="text-center p-2 text-danger d-flex align-items-center">
|
181
|
+
<i className="bi-exclamation-circle me-2"></i>
|
182
|
+
Ocurrió algo inesperado. Por favor, intentá nuevamente o ponete en contacto con nosotros.
|
183
|
+
</div>
|
184
|
+
</div>
|
185
|
+
)
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
175
189
|
setMaxHeight () {
|
176
190
|
let maxHeight
|
177
191
|
if (!this.element.closest('.modal')) {
|
@@ -218,10 +232,9 @@ export default class extends Controller {
|
|
218
232
|
}
|
219
233
|
|
220
234
|
buscando () {
|
221
|
-
// FIXME: spinner
|
222
235
|
this.subWrapper.innerHTML = renderToStaticMarkup(
|
223
|
-
<div className="resultados" tabIndex={-1}>
|
224
|
-
<
|
236
|
+
<div className="resultados text-center p-2" tabIndex={-1}>
|
237
|
+
<span className="spinner-border" role="status"></span>
|
225
238
|
</div>
|
226
239
|
)
|
227
240
|
}
|
@@ -247,16 +260,25 @@ export default class extends Controller {
|
|
247
260
|
}
|
248
261
|
this.lastValue = this.input.value
|
249
262
|
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
//
|
255
|
-
|
263
|
+
const timerBuscandoId = setTimeout(() => {
|
264
|
+
// console.log(`timed out ${timerBuscandoId}`)
|
265
|
+
this.buscando()
|
266
|
+
}, 200)
|
267
|
+
// console.log(`setTimeOut ${timerBuscandoId}`)
|
268
|
+
document.addEventListener('turbo:before-stream-render', (i) => {
|
269
|
+
// console.log(`clear before stream render ${timerBuscandoId}`)
|
270
|
+
clearTimeout(timerBuscandoId)
|
271
|
+
}, { once: true })
|
272
|
+
const timerErrorId = setTimeout(() => {
|
273
|
+
this.mostrarError()
|
274
|
+
}, 15000)
|
275
|
+
const timeouts = `${timerBuscandoId},${timerErrorId}`
|
276
|
+
|
256
277
|
const elem = (
|
257
278
|
<form method="post" action={this.input.dataset.urlSearch} data-turbo-stream="true">
|
258
279
|
<input type="hidden" name="id" value={this.elemId} />
|
259
280
|
<input type="hidden" name="query" value={this.input.value} />
|
281
|
+
<input type="hidden" name="timeout_id" value={timeouts} />
|
260
282
|
<input type="hidden" name="puede_crear" value={this.element.dataset.puedeCrear} />
|
261
283
|
</form>
|
262
284
|
)
|
@@ -271,11 +293,10 @@ export default class extends Controller {
|
|
271
293
|
const textField = this.element.querySelector('input[type=text]')
|
272
294
|
const hiddenField = this.element.querySelector('input[type=hidden]')
|
273
295
|
|
274
|
-
if (target && target.dataset.fieldName)
|
275
|
-
hiddenField.name = target.dataset.fieldName
|
296
|
+
if (target && target.dataset.fieldName) { hiddenField.name = target.dataset.fieldName }
|
276
297
|
|
277
298
|
if (target) {
|
278
|
-
|
299
|
+
const object = JSON.parse(target.dataset.object)
|
279
300
|
hiddenField.value = object.id
|
280
301
|
textField.value = object.to_s
|
281
302
|
textField.setAttribute('readonly', 'true')
|
@@ -1,5 +1,6 @@
|
|
1
|
-
/ # locals: (collection:, query:, field_name: nil)
|
1
|
+
/ # locals: (collection:, query:, timeout_id:, field_name: nil)
|
2
2
|
.resultados.inline tabindex="-1"
|
3
|
+
div data-controller="clear-timeout" data-timeout-id="#{timeout_id}"
|
3
4
|
ul.list-group.list-group-flush
|
4
5
|
- if collection.any?
|
5
6
|
- 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.79
|
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
|