pg_rails 7.2.1 → 7.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7685689c316550976fd129e2d10357ce1a4e3242bc5a2468d69bcbfbefe58d6c
4
- data.tar.gz: d23282693ed8d1dbbd0552b5212bf8c7a56f9846cfcd491bedc4f4753a4f7fbd
3
+ metadata.gz: 20cb7ade648f78aa73ed631d9732326edc5a251a36141d054084366d9a6b9859
4
+ data.tar.gz: 38c923c5650e20ecb6be91b304ec3014cbd189976b254500275f5d2bf77ea9a0
5
5
  SHA512:
6
- metadata.gz: a4f384000a2f7955bf91658d863bb1d52c6997cf9eeb0e775b0b4fa236af21f6eee9e5730170ba24f15a64cd8f0a2883db1aac208b5e06413a619547d73de46f
7
- data.tar.gz: 10f9768f3f69b517839b03da38197b27e4c37adbd6cd9490cddab952ed077884548c648b7d16a4f6f1713dd2e8f59b91b91c31b1f1364df813f5b60e9c5aea24
6
+ metadata.gz: 156c1e465ab38406145f7d3bddf65fa0e40bf28a16109c15eb41f623735032dd23f7ddfb4a3341abbe8167ffd065082aef10945c8181c38bb01c4c368aa1853e
7
+ data.tar.gz: 7691712c1641cceb9ed53b6740ad9650844b69056c8433c4b65eb149cc9014ebce8870583306ebe7ed55c23209ec6b762b1a6961225fd65281aa5ddeec133dad
@@ -13,6 +13,7 @@ export default class extends Controller {
13
13
 
14
14
  today = yyyy + '-' + mm + '-' + dd
15
15
  fechaEl.value = today
16
+ return fechaEl.value
16
17
  }
17
18
 
18
19
  closePopover () {
@@ -21,6 +22,12 @@ export default class extends Controller {
21
22
  }
22
23
 
23
24
  async submit () {
25
+ const fechaEl = document.getElementById(this.element.dataset.fieldId)
26
+ let startDate = fechaEl.value
27
+ if (!startDate) {
28
+ startDate = this.today()
29
+ }
30
+
24
31
  const quantity = this.element.querySelector('input[name=quantity]').value
25
32
  if (!quantity) {
26
33
  this.closePopover()
@@ -28,8 +35,6 @@ export default class extends Controller {
28
35
  }
29
36
  const type = this.element.querySelector('select[name=type]').value
30
37
  const direction = this.element.querySelector('select[name=direction]').value
31
- const fechaEl = document.getElementById(this.element.dataset.fieldId)
32
- const startDate = fechaEl.value
33
38
  // console.log(quantity, type, direction)
34
39
  this.element.querySelector('button').setAttribute('disabled', 'true')
35
40
  // let input = this
@@ -49,9 +54,13 @@ export default class extends Controller {
49
54
  this.element.querySelector('button').removeAttribute('disabled')
50
55
  this.closePopover()
51
56
  } else {
52
- const json = await response.json
53
- // FIXME: handle JSON parse error
54
- const message = json.html || 'Hubo un error'
57
+ let message = 'Hubo un error'
58
+ try {
59
+ const json = await response.json
60
+ message = json.html || 'Hubo un error'
61
+ } catch {
62
+ // JSON parser error
63
+ }
55
64
  flashMessage(message, 'warning', true)
56
65
  this.element.querySelector('button').removeAttribute('disabled')
57
66
  Rollbar.error('date jumper error', json)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.2.1'
4
+ VERSION = '7.2.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.1
4
+ version: 7.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso