cleanup mail controller

This commit is contained in:
Synox 2016-07-03 19:43:14 +02:00
parent 33ab9b5cee
commit 135f1f184b
2 changed files with 9 additions and 17 deletions

View File

@ -12,18 +12,7 @@ class MailController {
this.deleted = true; this.deleted = true;
}); });
} }
showTextButton() {
if ( this.mail.textPlain && !this.mail.textHtml){
return false;
} else {
return true;
}
}
showHtmlButton() {
return !! this.mail.textHtml;
}
} }
export default MailController; export default MailController;

View File

@ -28,17 +28,20 @@
</div> </div>
</div> </div>
<div class="row email-tabs"> <div class="row email-tabs">
<!-- if there is no html content, just show text: -->
<div ng-if="!$ctrl.showHtmlButton()" ng-bind-html="$ctrl.mail.textPlain | nl2br | autolink" class="mail-conent"> <div ng-if="!$ctrl.mail.textHtml" ng-bind-html="$ctrl.mail.textPlain | nl2br | autolink" class="mail-conent">
</div> </div>
<uib-tabset active="1" ng-if="$ctrl.showHtmlButton()">
<uib-tab index="1" disable="!$ctrl.showTextButton()"> <!-- else show tabs with plain text and html:-->
<uib-tabset ng-if="$ctrl.mail.textHtml" active="1">
<uib-tab index="1">
<uib-tab-heading><i class="glyphicon glyphicon-align-left"></i> text</uib-tab-heading> <uib-tab-heading><i class="glyphicon glyphicon-align-left"></i> text</uib-tab-heading>
<div class="mail-conent" ng-bind-html="$ctrl.mail.textPlain | nl2br | autolink "></div> <div class="mail-conent" ng-bind-html="$ctrl.mail.textPlain | nl2br | autolink "></div>
</uib-tab> </uib-tab>
<uib-tab index="2" disable="!$ctrl.showHtmlButton()" select="htmlActive=true"> <uib-tab index="2" select="htmlActive=true">
<uib-tab-heading><i class="glyphicon glyphicon-picture"></i> html</uib-tab-heading> <uib-tab-heading><i class="glyphicon glyphicon-picture"></i> html</uib-tab-heading>
<!-- only load htl content when tab is activated. this avoids loading images from other servers.-->
<div class="mail-conent" ng-if="htmlActive" ng-bind-html="$ctrl.mail.textHtml"></div> <div class="mail-conent" ng-if="htmlActive" ng-bind-html="$ctrl.mail.textHtml"></div>
</uib-tab> </uib-tab>