return [
'default' => E::ts('Default'),
'primary' => E::ts('Primary'),
+ 'secondary' => E::ts('Secondary'),
'success' => E::ts('Success'),
'info' => E::ts('Info'),
'warning' => E::ts('Warning'),
switch (link.action) {
case 'view':
link.title = ts('View %1', {1: entityName});
+ link.icon = 'fa-external-link';
+ link.style = 'default';
break;
case 'update':
link.title = ts('Edit %1', {1: entityName});
+ link.icon = 'fa-pencil';
+ link.style = 'default';
break;
case 'delete':
link.title = ts('Delete %1', {1: entityName});
+ link.icon = 'fa-trash';
+ link.style = 'danger';
break;
}
}
// Links to main entity
+ // @return {Array}
var mainEntity = searchMeta.getEntity(ctrl.savedSearch.api_entity),
links = _.cloneDeep(mainEntity.paths || []);
_.each(links, function(link) {
}
};
- var defaultIcons = {
- view: 'fa-external-link',
- update: 'fa-pencil',
- delete: 'fa-trash'
- };
-
- var defaultStyles = {
- view: 'primary',
- update: 'warning',
- delete: 'danger'
- };
-
$scope.pickIcon = function(index) {
searchMeta.pickIcon().then(function(icon) {
ctrl.group[index].icon = icon;
var link = ctrl.getLink(path);
ctrl.group.push({
path: path,
- style: link && defaultStyles[link.action] || 'default',
+ style: link && link.style || 'default',
text: link ? link.title : ts('Link'),
- icon: link && defaultIcons[link.action] || 'fa-external-link'
+ icon: link && link.icon || 'fa-external-link'
});
};
{{:: ts('Style') }}
</label>
<select id="crm-search-admin-col-style-{{$index}}" class="form-control" ng-model="col.style">
- <option ng-repeat="opt in $ctrl.parent.styles" value="{{ opt.key }}">{{ opt.value }}</option>
+ <option ng-repeat="opt in $ctrl.parent.styles" value="{{:: opt.key }}">{{:: opt.value }}</option>
+ <option ng-repeat="opt in $ctrl.parent.styles" value="{{:: opt.key + '-outline' }}">{{:: opt.value + ' ' + ts('Outline') }}</option>
</select>
</div>
<div class="form-inline">
<label>
- {{:: ts('Menu Text/Icon') }}
+ {{:: ts('Menu Icon/Text') }}
</label>
<div class="btn-group">
<button type="button" class="btn btn-{{ col.style + ' ' + col.size }}">
crmSearchAdmin: '^crmSearchAdmin'
},
templateUrl: '~/crmSearchAdmin/resultsTable/crmSearchAdminResultsTable.html',
- controller: function($scope, searchMeta, searchDisplayBaseTrait, searchDisplayTasksTrait, searchDisplaySortableTrait) {
+ controller: function($scope, $element, searchMeta, searchDisplayBaseTrait, searchDisplayTasksTrait, searchDisplaySortableTrait) {
var ts = $scope.ts = CRM.ts('org.civicrm.search_kit'),
// Mix in traits to this controller
ctrl = angular.extend(this, searchDisplayBaseTrait, searchDisplayTasksTrait, searchDisplaySortableTrait);
})
}
};
+ if (links.length) {
+ ctrl.display.settings.columns.push({
+ text: '',
+ icon: 'fa-bars',
+ type: 'menu',
+ size: 'btn-xs',
+ style: 'secondary-outline',
+ alignment: 'text-right',
+ links: _.transform(links, function(links, link) {
+ links.push({
+ path: link.path,
+ text: link.title,
+ icon: link.icon,
+ style: link.style,
+ target: link.action === 'view' ? '_blank' : 'crm-popup'
+ });
+ })
+ });
+ }
ctrl.debug = {
apiParams: JSON.stringify(ctrl.search.api_params, null, 2)
};
this.$onInit = function() {
buildSettings();
- this.initializeDisplay($scope, $());
+ this.initializeDisplay($scope, $element);
$scope.$watch('$ctrl.search.api_entity', buildSettings);
$scope.$watch('$ctrl.search.api_params', buildSettings, true);
};
});
}
+ $element.on('crmPopupFormSuccess', this.getResults);
+
function onChangeFilters() {
ctrl.page = 1;
ctrl.rowCount = null;