pg_rails 7.2.1 → 7.2.3

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: c2505003e224d063bd2c51742b431b315cef9e83b08c867adb0687f9184ad559
4
+ data.tar.gz: 0d3e3c74ef4c00f0e369302a592fccc0749ddb53c7143abd0be4dc1cf7da6418
5
5
  SHA512:
6
- metadata.gz: a4f384000a2f7955bf91658d863bb1d52c6997cf9eeb0e775b0b4fa236af21f6eee9e5730170ba24f15a64cd8f0a2883db1aac208b5e06413a619547d73de46f
7
- data.tar.gz: 10f9768f3f69b517839b03da38197b27e4c37adbd6cd9490cddab952ed077884548c648b7d16a4f6f1713dd2e8f59b91b91c31b1f1364df813f5b60e9c5aea24
6
+ metadata.gz: 64ee127677a3f745bd0d29b8fac8150b03470d4cd03d6d6b37078168a3bfd43ac3332f085942bb9d0ea94b164fdd863f65df76c116f8e1ff708ebe012ac31348
7
+ data.tar.gz: 6cb3a28799ddd2a7c2fb621a1875b246b825355cd0e7b3a66925030138f46b0d81e1d5c0fa22ce29c4c5c747984145076af5a89085891112230ed34ebcd61732
@@ -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
@@ -43,18 +48,23 @@ export default class extends Controller {
43
48
  responseKind: 'json'
44
49
  })
45
50
 
51
+ let json = null
46
52
  if (response.ok) {
47
- const json = await response.json
53
+ json = await response.json
48
54
  fechaEl.value = json.date
49
55
  this.element.querySelector('button').removeAttribute('disabled')
50
56
  this.closePopover()
51
57
  } else {
52
- const json = await response.json
53
- // FIXME: handle JSON parse error
54
- const message = json.html || 'Hubo un error'
58
+ let message = 'Hubo un error'
59
+ try {
60
+ json = await response.json
61
+ message = json.html || 'Hubo un error'
62
+ } catch (e) {
63
+ // JSON parser error
64
+ Rollbar.error(e)
65
+ }
55
66
  flashMessage(message, 'warning', true)
56
67
  this.element.querySelector('button').removeAttribute('disabled')
57
- Rollbar.error('date jumper error', json)
58
68
  }
59
69
  }
60
70
  }
@@ -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.3'
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.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso