| 1 | <!-- |
| 2 | Vars: mailing:obj, testContact:obj, testGroup:obj, crmMailing:FormController |
| 3 | --> |
| 4 | <div class="crmMailing-preview"> |
| 5 | <!-- Note: |
| 6 | In Firefox (at least), clicking the preview buttons causes the browser to display validation warnings |
| 7 | for unrelated fields *and* display preview. To avoid this weird UX, we disable preview buttons when the form is incomplete/invalid. |
| 8 | --> |
| 9 | <div class="preview-popup"> |
| 10 | <div ng-show="!mailing.body_html && !mailing.body_text"> |
| 11 | <em>({{ts('No content to preview')}})</em> |
| 12 | </div> |
| 13 | <div ng-hide="!mailing.body_html"> |
| 14 | <a class="crm-hover-button action-item" crm-icon="newwin" ng-disabled="crmMailing.$invalid" ng-click="doPreview('html')">{{ts('Preview as HTML')}}</a> |
| 15 | </div> |
| 16 | <div ng-hide="!mailing.body_html && !mailing.body_text"> |
| 17 | <a class="crm-hover-button action-item" crm-icon="newwin" ng-disabled="crmMailing.$invalid" ng-click="doPreview('text')">{{ts('Preview as Plain Text')}}</a> |
| 18 | </div> |
| 19 | <!-- |
| 20 | <div ng-hide="!mailing.body_html && !mailing.body_text"> |
| 21 | <button ng-disabled="crmMailing.$invalid" ng-click="doPreview('full')">{{ts('Preview')}}</button> |
| 22 | </div> |
| 23 | --> |
| 24 | </div> |
| 25 | <div class="preview-contact" ng-form> |
| 26 | <div> |
| 27 | {{ts('Send test email to:')}} |
| 28 | <a crm-ui-help="hs({id: 'test', title: ts('Test Email')})"></a> |
| 29 | </div> |
| 30 | <div> |
| 31 | <input |
| 32 | name="preview_test_email" |
| 33 | type="email" |
| 34 | class="crm-form-text" |
| 35 | ng-model="testContact.email" |
| 36 | placeholder="example@example.org" |
| 37 | /> |
| 38 | </div> |
| 39 | <button crm-icon="mail-closed" title="{{crmMailing.$invalid || !testContact.email ? ts('Complete all required fields first') : ts('Send test message to %1', {1: testContact.email})}}" ng-disabled="crmMailing.$invalid || !testContact.email" ng-click="doSend({email: testContact.email})">{{ts('Send test')}}</button> |
| 40 | </div> |
| 41 | <div class="preview-group" ng-form> |
| 42 | <div> |
| 43 | {{ts('Send test email to group:')}} |
| 44 | <a crm-ui-help="hs({id: 'test', title: ts('Test Email')})"></a> |
| 45 | </div> |
| 46 | <div> |
| 47 | <select |
| 48 | name="preview_test_group" |
| 49 | ui-jq="select2" |
| 50 | ui-options="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Select Group')}" |
| 51 | ng-model="testGroup.gid" |
| 52 | ng-options="group.id as group.title for group in crmMailingConst.groupNames|orderBy:'title'" |
| 53 | class="crm-action-menu action-icon-mail-closed" |
| 54 | > |
| 55 | <option value=""></option> |
| 56 | </select> |
| 57 | </div> |
| 58 | <button crm-icon="mail-closed" title="{{crmMailing.$invalid || !testGroup.gid ? ts('Complete all required fields first') : ts('Send test message to group')}}"ng-disabled="crmMailing.$invalid || !testGroup.gid" crm-confirm="{resizable: true, width: '40%', height: '40%', open: previewTestGroup}" on-yes="doSend({gid: testGroup.gid})">{{ts('Send test')}}</button> |
| 59 | </div> |
| 60 | <div class="clear"></div> |
| 61 | </div> |