Commit 23bb18a3e81b7966bec6d894f37a601d777b39eb
1 parent
fb30df4d
Exists in
master
and in
4 other branches
Handle loading on submit new proposals
Showing
1 changed file
with
13 additions
and
1 deletions
Show diff stats
js/main.js
| ... | ... | @@ -1278,9 +1278,17 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 1278 | 1278 | // var proposal_id = this.id.split('-').pop(); |
| 1279 | 1279 | // var form = this; |
| 1280 | 1280 | var $form = $(this); |
| 1281 | + | |
| 1282 | + // reset messages | |
| 1281 | 1283 | var $message = $form.find('.message'); |
| 1282 | 1284 | $message.hide(); |
| 1283 | 1285 | $message.text(''); |
| 1286 | + | |
| 1287 | + // handle 'loading' | |
| 1288 | + var $voteContainer = $form.find('.vote-actions'); | |
| 1289 | + $voteContainer.hide(); | |
| 1290 | + // $loading.show(); | |
| 1291 | + | |
| 1284 | 1292 | $.ajax({ |
| 1285 | 1293 | type: 'post', |
| 1286 | 1294 | url: host + $form.attr('action'), |
| ... | ... | @@ -1299,7 +1307,11 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 1299 | 1307 | console.error( 'Request Failed: ' + err ); |
| 1300 | 1308 | $message.show(); |
| 1301 | 1309 | $message.text('Não foi possível enviar.'); |
| 1302 | - }); | |
| 1310 | + }) | |
| 1311 | + .always(function(){ | |
| 1312 | + $voteContainer.show(); | |
| 1313 | + // $loading.hide(); | |
| 1314 | + }); | |
| 1303 | 1315 | }); |
| 1304 | 1316 | }) |
| 1305 | 1317 | .fail(function( jqxhr, textStatus, error ) { | ... | ... |