egov_utils 0.4.9 → 0.4.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36e83b4cc0d2d3c4cca271573fe52c05be094841c2752355fd419d3ad5ede82c
4
- data.tar.gz: 13ec9e2830a06f4863bfd58890258ebccf7266e37783af5e094de4089a4e7806
3
+ metadata.gz: b8835d8512728822233b57d0054282dd28484a259ba2e6809c95614a1b53ea95
4
+ data.tar.gz: 695953ffa8addaf5470bbea332093f6d572b202a88f4731f659852a921c2259a
5
5
  SHA512:
6
- metadata.gz: bcd3259094c96b7dbfea0cda362bbaf570a96ca8315c4f7c92e0f376018435f4b5193b23348f30805acf48f808291b008de11cd78105e9db1903e48397d4f824
7
- data.tar.gz: 437c12e05d1839a2e6e980b5ef062c7e753620fff6f11807d7d4bb75c6e0aaf898424c491739a8ac7fb3ad1e5dacffdeb64ec51a6759c165caeaae619edcc502
6
+ metadata.gz: 360361559b3569ad840420f04f92211c1b222aff42e2420cc24fce49e2daf1113bd0f03e6e391521b63a020be1629773b302d73b9aa93af9d73596c4b87781d1
7
+ data.tar.gz: f184c8def268115b841ec3dcbdf2d683d90795edb6f4c81263654794e26491bf32781832fba740b5e96262568b520c01bca83a50f4676bc8edfbd0573711e187
@@ -122,6 +122,7 @@ window.eGovUtilities =
122
122
  options = options || {}
123
123
  modalId = modalId || 'modal'
124
124
  $modal = $('#'+modalId)
125
+ modalOptions = options
125
126
  if $modal.length != 1
126
127
  $modal = $('<div id="'+modalId+'" class="modal fade"'+(if options['backdrop'] then ' data-backdrop="static"' else '')+'><div class="modal-dialog">
127
128
  <div class="modal-content">
@@ -133,17 +134,19 @@ window.eGovUtilities =
133
134
  <div class="modal-footer"></div>
134
135
  </div></div></div>').appendTo('body')
135
136
  $modal.on 'submit', 'form', (evt)->
136
- evt.preventDefault()
137
- $form = $(this)
138
- data = $form.serializeArray()
139
- $.ajax($form.attr('action')+'.json', {method: $form.attr('method'), data: data, dataType: 'json'}).done (xhr)->
140
- $modal.trigger('egov:submitted', [xhr])
137
+ if modalOptions['ajaxForm'] != false
138
+ evt.preventDefault()
139
+ $form = $(this)
140
+ data = $form.serializeArray()
141
+ $.ajax($form.attr('action'), {method: $form.attr('method'), data: data, dataType: 'json'}).done (xhr)->
142
+ $modal.trigger('egov:submitted', [xhr])
143
+ $modal.modal('hide')
144
+ .fail (xhr) ->
145
+ if xhr.status == 422
146
+ $.ajax($form.attr('action'), {method: $form.attr('method'), data: data, dataType: 'html'}).done (xhr)->
147
+ eGovUtilities.setModalContent($modal, xhr)
148
+ else
141
149
  $modal.modal('hide')
142
- .fail (xhr) ->
143
- if xhr.status == 422
144
- $.ajax($form.attr('action'), {method: $form.attr('method'), data: data, dataType: 'html'}).done (xhr)->
145
- eGovUtilities.setModalContent($modal, xhr)
146
-
147
150
  $modal
148
151
 
149
152
  setModalContent: ($modal, body, title) ->
@@ -153,11 +156,12 @@ window.eGovUtilities =
153
156
 
154
157
  showModal: (body, options) ->
155
158
  options = options || {}
156
- $modal = this.initModal((options['modalId']), {backdrop: options['backdrop']})
159
+ $modal = this.initModal((options['modalId']), {backdrop: options['backdrop'], ajaxForm: options['ajaxForm']})
157
160
  title = options['title']
158
161
  delete options['modalId']
159
162
  delete options['backdrop']
160
163
  delete options['title']
164
+ delete options['ajaxForm']
161
165
  eGovUtilities.setModalContent($modal, body, title)
162
166
  $modal.modal(options)
163
167
  window.setTimeout(()->
@@ -1,3 +1,3 @@
1
1
  module EgovUtils
2
- VERSION = '0.4.9'
2
+ VERSION = '0.4.10'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: egov_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr