1 (function(angular
, $, _
) {
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);
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)', {
16 var options
= CRM
.utils
.adjustDialogDefaults({
18 title
: title
// component[0].name
20 dialogService
.open('previewComponentDialog', '~/crmMailing/PreviewComponentDialogCtrl.html', component
[0], options
);
24 })(angular
, CRM
.$, CRM
._
);