1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-26 19:02:20 -05:00

integrate iscroll with angular directive

This commit is contained in:
Tankred Hase 2013-10-16 15:21:23 +02:00
parent 8a37d6b10e
commit 2fdb72b04c
6 changed files with 48 additions and 15 deletions

View File

@ -13,7 +13,7 @@ require([
], function(angular, LoginCtrl, MailListCtrl, ReadCtrl, WriteCtrl, NavigationCtrl) { ], function(angular, LoginCtrl, MailListCtrl, ReadCtrl, WriteCtrl, NavigationCtrl) {
'use strict'; 'use strict';
var app = angular.module('mail', ['ngRoute', 'ngTouch', 'navigation', 'write', 'read']); var app = angular.module('mail', ['ngRoute', 'ngTouch', 'navigation', 'mail-list', 'write', 'read']);
// set router paths // set router paths
app.config(function($routeProvider) { app.config(function($routeProvider) {

View File

@ -2,7 +2,9 @@ define(function(require) {
'use strict'; 'use strict';
var _ = require('underscore'), var _ = require('underscore'),
angular = require('angular'),
appController = require('js/app-controller'), appController = require('js/app-controller'),
IScroll = require('iscroll'),
emailDao; emailDao;
var MailListCtrl = function($scope) { var MailListCtrl = function($scope) {
@ -207,5 +209,25 @@ define(function(require) {
return dummys; return dummys;
} }
//
// Directives
//
var ngModule = angular.module('mail-list', []);
ngModule.directive('ngIscroll', function() {
return {
link: function(scope, elm) {
setTimeout(function() {
var myScroll;
// activate iscroll
myScroll = new IScroll(elm[0], {
mouseWheel: true
});
}, 0);
}
};
});
return MailListCtrl; return MailListCtrl;
}); });

2
src/lib/iscroll/iscroll-min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,8 @@
angularTouch: 'angular/angular-touch.min', angularTouch: 'angular/angular-touch.min',
moment: 'moment/moment.min', moment: 'moment/moment.min',
uuid: 'uuid/uuid', uuid: 'uuid/uuid',
openpgp: 'openpgp/openpgp' openpgp: 'openpgp/openpgp',
iscroll: 'iscroll/iscroll-min'
}, },
shim: { shim: {
angular: { angular: {
@ -29,6 +30,9 @@
openpgp: { openpgp: {
exports: 'window' exports: 'window'
}, },
iscroll: {
exports: 'IScroll'
},
angularRoute: { angularRoute: {
exports: 'angular', exports: 'angular',
deps: ['angular'] deps: ['angular']

View File

@ -39,10 +39,13 @@
} }
ul { .list-wrapper {
padding: 0 $padding-horizontal 78px $padding-horizontal;
height: 100%; height: 100%;
overflow-y: scroll; padding: 0 $padding-horizontal 78px $padding-horizontal;
overflow-y: hidden;
}
ul {
} }
footer { footer {

View File

@ -3,7 +3,8 @@
<h2>{{currentFolder.type}}</h2> <h2>{{currentFolder.type}}</h2>
</header> </header>
<ul class="mail-list"> <div class="list-wrapper" ng-iscroll>
<ul class="mail-list">
<li ng-class="{'mail-list-active': email === selected, 'mail-list-attachment': email.attachments !== undefined && email.attachments.length > 0, 'mail-list-unread': email.unread, 'mail-list-replied': email.answered}" ng-click="select(email)" ng-repeat="email in emails"> <li ng-class="{'mail-list-active': email === selected, 'mail-list-attachment': email.attachments !== undefined && email.attachments.length > 0, 'mail-list-unread': email.unread, 'mail-list-replied': email.answered}" ng-click="select(email)" ng-repeat="email in emails">
<h3>{{email.from[0].name || email.from[0].address}}</h3> <h3>{{email.from[0].name || email.from[0].address}}</h3>
<div class="head"> <div class="head">
@ -12,7 +13,8 @@
</div> </div>
<p class="body">{{email.body}}</p> <p class="body">{{email.body}}</p>
</li> </li>
</ul><!--/.mail-list--> </ul><!--/.mail-list-->
</div>
<footer ng-click="synchronize()"> <footer ng-click="synchronize()">
{{lastUpdateLbl}} {{lastUpdate | date:'shortTime'}} {{lastUpdateLbl}} {{lastUpdate | date:'shortTime'}}