crmMailingAB - report.html - Include all the major sections from review.html as rows
authorTim Otten <totten@civicrm.org>
Thu, 19 Feb 2015 05:18:20 +0000 (21:18 -0800)
committerTim Otten <totten@civicrm.org>
Thu, 19 Feb 2015 23:04:07 +0000 (15:04 -0800)
css/angular-crmMailingAB.css
js/angular-crmMailing.js
js/angular-crmMailing/directives.js
js/angular-crmMailingAB.js
partials/crmMailing/review.html
partials/crmMailingAB/report.html

index b9fff37ead987d7ddbbe8bf966c67495d92d51b0..5fd4234a8ae34ce95f8265c969e2789a5396e7d9 100644 (file)
@@ -17,5 +17,5 @@
 }
 
 .crm-mailing-ab-col {
-  width: 12em;
+  width: 18em;
 }
index 1c0b3ff8822fbb96e17543dc308308a6b9b4dc99..1b680bb5028fe2f09c5d46cb2bd353eed910dfa5 100644 (file)
     $scope.$on('$destroy', myAutosave.stop);
   });
 
-  // Controller for the edit-recipients fields (
-  // WISHLIST: Move most of this to a (cache-enabled) service
-  // Scope members:
-  //  - [input] mailing: object
-  //  - [output] recipients: array of recipient records
-  angular.module('crmMailing').controller('EditRecipCtrl', function EditRecipCtrl($scope, dialogService, crmApi, crmMailingMgr, $q, crmMetadata) {
-    var ts = $scope.ts = CRM.ts(null);
-    $scope.recipients = null;
-    $scope.getRecipientsEstimate = function () {
-      var ts = $scope.ts;
-      if ($scope.recipients === null) {
-        return ts('(Estimating)');
-      }
-      if ($scope.recipients.length === 0) {
-        return ts('No recipients');
-      }
-      if ($scope.recipients.length === 1) {
-        return ts('~1 recipient');
-      }
-      if (RECIPIENTS_PREVIEW_LIMIT > 0 && $scope.recipients.length >= RECIPIENTS_PREVIEW_LIMIT) {
-        return ts('>%1 recipients', {1: RECIPIENTS_PREVIEW_LIMIT});
-      }
-      return ts('~%1 recipients', {1: $scope.recipients.length});
-    };
-    $scope.getIncludesAsString = function () {
+  angular.module('crmMailing').controller('ViewRecipCtrl', function EditRecipCtrl($scope) {
+    $scope.getIncludesAsString = function(mailing) {
       var first = true;
       var names = '';
-      _.each($scope.mailing.recipients.groups.include, function (id) {
+      _.each(mailing.recipients.groups.include, function (id) {
         if (!first) {
           names = names + ', ';
         }
         names = names + group[0].title;
         first = false;
       });
-      _.each($scope.mailing.recipients.mailings.include, function (id) {
+      _.each(mailing.recipients.mailings.include, function (id) {
         if (!first) {
           names = names + ', ';
         }
       });
       return names;
     };
-    $scope.getExcludesAsString = function () {
+    $scope.getExcludesAsString = function (mailing) {
       var first = true;
       var names = '';
-      _.each($scope.mailing.recipients.groups.exclude, function (id) {
+      _.each(mailing.recipients.groups.exclude, function (id) {
         if (!first) {
           names = names + ', ';
         }
         names = names + group[0].title;
         first = false;
       });
-      _.each($scope.mailing.recipients.mailings.exclude, function (id) {
+      _.each(mailing.recipients.mailings.exclude, function (id) {
         if (!first) {
           names = names + ', ';
         }
       });
       return names;
     };
+  });
+
+  // Controller for the edit-recipients fields (
+  // WISHLIST: Move most of this to a (cache-enabled) service
+  // Scope members:
+  //  - [input] mailing: object
+  //  - [output] recipients: array of recipient records
+  angular.module('crmMailing').controller('EditRecipCtrl', function EditRecipCtrl($scope, dialogService, crmApi, crmMailingMgr, $q, crmMetadata) {
+    var ts = $scope.ts = CRM.ts(null);
+    $scope.recipients = null;
+    $scope.getRecipientsEstimate = function () {
+      var ts = $scope.ts;
+      if ($scope.recipients === null) {
+        return ts('(Estimating)');
+      }
+      if ($scope.recipients.length === 0) {
+        return ts('No recipients');
+      }
+      if ($scope.recipients.length === 1) {
+        return ts('~1 recipient');
+      }
+      if (RECIPIENTS_PREVIEW_LIMIT > 0 && $scope.recipients.length >= RECIPIENTS_PREVIEW_LIMIT) {
+        return ts('>%1 recipients', {1: RECIPIENTS_PREVIEW_LIMIT});
+      }
+      return ts('~%1 recipients', {1: $scope.recipients.length});
+    };
 
     // We monitor four fields -- use debounce so that changes across the
     // four fields can settle-down before AJAX.
index 4767e3ccfc5201b4f7a9fe21462bbffc00b54974..3ebf10b6a5249091d413128cc68474fc29ffdd80 100644 (file)
         crmOn: '@',
         crmTitle: '@'
       },
-      template: '<span ng-class="spanClasses"><span class="icon" ng-class="iconClasses"></span>{{crmTitle}} </span>',
+      template: '<span ng-class="spanClasses"><span class="icon" ng-class="iconClasses"></span>{{evalTitle}} </span>',
       link: function (scope, element, attrs) {
         function refresh() {
           if (scope.$parent.$eval(attrs.crmOn)) {
             scope.spanClasses = {'crmMailing-inactive': true};
             scope.iconClasses = {'ui-icon-close': true};
           }
-          scope.crmTitle = scope.$parent.$eval(attrs.crmTitle);
+          scope.evalTitle = scope.$parent.$eval(attrs.crmTitle);
         }
 
         refresh();
index 115c46d4d09c48a5a30fa4208198044b2ff95e5b..77ff3583a4b6a12d2edc9fd9b4dd5bce1a98b66a 100644 (file)
       if ($scope.abtest.ab.status != activeMailingStatus) {
         activeMailingStatus = $scope.abtest.ab.status;
         activeMailings = [
-          {name: 'a', title: ts('Mailing A'), mailing: $scope.abtest.mailings.a},
-          {name: 'b', title: ts('Mailing B'), mailing: $scope.abtest.mailings.b}
+          {name: 'a', title: ts('Mailing A'), mailing: $scope.abtest.mailings.a, attachments: $scope.abtest.attachments.a},
+          {name: 'b', title: ts('Mailing B'), mailing: $scope.abtest.mailings.b, attachments: $scope.abtest.attachments.b}
         ];
         if ($scope.abtest.ab.status == 'Final') {
-          activeMailings.push({name: 'c', title: ts('Final'), mailing: $scope.abtest.mailings.c});
+          activeMailings.push({name: 'c', title: ts('Final'), mailing: $scope.abtest.mailings.c, attachments: $scope.abtest.attachments.c});
         }
       }
       return activeMailings;
index d6a8660711a3ea631c9790bf0bb8c9ec3d9ec267..662c2a1d14daf68894702332f3cf65b1a0fc59fb 100644 (file)
@@ -9,13 +9,15 @@ Required vars: mailing
         {{mailing.name}}
       </div>
       <div crm-ui-field crm-title="ts('Recipients')">
-        <div ng-controller="EditRecipCtrl">
-          <div><a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewRecipients()">{{getRecipientsEstimate()}}</a></div>
-          <div ng-show="getIncludesAsString()">
-            (<strong>{{ts('Include:')}}</strong> {{getIncludesAsString()}})
-          </div>
-          <div ng-show="getExcludesAsString()">
-            (<strong>{{ts('Exclude:')}}</strong> <s>{{getExcludesAsString()}}</s>)
+        <div ng-controller="ViewRecipCtrl">
+          <div ng-controller="EditRecipCtrl">
+            <div><a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewRecipients()">{{getRecipientsEstimate()}}</a></div>
+            <div ng-show="getIncludesAsString(mailing)">
+              (<strong>{{ts('Include:')}}</strong> {{getIncludesAsString(mailing)}})
+            </div>
+            <div ng-show="getExcludesAsString(mailing)">
+              (<strong>{{ts('Exclude:')}}</strong> <s>{{getExcludesAsString(mailing)}}</s>)
+            </div>
           </div>
         </div>
       </div>
index 7083ae82bfd5356f317af21dd7f0307f9f9e7acb..6a8cab1663eba8e753f32cfe45f0a53d58d9d56d 100644 (file)
 <div ng-controller="CrmMailingABReportCtrl">
   <table>
+    <thead>
+    <tr ng-show="abtest.ab.status == 'Testing'">
+      <td></td>
+      <td ng-repeat="am in getActiveMailings()">
+        <button ng-click="selectWinner(am.name)">{{ts('Select as Winner')}}</button>
+      </td>
+    </tr>
+    </thead>
+
+    <thead>
+    <tr>
+      <th>{{ts('Delivery Summary')}}</th>
+      <th ng-repeat="am in getActiveMailings()" class="crm-mailing-ab-col">{{am.title}}</th>
+    </tr>
+    </thead>
+    <tbody>
+    <tr ng-repeat="statType in statTypes">
+      <td>{{statType.title}}</td>
+      <td ng-repeat="am in getActiveMailings()">
+        <a class="crm-hover-button action-item" ng-href="{{statUrl(am.mailing, statType, 'search')}}" title="{{ts('Search for contacts using \'%1\'', {1: statType.title})}}" crm-icon="search"></a>
+        <a class="crm-hover-button action-item" ng-href="{{statUrl(am.mailing, statType, 'events')}}" title="{{ts('Browse events of type \'%1\'', {1: statType.title})}}">{{stats[am.name][statType.name] || ts('n/a')}}</a>
+      </td>
+    </tr>
+    </tbody>
+
     <thead>
     <tr>
       <th>{{ts('Details')}}</th>
       <th ng-repeat="am in getActiveMailings()" class="crm-mailing-ab-col">{{am.title}}</th>
     </tr>
     </thead>
+
     <tbody>
-    <tr ng-show="abtest.mailings.a.body_html || abtest.mailings.b.body_html">
-      <td>{{ts('HTML')}}</td>
+    <tr>
+      <td>{{ts('Mailing Name')}}</td>
       <td ng-repeat="am in getActiveMailings()">
-        <a class="crm-hover-button" ng-click="previewMailing(am.name,'html')" ng-show="am.mailing.body_html">{{ts('View')}}</a>
+        {{am.mailing.name}}
       </td>
     </tr>
-    <tr ng-show="abtest.mailings.a.body_text || abtest.mailings.b.body_text">
-      <td>{{ts('Text')}}</td>
+    <tr>
+      <td>{{ts('From')}}</td>
       <td ng-repeat="am in getActiveMailings()">
-        <a class="crm-hover-button" ng-click="previewMailing(am.name,'text')" ng-show="am.mailing.body_text">{{ts('View')}}</a>
+        "{{am.mailing.from_name}}" &lt;{{am.mailing.from_email}}&gt;
       </td>
     </tr>
-    <tr ng-repeat="statType in statTypes">
-      <td>{{statType.title}}</td>
+    <tr>
+      <td>{{ts('Subject')}}</td>
       <td ng-repeat="am in getActiveMailings()">
-        <a class="crm-hover-button" ng-href="{{statUrl(am.mailing, statType, 'events')}}" title="{{statType.title}}">{{stats[am.name][statType.name] || ts('n/a')}}</a>
-        <a class="crm-hover-button" ng-href="{{statUrl(am.mailing, statType, 'search')}}" title="{{ts('Search for contacts')}}" crm-icon="search"></a>
+        {{am.mailing.subject}}
       </td>
     </tr>
-    <tr ng-show="abtest.ab.status == 'Testing'">
-      <td></td>
+    <tr ng-controller="ViewRecipCtrl">
+      <td>{{ts('Recipients')}}</td>
       <td ng-repeat="am in getActiveMailings()">
-        <button ng-click="selectWinner(am.name)">{{ts('Select as Winner')}}</button>
+        <div ng-show="getIncludesAsString(am.mailing)">
+          <strong>{{ts('Include:')}}</strong> {{getIncludesAsString(am.mailing)}}
+        </div>
+        <div ng-show="getExcludesAsString(am.mailing)">
+          <strong>{{ts('Exclude:')}}</strong> <s>{{getExcludesAsString(am.mailing)}}</s>
+        </div>
+      </td>
+    </tr>
+    <tr>
+      <td>{{ts('Content')}}</td>
+      <td ng-repeat="am in getActiveMailings()">
+        <a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewMailing(am.name,'html')" ng-show="am.mailing.body_html">{{ts('HTML')}}</a>
+        <a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewMailing(am.name,'text')" ng-show="am.mailing.body_text">{{ts('Text')}}</a>
+      </td>
+    </tr>
+    <tr>
+      <td>{{ts('Attachments')}}</td>
+      <td ng-repeat="am in getActiveMailings()">
+        <div ng-repeat="file in am.attachments.files"><a ng-href="{{file.url}}" target="_blank">{{file.name}}</a></div>
+      </td>
+    </tr>
+    <tr>
+      <td>{{ts('Tracking')}}</td>
+      <td ng-repeat="am in getActiveMailings()">
+        <div crm-mailing-review-bool crm-on="am.mailing.url_tracking=='1'" crm-title="ts('Click Throughs')"></div>
+        <div crm-mailing-review-bool crm-on="am.mailing.open_tracking=='1'" crm-title="ts('Opens')"></div>
+      </td>
+    </tr>
+    <tr>
+      <td>{{ts('Responding')}}</td>
+      <td ng-repeat="am in getActiveMailings()">
+        <div crm-mailing-review-bool crm-on="am.mailing.override_verp=='0'" crm-title="ts('Track Replies')"></div>
+        <div crm-mailing-review-bool crm-on="am.mailing.override_verp=='0' && mailing.forward_replies=='1'" crm-title="ts('Forward Replies')"></div>
+        <div ng-controller="PreviewComponentCtrl">
+          <div ng-show="am.mailing.override_verp == '0' && mailing.auto_responder"><a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewComponent(ts('Auto-Respond'), am.mailing.reply_id)">{{ts('Auto-Respond')}}</a></div>
+          <div><a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewComponent(ts('Opt-out'), am.mailing.optout_id)">{{ts('Opt-out')}}</a></div>
+          <div><a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewComponent(ts('Resubscribe'), am.mailing.resubscribe_id)">{{ts('Resubscribe')}}</a></div>
+          <div><a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewComponent(ts('Unsubscribe'), am.mailing.unsubscribe_id)">{{ts('Unsubscribe')}}</a></div>
+        </div>
+      </td>
+    </tr>
+    <tr>
+      <td>{{ts('Publication')}}</td>
+      <td ng-repeat="am in getActiveMailings()">
+        {{am.mailing.visibility}}
       </td>
     </tr>
     </tbody>
+
   </table>
 
   <div crm-ui-tab-set>