mirror of
https://github.com/moparisthebest/mail
synced 2024-11-23 01:12:19 -05:00
refactor read conrtoller to use global state
This commit is contained in:
parent
866ebbeac4
commit
a82c2ca20a
@ -218,7 +218,7 @@ define(function(require) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.openReadMode();
|
||||
$scope.state.read.toggle(true);
|
||||
if (!window.chrome || !chrome.socket) {
|
||||
return;
|
||||
}
|
||||
|
@ -14,8 +14,6 @@ define(function(require) {
|
||||
|
||||
var NavigationCtrl = function($scope) {
|
||||
$scope.$root.state = {};
|
||||
$scope.navOpen = false;
|
||||
$scope.writerOpen = false;
|
||||
$scope.accountOpen = false;
|
||||
|
||||
emailDao = appController._emailDao;
|
||||
@ -52,13 +50,6 @@ define(function(require) {
|
||||
$scope.accountOpen = false;
|
||||
};
|
||||
|
||||
$scope.openReadMode = function() {
|
||||
$scope.readingMode = true;
|
||||
};
|
||||
$scope.closeReadMode = function() {
|
||||
$scope.readingMode = false;
|
||||
};
|
||||
|
||||
$scope.remove = function(email) {
|
||||
if (!email) {
|
||||
return;
|
||||
|
@ -7,7 +7,14 @@ define(function(require) {
|
||||
// Controller
|
||||
//
|
||||
|
||||
var ReadCtrl = function() {};
|
||||
var ReadCtrl = function($scope) {
|
||||
$scope.state.read = {
|
||||
open: false,
|
||||
toggle: function(to) {
|
||||
this.open = to;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// Directives
|
||||
|
@ -5,13 +5,13 @@
|
||||
|
||||
<!-- content wrapper pushed right -->
|
||||
<div class="nav-pusher" ng-click="state.nav.toggle(false)">
|
||||
<section class="content main-content" ng-class="{'shift-right': readingMode}">
|
||||
<section class="content main-content" ng-class="{'shift-right': state.read.open}">
|
||||
|
||||
<!-- left column: containing list view and navigation header -->
|
||||
<div class="column column-left" ng-include="'tpl/mail-list.html'" ng-controller="MailListCtrl"></div>
|
||||
|
||||
<!-- right column: containing list read view -->
|
||||
<div class="column" ng-include="'tpl/read.html'" ng-controller="ReadCtrl"></div>
|
||||
<div class="column" ng-include="'tpl/read.html'"></div>
|
||||
|
||||
</section>
|
||||
</div><!--/.nav-pusher-->
|
||||
|
@ -4,9 +4,9 @@
|
||||
<button ng-click="state.writer.write()" class="btn-icon" title="New mail"></button>
|
||||
</div><!--/.controls-->
|
||||
|
||||
<div class="view-read">
|
||||
<div class="view-read" ng-controller="ReadCtrl">
|
||||
<div class="headers">
|
||||
<p class="subject" ng-click="closeReadMode()">{{selected.subject || 'No subject'}}</p>
|
||||
<p class="subject" ng-click="state.read.toggle(false)">{{selected.subject || 'No subject'}}</p>
|
||||
<p class="date">{{selected.sentDate | date:'EEEE, MMM d, yyyy h:mm a'}}</p>
|
||||
<p class="address">From: <span class="label" data-icon-append="">{{selected.from[0].name || selected.from[0].address}}</span></p>
|
||||
<p class="address">To: <span class="label" data-icon-append="" ng-repeat="t in selected.to">{{t.address}} </span></p>
|
||||
|
Loading…
Reference in New Issue
Block a user