mirror of
https://github.com/moparisthebest/mail
synced 2024-11-21 16:35:04 -05:00
Fetch message contents when leaving read mode
This commit is contained in:
parent
7d266e6a79
commit
d7a4058644
@ -294,6 +294,13 @@ var MailListCtrl = function($scope, $timeout, $location, $filter, $q, status, no
|
||||
}).catch(dialog.error);
|
||||
}
|
||||
|
||||
$scope.$on('read', function(e, state) {
|
||||
if (!state) {
|
||||
// load bodies after closing read mode
|
||||
$scope.loadVisibleBodies();
|
||||
}
|
||||
});
|
||||
|
||||
function currentFolder() {
|
||||
return $scope.state.nav && $scope.state.nav.currentFolder;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
// Controller
|
||||
//
|
||||
|
||||
var ReadCtrl = function($scope, $location, $q, email, invitation, outbox, pgp, keychain, appConfig, download, auth, dialog) {
|
||||
var ReadCtrl = function($scope, $location, $q, email, invitation, outbox, pgp, keychain, appConfig, download, auth, dialog, status) {
|
||||
|
||||
var str = appConfig.string;
|
||||
|
||||
@ -47,6 +47,13 @@ var ReadCtrl = function($scope, $location, $q, email, invitation, outbox, pgp, k
|
||||
// scope functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Close read mode and return to mail-list
|
||||
*/
|
||||
$scope.close = function() {
|
||||
status.setReading(false);
|
||||
};
|
||||
|
||||
$scope.getKeyId = function(address) {
|
||||
if ($location.search().dev || !address) {
|
||||
return;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
var ngModule = angular.module('woDirectives');
|
||||
|
||||
ngModule.directive('listScroll', function() {
|
||||
ngModule.directive('listScroll', function($timeout) {
|
||||
return {
|
||||
link: function(scope, elm, attrs) {
|
||||
var model = attrs.listScroll,
|
||||
@ -12,7 +12,7 @@ ngModule.directive('listScroll', function() {
|
||||
/*
|
||||
* iterates over the mails in the mail list and loads their bodies if they are visible in the viewport
|
||||
*/
|
||||
scope.loadVisibleBodies = function() {
|
||||
function loadVisibleBodies() {
|
||||
var listBorder = listEl.getBoundingClientRect(),
|
||||
top = listBorder.top,
|
||||
bottom = listBorder.bottom,
|
||||
@ -53,6 +53,13 @@ ngModule.directive('listScroll', function() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scope.loadVisibleBodies = function() {
|
||||
// wait for next tick so that scope is digested and synced to DOM
|
||||
$timeout(function() {
|
||||
loadVisibleBodies();
|
||||
});
|
||||
};
|
||||
|
||||
// load body when scrolling
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<div class="read__folder-toolbar">
|
||||
<div class="toolbar">
|
||||
<a class="toolbar__label" href="#" wo-touch="$event.preventDefault(); state.read.toggle(false)">
|
||||
<a class="toolbar__label" href="#" wo-touch="$event.preventDefault(); close()">
|
||||
<svg><use xlink:href="#icon-back" /><title>Back</title></svg>
|
||||
{{state.nav.currentFolder.wellknown ? state.nav.currentFolder.type : state.nav.currentFolder.name}}
|
||||
</a>
|
||||
@ -51,7 +51,7 @@
|
||||
|
||||
{{state.mailList.selected.subject ? state.mailList.selected.subject : 'No subject'}}
|
||||
</h2>
|
||||
<h2 class="read__subject-md" wo-touch="state.read.toggle(false)">
|
||||
<h2 class="read__subject-md" wo-touch="close()">
|
||||
<svg><use xlink:href="#icon-back" /><title>Back</title></svg>
|
||||
{{state.mailList.selected.subject ? state.mailList.selected.subject : 'No subject'}}
|
||||
</h2>
|
||||
|
Loading…
Reference in New Issue
Block a user