Commit | Line | Data |
---|---|---|
6b8bd380 TO |
1 | (function(angular, $, _) { |
2 | ||
3 | // Controller for the "Preview Mailing Component" segment | |
4 | // which displays header/footer/auto-responder | |
5 | angular.module('crmMailing').controller('PreviewComponentCtrl', function PreviewComponentCtrl($scope, dialogService) { | |
6 | var ts = $scope.ts = CRM.ts(null); | |
7 | ||
8 | $scope.previewComponent = function previewComponent(title, componentId) { | |
9 | var component = _.where(CRM.crmMailing.headerfooterList, {id: "" + componentId}); | |
10 | if (!component || !component[0]) { | |
11 | CRM.alert(ts('Invalid component ID (%1)', { | |
12 | 1: componentId | |
13 | })); | |
14 | return; | |
15 | } | |
16 | var options = CRM.utils.adjustDialogDefaults({ | |
17 | autoOpen: false, | |
18 | title: title // component[0].name | |
19 | }); | |
fd9c35ce | 20 | dialogService.open('previewComponentDialog', '~/crmMailing/PreviewComponentDialogCtrl.html', component[0], options); |
6b8bd380 TO |
21 | }; |
22 | }); | |
23 | ||
24 | })(angular, CRM.$, CRM._); |