var blocks = 0;
var result = function(promise) {
blocks++;
- promise.finally(function() {
+ return promise.finally(function() {
blocks--;
});
};
return crmMailingMgr.submit($scope.mailing);
})
.then(function () {
- leave('scheduled');
+ $scope.leave('scheduled');
})
;
return block(crmStatus({start: ts('Submitting...'), success: ts('Submitted')}, promise));
return block(crmStatus({start: ts('Deleting...'), success: ts('Deleted')},
crmMailingMgr.delete($scope.mailing)
.then(function () {
- leave('unscheduled');
+ $scope.leave('unscheduled');
})
));
};
// @param string listingScreen 'archive', 'scheduled', 'unscheduled'
- function leave(listingScreen) {
+ $scope.leave = function leave(listingScreen) {
switch (listingScreen) {
case 'archive':
window.location = CRM.url('civicrm/mailing/browse/archived', {
scheduled: 'false'
});
}
- }
+ };
});
// Controller for the edit-recipients fields (
</div>
<button ng-disabled="block.check() || crmMailing.$invalid" ng-click="submit()">{{ts('Submit Mailing')}}</button>
- <button ng-disabled="block.check()" ng-click="save()">{{ts('Save Draft')}}</button>
+ <button ng-disabled="block.check()" ng-click="save().then(leave)">{{ts('Save Draft')}}</button>
<button ng-disabled="block.check()" crm-confirm="{title:ts('Delete Draft?'), message:ts('Are you sure you want to delete the draft mailing?')}" on-yes="delete()">{{ts('Delete Draft')}}</button>
</div>
</form>
</div>
<button ng-disabled="block.check() || crmMailing.$invalid" ng-click="submit()">{{ts('Submit Mailing')}}</button>
- <button ng-disabled="block.check()" ng-click="save()">{{ts('Save Draft')}}</button>
+ <button ng-disabled="block.check()" ng-click="save().then(leave)">{{ts('Save Draft')}}</button>
<button ng-disabled="block.check()" crm-confirm="{title:ts('Delete Draft?'), message:ts('Are you sure you want to delete the draft mailing?')}" on-yes="delete()">{{ts('Delete Draft')}}</button>
</div>
</form>
<span crm-ui-wizard-buttons style="float:right;">
<button ng-disabled="block.check()" crm-confirm="{title:ts('Delete Draft?'), message:ts('Are you sure you want to delete the draft mailing?')}" on-yes="delete()">{{ts('Delete Draft')}}</button>
- <button ng-disabled="block.check()" ng-click="save()">{{ts('Save Draft')}}</button>
+ <button ng-disabled="block.check()" ng-click="save().then(leave)">{{ts('Save Draft')}}</button>
</span>
</div>
</div>
<span crm-ui-wizard-buttons style="float:right;">
<button ng-disabled="block.check()" crm-confirm="{title:ts('Delete Draft?'), message:ts('Are you sure you want to delete the draft mailing?')}" on-yes="delete()">{{ts('Delete Draft')}}</button>
- <button ng-disabled="block.check()" ng-click="save()">{{ts('Save Draft')}}</button>
+ <button ng-disabled="block.check()" ng-click="save().then(leave)">{{ts('Save Draft')}}</button>
</span>
</div>
</div>