From a6088945a6a25dbd35c4a45f5e51f7fc125fc25a Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Sun, 13 Oct 2013 13:49:37 +0200 Subject: [PATCH] fix > in reply --- src/js/controller/write.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/js/controller/write.js b/src/js/controller/write.js index 77c5e50..82a89b0 100644 --- a/src/js/controller/write.js +++ b/src/js/controller/write.js @@ -12,7 +12,7 @@ define(function(require) { // Controller // - var WriteCtrl = function($scope, $routeParams) { + var WriteCtrl = function($scope, $routeParams, $filter) { $scope.signature = str.signature; // @@ -69,6 +69,8 @@ define(function(require) { } function fillFields(re) { + var from, body, bodyRows; + if (!re) { return; } @@ -81,10 +83,11 @@ define(function(require) { $scope.subject = 'Re: ' + ((re.subject) ? re.subject.replace('Re: ', '') : ''); // fill text body - var body = '

' + re.sentDate + ' ' + re.from[0].name + ' <' + re.from[0].address + '>'; - var bodyRows = re.body.split('\n'); + from = re.from[0].name || re.from[0].address; + body = '

' + $filter('date')(re.sentDate, 'EEEE, MMM d, yyyy h:mm a') + ' ' + from + ' wrote:'; + bodyRows = re.body.split('\n'); bodyRows.forEach(function(row) { - body += (!re.html) ? '
> ' + row : ''; + body += (!re.html) ? '
' + row : ''; }); $scope.body = body; } @@ -179,7 +182,7 @@ define(function(require) { require: 'ngModel', link: function(scope, elm, attrs, ctrl) { // view -> model - elm.on('keyup keydown focus', function() { + elm.on('keyup keydown', function() { scope.$apply(function() { ctrl.$setViewValue(elm.html()); });