replace href to ng-click in sidebars. add hack to close sidebars

This commit is contained in:
Matias Alejo Garcia 2014-12-07 12:40:59 -03:00
parent a115a6d17a
commit eeab451bbc
9 changed files with 38 additions and 32 deletions

View File

@ -43,7 +43,7 @@
<p class="text-gray size-18">Your session is about to expire due to inactivity in {{countdown}} seconds</p>
</div>
<div class="off-canvas-wrap" ng-show="!signingOut">
<div class="off-canvas-wrap" id="off-canvas-wrap" ng-show="!signingOut">
<div class="inner-wrap">
<span class="status" ng-if="$root.reconnecting">
<i class="fi-loop icon-rotate"></i>
@ -73,13 +73,13 @@
</section>
</nav>
<aside class="left-off-canvas-menu" ng-show="$root.iden">
<nav class="left-off-canvas-menu" ng-show="$root.iden">
<div ng-include="'views/includes/sidebar-mobile.html'"></div>
</aside>
</nav>
<aside class="right-off-canvas-menu" ng-show="$root.iden && $root.iden.listWallets().length >1">
<nav class="right-off-canvas-menu" ng-show="$root.iden && $root.iden.listWallets().length >1">
<div ng-include="'views/includes/walletbar-mobile.html'"></div>
</aside>
</nav>
<div
ng-if="$root.iden"
ng-include="'views/includes/sidebar.html'"

View File

@ -1,10 +1,11 @@
'use strict';
angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $location, $timeout, notification, identityService, Compatibility, pinService, applicationService, isMobile) {
angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $timeout, go, notification, identityService, Compatibility, pinService, applicationService, isMobile) {
// Global functions (TODO should be somewhere else)
// Global go. This should be in a better place TODO
// We dont do a 'go' directive, to use the benefits of ng-touch with ng-click
$rootScope.go = function (path) {
$location.path(path);
go.go(path);
};
var _credentials, _firstpin;
@ -66,13 +67,14 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
$scope.error = 'Please enter the required fields';
return;
}
$rootScope.starting = true;
var credentials = pinService.get(pin, function(err, credentials) {
if (err || !credentials) {
$rootScope.starting = false;
$scope.error = 'Wrong PIN';
return;
}
$rootScope.starting = true;
$scope.open(credentials.email, credentials.password);
});
};

View File

@ -1,13 +1,21 @@
'use strict';
angular.element(document).ready(function() {
var startAngular = function () {
var startAngular = function() {
angular.bootstrap(document, ['copayApp']);
};
/* Cordova specific Init */
if (window.cordova !== undefined) {
document.addEventListener('deviceready', function() {
setTimeout(function(){ navigator.splashscreen.hide(); }, 2000);
document.addEventListener('pause', function() {
window.location = '#!';
});
setTimeout(function() {
navigator.splashscreen.hide();
}, 2000);
function handleBitcoinURI(url) {
if (!url) return;
@ -20,10 +28,6 @@ angular.element(document).ready(function() {
startAngular();
}, false);
document.addEventListener('pause', function() {
window.location = '#!';
});
} else {
startAngular();
}

View File

@ -114,15 +114,16 @@ angular
$keepaliveProvider.interval(30); // in seconds
})
.run(function($rootScope, $location, $idle, gettextCatalog, uriHandler) {
gettextCatalog.currentLanguage = config.defaultLanguage;
// not for mobileApp
// Register URI handler, not for mobileApp
if (!window.cordova) {
$idle.watch();
uriHandler.register();
}
$rootScope.$on('$routeChangeStart', function(event, next, current) {
if (!ls || ls.length < 1) {
$location.path('unsupported');
} else {

View File

@ -1,14 +1,13 @@
'use strict';
angular.module('copayApp.services')
.factory('applicationService', function($rootScope, $location, $timeout) {
.factory('applicationService', function($rootScope, $location, $timeout, go) {
var root = {};
var isChromeApp = window.chrome && chrome.runtime && chrome.runtime.id;
root.restart = function() {
if (1 || window.cordova !== undefined) {
$rootScope.iden = $rootScope.wallet = undefined;
// NOP. no need to restart on cordova apps.
$location.path('/');
go.go('/');
$timeout(function(){
$rootScope.$digest();
},1);

View File

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services')
.factory('identityService', function($rootScope, $location, $timeout, $filter, pluginManager, notification, pendingTxsService, balanceService, applicationService) {
.factory('identityService', function($rootScope, $location, $timeout, $filter, pluginManager, notification, pendingTxsService, balanceService, applicationService, go) {
notification.enableHtml5Mode(); // for chrome: if support, enable it
// TODO:
@ -334,7 +334,7 @@ angular.module('copayApp.services')
noWallets: true
}, function() {
$rootScope.signingOut = false;
$rootScope.iden.close();
$rootScope.iden.close(); // Will trigger 'closed'
});
}
};

View File

@ -5,7 +5,7 @@ angular.module('copayApp.services')
var KEY = 'pinDATA';
var SALT = '4gllotIKguqi0EkIslC0';
var ITER = 2000;
var ITER = 5000;
var ls = localstorageService;
var root = {};

View File

@ -1,7 +1,7 @@
<div>
<ul class="off-canvas-list">
<li>
<a href="#!/profile" class="db p20h nav-item text-center" title="Create new wallet">
<a ng-click="$root.go('profile')" class="db p20h nav-item text-center" title="Create new wallet">
<div class="photo-container m20t">
<img gravatar-src="'{{$root.iden.getName()}}'" gravatar-size="35">
</div>
@ -14,23 +14,23 @@
</li>
<li>
<a href="#!/create" class="db p20h nav-item" title="Create new wallet">
<a ng-click="$root.go('create')" class="db p20h nav-item" title="Create new wallet">
<i class="size-24 m20r fi-plus"></i> {{'Create new wallet' | translate }}</a>
</li>
<li>
<a href="#!/join" class="db p20h nav-item" title="Join shared wallet">
<a ng-click="$root.go('join')" class="db p20h nav-item" title="Join shared wallet">
<i class="size-24 m20r fi-torsos-all"></i> {{'Join shared wallet' | translate }}</a>
</li>
<li>
<a href="#!/import" class="db p20h nav-item" title="Import wallet">
<a ng-click="$root.go('import')" class="db p20h nav-item" title="Import wallet">
<i class="size-24 m20r fi-download"></i> {{'Import a wallet' | translate }}</a>
</li>
<li ng-if="$root.wallet">
<a href="#!/more" class="db p20h nav-item" title="Settings">
<a ng-click="$root.go('more')" class="db p20h nav-item" title="Settings">
<i class="size-24 m20r fi-widget"></i> {{'Wallet Settings' | translate }}</a>
</li>
<li>
<a href="#!/" class="db p20h nav-item" title="Close" ng-click="signout()">
<a class="db p20h nav-item" title="Close" ng-click="signout()">
<span ng-if="!$root.hasPin"><i class="size-24 m20r fi-power"></i> {{'Close'|translate}}</span>
<span ng-if="$root.hasPin"><i class="size-24 m20r fi-lock"></i> {{'Lock'|translate}}</span>
</a>

View File

@ -11,7 +11,7 @@
<div class="avatar-wallet">{{(item.name || item.id) | limitTo: 1}}</div>
</div>
<div class="col2">
<a href="#!/homeWallet#{{item.id}}" class="size-12 wallet-item">
<a ng-click="$root.go('/homeWallet#{{item.id}}')" class="size-12 wallet-item">
<div class="oh">
<div class="right size-10 type-wallet">
[ {{item.requiredCopayers}} of {{item.totalCopayers}} ]</div>