From 273901d2d69504575440732dbc3fe774863b81a2 Mon Sep 17 00:00:00 2001 From: Javier Date: Tue, 17 Nov 2015 15:42:06 -0300 Subject: [PATCH] WIP functionality on words --- public/views/backup.html | 36 +++++++++++++++++++++++------------- src/js/controllers/backup.js | 32 +++++++++++++++++++++++++++++++- src/js/routes.js | 11 +++++++++++ 3 files changed, 65 insertions(+), 14 deletions(-) diff --git a/public/views/backup.html b/public/views/backup.html index 25a2c3ce5..ed223c1a0 100644 --- a/public/views/backup.html +++ b/public/views/backup.html @@ -61,7 +61,7 @@
-
+ -
+ +
Your Wallet Seed
-
+ +
{{word}}  @@ -88,18 +90,20 @@
-
-
- - - - WARNING: This seed was created with a passphrase. To recover this wallet both the mnemonic and passphrase are needed. - + +
+
+ + + + WARNING: This seed was created with a passphrase. To recover this wallet both the mnemonic and passphrase are needed. -
+ +
-
+ + + +
+
diff --git a/src/js/controllers/backup.js b/src/js/controllers/backup.js index 8b46b20c1..5bf5bfc4a 100644 --- a/src/js/controllers/backup.js +++ b/src/js/controllers/backup.js @@ -1,12 +1,15 @@ 'use strict'; angular.module('copayApp.controllers').controller('wordsController', - function($rootScope, $scope, $timeout, profileService, go, gettext, confirmDialog, notification, bwsError, $log) { + function($rootScope, $scope, $timeout, $log, $compile, lodash, profileService, go, gettext, confirmDialog, notification, bwsError) { var msg = gettext('Are you sure you want to delete the backup words?'); var successMsg = gettext('Backup words deleted'); var self = this; self.show = false; + self.sorted = false; + $scope.seed = ''; + var customSortWords = []; var fc = profileService.focusedClient; if (fc.isPrivKeyEncrypted()) self.credentialsEncrypted = true; @@ -84,4 +87,31 @@ angular.module('copayApp.controllers').controller('wordsController', } } } + + self.disableButton = function(word) { + document.getElementById(word).disabled = true; + $scope.seed += word + ' '; + customSortWords.push(word); + + if (customSortWords.length == 12) + self.shouldContinue(customSortWords); + + self.addButton(word); + } + + self.addButton = function(word) { + var btnhtml = ''; + var temp = $compile(btnhtml)($scope); + angular.element(document.getElementById('addWord')).append(temp); + } + + self.removeButton = function(word) { + + } + + self.shouldContinue = function(customSortWords) { + if (lodash.isEqual(self.mnemonicWords, customSortWords)) + self.sorted = true; + } }); diff --git a/src/js/routes.js b/src/js/routes.js index 90d408c3d..e0260bf17 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -434,6 +434,17 @@ angular }, } }) + .state('backupWords', { + url: '/backupWords', + templateUrl: 'views/backupWords.html', + walletShouldBeComplete: true, + needProfile: true, + views: { + 'main': { + templateUrl: 'views/backupWords.html' + }, + } + }) .state('preferencesGlobal', { url: '/preferencesGlobal', needProfile: true,