Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Add option to Petition.js to skip post submit action
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrei committed Nov 23, 2016
1 parent aa3d705 commit b7a630e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/assets/javascripts/member-facing/backbone/petition.js
Expand Up @@ -14,10 +14,15 @@ const Petition = Backbone.View.extend({
initialize(options = {}) {
this.followUpUrl = options.followUpUrl;
this.submissionCallback = options.submissionCallback;
this.skipOnSuccessAction = options.skipOnSuccessAction;
GlobalEvents.bindEvents(this);
},

handleSuccess(e, data) {
$.publish('petition:submitted');
if(this.skipOnSuccessAction) {
return;
}
let hasCallbackFunction = (typeof this.submissionCallback === 'function');
if (hasCallbackFunction) {
this.submissionCallback(e, data);
Expand Down

0 comments on commit b7a630e

Please sign in to comment.