-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port of civicrm/civicrm-core#24758 (which will be in stable releases from 5.56 - but we will be on 5.54.x until 2023. Bug: T295412 Change-Id: I369b720c5ba6080c0a0f6dc8e275e55ba4dbcc5a
- Loading branch information
1 parent
5aba850
commit cb1a0e7
Showing
6 changed files
with
92 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...sites/all/modules/civicrm/ext/search_kit/ang/crmSearchTasks/crmSearchTaskApiBatch.ctrl.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(function(angular, $, _) { | ||
"use strict"; | ||
|
||
// Generic controller for running an ApiBatch task | ||
angular.module('crmSearchTasks').controller('crmSearchTaskApiBatch', function($scope, searchTaskBaseTrait) { | ||
var ts = $scope.ts = CRM.ts('org.civicrm.search_kit'), | ||
// Combine this controller with model properties (ids, entity, entityInfo) and searchTaskBaseTrait | ||
ctrl = angular.extend(this, $scope.model, searchTaskBaseTrait); | ||
|
||
this.entityTitle = this.getEntityTitle(); | ||
|
||
// If no confirmation message, skip straight to processing | ||
if (!ctrl.apiBatch.confirmMsg) { | ||
ctrl.start(ctrl.apiBatch.params); | ||
} | ||
|
||
this.onSuccess = function() { | ||
CRM.alert(ts(ctrl.apiBatch.successMsg, {1: ctrl.ids.length, 2: ctrl.entityTitle}), ts('%1 Complete', {1: ctrl.taskTitle}), 'success'); | ||
this.close(); | ||
}; | ||
|
||
this.onError = function() { | ||
CRM.alert(ts(ctrl.apiBatch.errorMsg, {1: ctrl.ids.length, 2: ctrl.entityTitle}), ts('Error'), 'error'); | ||
this.cancel(); | ||
}; | ||
|
||
}); | ||
})(angular, CRM.$, CRM._); |
13 changes: 13 additions & 0 deletions
13
...al/sites/all/modules/civicrm/ext/search_kit/ang/crmSearchTasks/crmSearchTaskApiBatch.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div id="bootstrap-theme" crm-dialog="crmSearchTask"> | ||
<form ng-controller="crmSearchTaskApiBatch as $ctrl"> | ||
<p><strong ng-if="model.apiBatch.confirmMsg">{{:: ts(model.apiBatch.confirmMsg, {1: model.ids.length, 2: $ctrl.entityTitle}) }}</strong></p> | ||
<hr /> | ||
<div ng-if="$ctrl.run" class="crm-search-task-progress"> | ||
<h5>{{:: ts(model.apiBatch.runMsg, {1: model.ids.length, 2: $ctrl.entityTitle}) }}</h5> | ||
<crm-search-batch-runner entity="model.entity" action="{{:: model.apiBatch.action }}" params="$ctrl.run" ids="model.ids" success="$ctrl.onSuccess()" error="$ctrl.onError()" id-field="{{:: $ctrl.entityInfo.primary_key[0] }}"></crm-search-batch-runner> | ||
</div> | ||
|
||
<crm-dialog-button text="ts('Cancel')" icons="{primary: 'fa-times'}" on-click="$ctrl.cancel()" disabled="$ctrl.run" ></crm-dialog-button> | ||
<crm-dialog-button ng-if="model.apiBatch.confirmMsg" text="model.taskTitle" icons="{primary: $ctrl.run ? 'fa-spin fa-spinner' : 'fa-check'}" on-click="$ctrl.start(model.apiBatch.params)" disabled="$ctrl.run" ></crm-dialog-button> | ||
</form> | ||
</div> |
22 changes: 0 additions & 22 deletions
22
...l/sites/all/modules/civicrm/ext/search_kit/ang/crmSearchTasks/crmSearchTaskDelete.ctrl.js
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
drupal/sites/all/modules/civicrm/ext/search_kit/ang/crmSearchTasks/crmSearchTaskDelete.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters