diff options
Diffstat (limited to 'www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailing/PreviewComponentCtrl.js')
-rw-r--r-- | www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailing/PreviewComponentCtrl.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailing/PreviewComponentCtrl.js b/www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailing/PreviewComponentCtrl.js new file mode 100644 index 00000000..3fd928a1 --- /dev/null +++ b/www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailing/PreviewComponentCtrl.js @@ -0,0 +1,24 @@ +(function(angular, $, _) { + + // Controller for the "Preview Mailing Component" segment + // which displays header/footer/auto-responder + angular.module('crmMailing').controller('PreviewComponentCtrl', function PreviewComponentCtrl($scope, dialogService) { + var ts = $scope.ts = CRM.ts(null); + + $scope.previewComponent = function previewComponent(title, componentId) { + var component = _.where(CRM.crmMailing.headerfooterList, {id: "" + componentId}); + if (!component || !component[0]) { + CRM.alert(ts('Invalid component ID (%1)', { + 1: componentId + })); + return; + } + var options = CRM.utils.adjustDialogDefaults({ + autoOpen: false, + title: title // component[0].name + }); + dialogService.open('previewComponentDialog', '~/crmMailing/PreviewComponentDialogCtrl.html', component[0], options); + }; + }); + +})(angular, CRM.$, CRM._); |