SearchKit - Descriptions for search displays
authorColeman Watts <coleman@civicrm.org>
Wed, 16 Nov 2022 21:25:00 +0000 (16:25 -0500)
committerColeman Watts <coleman@civicrm.org>
Wed, 16 Nov 2022 21:25:00 +0000 (16:25 -0500)
This shows the savedSearch description on the default display,
and allows each custom display to have its own description
which shows at the top.

ext/search_kit/Civi/Api4/Event/Subscriber/DefaultDisplaySubscriber.php
ext/search_kit/ang/crmSearchAdmin/crmSearchAdminDisplayHeader.html
ext/search_kit/ang/crmSearchAdmin/tabs.html
ext/search_kit/ang/crmSearchDisplayGrid/crmSearchDisplayGrid.html
ext/search_kit/ang/crmSearchDisplayList/crmSearchDisplayList.html
ext/search_kit/ang/crmSearchDisplayTable/crmSearchDisplayTable.html

index ee97e7623f1db0e846c0e15991fd93060df40ece..2f34a7ab00dca685c2271d461b539b099d01d480 100644 (file)
@@ -112,6 +112,7 @@ class DefaultDisplaySubscriber extends \Civi\Core\Service\AutoService implements
       return;
     }
     $e->display['settings'] += [
+      'description' => $e->savedSearch['description'] ?? NULL,
       'sort' => [],
       'limit' => \Civi::settings()->get('default_pager_size'),
       'pager' => [
index 173701dbcc389c6a4b31c79311d75e03e08ad1ec..5d7846878638c7b940c6c1963c4c65638b37a29e 100644 (file)
@@ -15,6 +15,9 @@
       {{:: ts('Anyone who can view this display will be able to see all results, regardless of their permission level.') }}
     </div>
   </div>
+  <div>
+    <textarea class="form-control" placeholder="{{:: ts('Description (shown above)') }}" ng-model="$ctrl.display.settings.description"></textarea>
+  </div>
 </fieldset>
 <div class="form-group crm-search-admin-right" ng-if="$ctrl.display.id">
   <a ng-href="{{ $ctrl.parent.crmSearchAdmin.searchDisplayPath + '#/display/' + $ctrl.parent.savedSearch.name + '/' + $ctrl.display.name }}" target="_blank" class="btn btn-primary-outline" title="{{:: ts('View search display on its own page') }}">
index c2ed17850b3a89112c0ac1e7e3bb47553a5c8eaf..99b12d9f38dd3b710f08a8e70ad8a5db0396ad02 100644 (file)
@@ -1,5 +1,5 @@
 <li>
-  <textarea placeholder="{{:: ts('Enter description (only shown to admins)') }}" ng-model="$ctrl.savedSearch.description"></textarea>
+  <textarea class="form-control" placeholder="{{:: ts('Description (shown above default display)') }}" ng-model="$ctrl.savedSearch.description"></textarea>
 </li>
 <li>
   <crm-search-admin-tags tag-ids="$ctrl.savedSearch.tag_id" class="btn-group btn-group-sm"></crm-search-admin-tags>
index 7b7706b8ccd95be3aa67c87517207be19f526eba..e1399d26c81388cf2a75a0b535336f0d0123dcb6 100644 (file)
@@ -1,4 +1,5 @@
 <div class="crm-search-display crm-search-display-grid">
+  <div class="alert alert-info crm-search-display-description" ng-if="$ctrl.settings.description">{{:: $ctrl.settings.description }}</div>
   <div class="form-inline">
     <div class="btn-group" ng-include="'~/crmSearchDisplay/SearchButton.html'" ng-if="$ctrl.settings.button"></div>
     <span ng-if="$ctrl.settings.headerCount" ng-include="'~/crmSearchDisplay/ResultCount.html'"></span>
index 494ef0a60184eb1cf64fccc800f3eaa196ab1299..2924630ffc67d5ef6066f7c90c55acb414f9dd6a 100644 (file)
@@ -1,4 +1,5 @@
 <div class="crm-search-display crm-search-display-list">
+  <div class="alert alert-info crm-search-display-description" ng-if="$ctrl.settings.description">{{:: $ctrl.settings.description }}</div>
   <div class="form-inline">
     <div class="btn-group" ng-include="'~/crmSearchDisplay/SearchButton.html'" ng-if="$ctrl.settings.button"></div>
     <span ng-if="$ctrl.settings.headerCount" ng-include="'~/crmSearchDisplay/ResultCount.html'"></span>
index 3b1da3d6412e7b41286c5f9cd6e276d00f60b017..19d432c73561a5249228fbdd5f1a9177cc90c356 100644 (file)
@@ -1,4 +1,5 @@
 <div class="crm-search-display crm-search-display-table">
+  <div class="alert alert-info crm-search-display-description" ng-if="$ctrl.settings.description">{{:: $ctrl.settings.description }}</div>
   <div class="form-inline">
     <div class="btn-group" ng-include="'~/crmSearchDisplay/SearchButton.html'" ng-if="$ctrl.settings.button"></div>
     <crm-search-tasks ng-if="$ctrl.settings.actions" entity="$ctrl.apiEntity" ids="$ctrl.selectedRows" search="$ctrl.search" display="$ctrl.display" display-controller="$ctrl" refresh="$ctrl.refreshAfterTask()"></crm-search-tasks>