egov_utils 0.4.9 → 0.4.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/egov_utils/eGovUtilities.coffee.erb +15 -11
- data/lib/egov_utils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8835d8512728822233b57d0054282dd28484a259ba2e6809c95614a1b53ea95
|
4
|
+
data.tar.gz: 695953ffa8addaf5470bbea332093f6d572b202a88f4731f659852a921c2259a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
$
|
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(()->
|
data/lib/egov_utils/version.rb
CHANGED