msgtplui - Add navbar and help box
authorTim Otten <totten@civicrm.org>
Tue, 15 Jun 2021 05:58:47 +0000 (22:58 -0700)
committerCiviCRM <info@civicrm.org>
Fri, 24 Sep 2021 04:04:29 +0000 (21:04 -0700)
ext/msgtplui/ang/msgtplui.ang.php
ext/msgtplui/ang/msgtplui/ListCtrl.js
ext/msgtplui/ang/msgtplui/ListNav.html [new file with mode: 0644]
ext/msgtplui/ang/msgtplui/User.html
ext/msgtplui/ang/msgtplui/User.js
ext/msgtplui/ang/msgtplui/Workflow.html
ext/msgtplui/ang/msgtplui/Workflow.js

index ddf0e71b0a487cf02d08aa85a3503f342d9b2103..02ffdc3fa0a969c4cfc6280fcced2851497717d2 100644 (file)
@@ -21,13 +21,15 @@ return [
     'crmUi',
     'crmUtil',
     'ngRoute',
+    'ngSanitize',
     'api4',
   ],
   'settings' => [],
   'basePages' => [],
   'permissions' => [
-    "edit message templates",
-    "edit user-driven message templates",
-    "edit system workflow message templates",
+    'edit message templates',
+    'edit user-driven message templates',
+    'edit system workflow message templates',
+    'access CiviMail',
   ],
 ];
index b827c3250542f28c07f27a344caadb02546aff98..3fc0e8cf79890dcc4d8ff444d847a81487ef3eef 100644 (file)
@@ -5,6 +5,9 @@
     var hs = $scope.hs = crmUiHelp({file: 'CRM/msgtplui/User'}); // See: templates/CRM/msgtplui/User.hlp
     $scope.crmUrl = CRM.url;
     $scope.crmUiAlert = crmUiAlert;
+    $scope.location = $location;
+    $scope.checkPerm = CRM.checkPerm;
+    $scope.help = CRM.help;
 
     var ctrl = this;
     ctrl.records = records;
diff --git a/ext/msgtplui/ang/msgtplui/ListNav.html b/ext/msgtplui/ang/msgtplui/ListNav.html
new file mode 100644 (file)
index 0000000..b623eaa
--- /dev/null
@@ -0,0 +1,30 @@
+<div class="panel panel-info">
+
+  <ul class="panel-heading nav nav-tabs">
+    <li role="presentation"
+        ng-class="{active: location.path() === '/user'}"
+        ng-if="checkPerm('edit message templates') || checkPerm('edit user-driven message templates')">
+      <a ng-href="#/user">{{ts('User-Driven Messages')}}</a>
+    </li>
+    <li role="presentation"
+        ng-class="{active: location.path() === '/workflow'}"
+        ng-if="checkPerm('edit message templates') || checkPerm('edit system workflow message templates')">
+      <a ng-href="#/workflow">{{ts('System Workflow Messages')}}</a>
+    </li>
+  </ul>
+
+</div>
+
+<div class="help">
+
+  <div ng-if="location.path() === '/user'">
+    <span ng-bind-html="ts('Message templates allow you to easily create similar emails or letters on a recurring basis. Messages used for membership renewal reminders, as well as event and activity related reminders should be created via <a href=\'%1\'>Schedule Reminders</a>.', {1: crmUrl('civicrm/admin/scheduleReminders', 'reset=1')})"></span>
+    <span ng-if="checkPerm('access CiviMail')" ng-bind-html="ts('You can also use message templates for CiviMail (bulk email) content. However, subscribe, unsubscribe and opt-out messages are configured at <a href=\'%1\'>Administer > CiviMail > Headers, Footers and Automated Messages</a>.', {1: crmUrl('civicrm/admin/component', 'reset=1')})"></span>
+    <a crm-ui-help="hs({title:ts('User-Driven Messages'), id:'id-intro', file:'CRM/Admin/Page/MessageTemplates'})"></a>
+  </div>
+  <div ng-if="location.path() === '/workflow'">
+    {{ts('System workflow message templates are used to generate the emails sent to constituents and administrators for contribution receipts, event confirmations and many other workflows. You can customize the style and wording of these messages here.')}}
+    <a crm-ui-help="hs({title:ts('System Workflow Messages'), id:'id-system-workflow', file:'CRM/Admin/Page/MessageTemplates'})"></a>
+  </div>
+
+</div>
index 3d78ae04c7fd93bc91b91bfa99051383dad8e0df..a0cb2ebebd84f55897dfd94d10edcd7b87b8a404 100644 (file)
@@ -1,6 +1,8 @@
 <div id="bootstrap-theme">
   <div crm-ui-debug="$ctrl"></div>
 
+  <div ng-include="'~/msgtplui/ListNav.html'"></div>
+
   <div class="form-inline">
     <label for="msgtpl-filter-text">{{:: ts('Filter') }}</label>
     <input class="form-control" type="search" id="msgtpl-filter-text" ng-model="$ctrl.filterText">
index 28f4e4cb850df5b8d183b9093ca19f7233e96c10..61a4f433cb83c73f1c95102e58c1e0986891c775 100644 (file)
@@ -7,12 +7,13 @@
         controllerAs: '$ctrl',
         templateUrl: '~/msgtplui/User.html',
         resolve: {
-          records: function(crmApi4) {
-            return crmApi4('MessageTemplate', 'get', {
+          records: function(crmApi4, crmStatus) {
+            var q = crmApi4('MessageTemplate', 'get', {
               select: ["id", "msg_title", "msg_subject", "is_active"],
               where: [["workflow_name", "IS EMPTY"]],
               orderBy: {"msg_title":"ASC"},
             });
+            return crmStatus({start: ts('Loading...'), success: ''}, q);
           }
         }
       });
index a9f46a5fd93c8af2504e56c5eed177961fb10201..7775c41be10c2266f57b79451e86af5ed981ca39 100644 (file)
@@ -1,6 +1,8 @@
 <div id="bootstrap-theme">
   <div crm-ui-debug="$ctrl"></div>
 
+  <div ng-include="'~/msgtplui/ListNav.html'"></div>
+
   <div class="form-inline">
     <label for="msgtpl-filter-text">{{:: ts('Filter') }}</label>
     <input class="form-control" type="search" id="msgtpl-filter-text" ng-model="$ctrl.filterText">
index 11ed5cf0e51df9659c9558b00e385fb23bc37f7f..c73768330ad9752c6c8a9b13369e60d73ad64837 100644 (file)
@@ -7,8 +7,8 @@
         controllerAs: '$ctrl',
         templateUrl: '~/msgtplui/Workflow.html',
         resolve: {
-          records: function(crmApi4) {
-            return crmApi4('MessageTemplate', 'get', {
+          records: function(crmApi4, crmStatus) {
+            var q= crmApi4('MessageTemplate', 'get', {
               select: ["id", "msg_title", "tx.language:label", "tx.language", "is_default"],
               join: [["Translation AS tx", "LEFT", null, ["tx.entity_table", "=", "'civicrm_msg_template'"], ["tx.entity_id", "=", "id"]]],
               where: [["workflow_name", "IS NOT EMPTY"]],
@@ -16,6 +16,7 @@
               orderBy: {"msg_title":"ASC", "tx.language:label":"ASC"},
               chain: {"statuses":["Translation", "get", {"select":["status_id:name"], "where":[["entity_table", "=", "civicrm_msg_template"], ["entity_id", "=", "$id"], ["language", "=", "$tx.language"]], "groupBy":["status_id"]}, "status_id:name"]}
             });
+            return crmStatus({start: ts('Loading...'), success: ''}, q);
           },
         },
       });