Merge pull request #19116 from eileenmcnaughton/pay_edit
[civicrm-core.git] / ext / search / ang / crmSearchActions.module.js
1 (function(angular, $, _) {
2 "use strict";
3
4 // Declare module
5 angular.module('crmSearchActions', CRM.angRequires('crmSearchActions'))
6
7 // Reformat an array of objects for compatibility with select2
8 // Todo this probably belongs in core
9 .factory('formatForSelect2', function() {
10 return function(input, key, label, extra) {
11 return _.transform(input, function(result, item) {
12 var formatted = {id: item[key], text: item[label]};
13 if (extra) {
14 _.merge(formatted, _.pick(item, extra));
15 }
16 result.push(formatted);
17 }, []);
18 };
19 });
20
21 })(angular, CRM.$, CRM._);