CRM-15578 - crmMailing2 - Add "responses.html"
authorTim Otten <totten@civicrm.org>
Mon, 3 Nov 2014 01:51:14 +0000 (17:51 -0800)
committerTim Otten <totten@civicrm.org>
Tue, 11 Nov 2014 00:20:57 +0000 (16:20 -0800)
js/angular-crmMailing2.js
partials/crmMailing2/responses.html

index d75cfe308e2086a171eef095c945db74eb90df1e..4919b095116a5f21ee6d8aca6817c17667b0b66b 100644 (file)
    * TODO Move to separate file or service
    */
   var createMailing = function () {
+    var pickDefaultMailComponent = function(type) {
+      var mcs = _.where(CRM.crmMailing.headerfooterList, {
+        component_type:type,
+        is_default: "1"
+      });
+      return (mcs.length >= 1) ? mcs[0].id : null;
+    };
+
     return {
       name: "",
       campaign_id: null,
       dedupe_email: "1",
       forward_replies: "0",
       auto_responder: "0",
-      open_tracking: "1"
+      open_tracking: "1",
+      override_verp: "1",
+      optout_id: pickDefaultMailComponent('OptOut'),
+      reply_id: pickDefaultMailComponent('Reply'),
+      resubscribe_id: pickDefaultMailComponent('Resubscribe'),
+      unsubscribe_id: pickDefaultMailComponent('Unsubscribe')
     };
   };
 
index 07753eb589689e19ca234aca07041dd657d2ef32..8e28768c3b93754116efc524fd042ad5c1080838 100644 (file)
@@ -1 +1,112 @@
-responses.html
+<!--
+Controller: EditMailingCtrl
+Required vars: mailing, crmMailingConst
+FIXME: Don't hardcode table-based layout!
+-->
+<table class="form-layout-compressed">
+  <tbody>
+    <tr>
+      <td>
+        <!-- Comparing data-model and UI of "override_verp", note that true/false are inverted (enabled==0,disabled==1) -->
+        <input name="override_verp" type="checkbox" ng-model="mailing.override_verp" ng-true-value="0" ng-false-value="1" />
+        <label crm-ui-label crm-for="override_verp">{{ts('Track Replies')}}</label>
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <div class="help">
+          {{ts('Recipients\' replies are sent to a CiviMail specific address instead of the sender\'s address so they can be stored within CiviCRM.')}}
+        </div>
+      </td>
+    </tr>
+    <tr ng-show="'0' == mailing.override_verp">
+      <td>
+        <input name="forward_replies" type="checkbox" ng-model="mailing.forward_replies" ng-true-value="1" ng-false-value="0" />
+        <label crm-ui-label crm-for="forward_replies">{{ts('Forward Replies')}}</label>
+      </td>
+    </tr>
+    <tr ng-show="'0' == mailing.override_verp">
+      <td>
+        <div class="help">
+          {{ts('If a recipient replies to this mailing, forward the reply to the FROM Email address specified for the mailing.')}}
+        </div>
+      </td>
+    </tr>
+    <tr ng-show="'0' == mailing.override_verp">
+      <td>
+        <input name="auto_responder" type="checkbox" ng-model="mailing.auto_responder" ng-true-value="1" ng-false-value="0" />
+        <label crm-ui-label crm-for="auto_responder">{{ts('Auto-Respond to Replies')}}</label>
+      </td>
+    </tr>
+    <tr ng-show="'0' == mailing.override_verp">
+      <td>
+        <div class="help">
+          {{ts('If a recipient replies to this mailing, send an automated reply using the selected message.')}}
+        </div>
+      </td>
+    </tr>
+  </tbody>
+</table>
+
+<hr/>
+
+<table>
+  <tbody>
+    <tr ng-show="'0' == mailing.override_verp && '1' == mailing.auto_responder">
+      <td><label crm-ui-label crm-for="reply_id">{{ts('Auto-Respond Message')}}</label></td>
+      <td>
+        <select
+          name="reply_id"
+          ui-jq="select2"
+          ui-options="{dropdownAutoWidth : true}"
+          ng-model="mailing.reply_id"
+          ng-options="mc.id as mc.name for mc in crmMailingConst.headerfooterList | filter:{component_type: 'Reply'}"
+          required>
+          <option value=""></option>
+        </select>
+      </td>
+    </tr>
+    <tr>
+      <td><label crm-ui-label crm-for="optout_id">{{ts('Opt-out Message')}}</label></td>
+      <td>
+        <select
+          name="optout_id"
+          ui-jq="select2"
+          ui-options="{dropdownAutoWidth : true}"
+          ng-model="mailing.optout_id"
+          ng-options="mc.id as mc.name for mc in crmMailingConst.headerfooterList | filter:{component_type: 'OptOut'}"
+          required>
+          <option value=""></option>
+        </select>
+      </td>
+    </tr>
+    <tr>
+      <td><label crm-ui-label crm-for="resubscribe_id">{{ts('Resubscribe Message')}}</label></td>
+      <td>
+        <select
+          name="resubscribe_id"
+          ui-jq="select2"
+          ui-options="{dropdownAutoWidth : true}"
+          ng-model="mailing.resubscribe_id"
+          ng-options="mc.id as mc.name for mc in crmMailingConst.headerfooterList | filter:{component_type: 'Resubscribe'}"
+          required>
+          <option value=""></option>
+        </select>
+      </td>
+    </tr>
+    <tr>
+      <td><label crm-ui-label crm-for="unsubscribe_id">{{ts('Unsubscribe Message')}}</label></td>
+      <td>
+        <select
+          name="unsubscribe_id"
+          ui-jq="select2"
+          ui-options="{dropdownAutoWidth : true}"
+          ng-model="mailing.unsubscribe_id"
+          ng-options="mc.id as mc.name for mc in crmMailingConst.headerfooterList | filter:{component_type: 'Unsubscribe'}"
+          required>
+          <option value=""></option>
+        </select>
+      </td>
+    </tr>
+  </tbody>
+</table>