Skip to content

Commit

Permalink
Client side: Fixed ajaxified action links [Closed #114]
Browse files Browse the repository at this point in the history
  • Loading branch information
o5 committed Apr 3, 2014
1 parent c2f3ba1 commit 153497d
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions client-side/grido.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,21 @@
.off('click.nette')
.off('click.grido')
.on('click.grido', function(event) {
var hasConfirm = $(this).data('grido-confirm');
if (hasConfirm && !confirm(hasConfirm)) {
event.preventDefault();
event.stopImmediatePropagation();
} else if (hasConfirm && $(this).hasClass('ajax') && that.ajax) {
that.ajax.doRequest(this.href);
event.preventDefault();
event.stopImmediatePropagation();
var isAjax = $(this).hasClass('ajax') && that.ajax,
hasConfirm = $(this).data('grido-confirm'),
stop = function(event) {
event.preventDefault();
event.stopImmediatePropagation();
};

if (hasConfirm && confirm(hasConfirm)) {
isAjax && (that.ajax.doRequest(this.href) || stop(event));

} else if (hasConfirm) {
stop(event);

} else if (isAjax) {
that.ajax.doRequest(this.href) || stop(event);
}
});
},
Expand Down

0 comments on commit 153497d

Please sign in to comment.