From d55e756e6a4ee45942413e731b66e918c8cb1a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 22 May 2017 21:28:41 -0300 Subject: [PATCH] create view and controller refactor --- src/js/controllers/create.js | 8 ++++---- src/js/controllers/join.js | 2 +- src/js/routes.js | 6 ++++-- www/views/join.html | 16 ++++++++-------- www/views/tab-create-personal.html | 17 +++++++++-------- www/views/tab-create-shared.html | 14 +++++++------- 6 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index b7e0255c9..f47e1ba9a 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -19,18 +19,18 @@ angular.module('copayApp.controllers').controller('createController', 12: 1, }; - $scope.init = function(tc) { + $scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.formData = {}; var defaults = configService.getDefaults(); + var tc = $state.current.name == 'tabs.add.create-personal' ? 1 : defaults.wallet.totalCopayers; $scope.formData.account = 1; $scope.formData.bwsurl = defaults.bws.url; $scope.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1); - $scope.formData.totalCopayers = defaults.wallet.totalCopayers; $scope.formData.derivationPath = derivationPathHelper.default; $scope.setTotalCopayers(tc); updateRCSelect(tc); resetPasswordFields(); - }; + }); $scope.showAdvChange = function() { $scope.showAdv = !$scope.showAdv; @@ -60,7 +60,7 @@ angular.module('copayApp.controllers').controller('createController', }; function resetPasswordFields() { - $scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatpassword = $scope.result = null; + $scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatPassword = $scope.result = null; $timeout(function() { $scope.$apply(); }); diff --git a/src/js/controllers/join.js b/src/js/controllers/join.js index 6e6456d98..105b7767c 100644 --- a/src/js/controllers/join.js +++ b/src/js/controllers/join.js @@ -43,7 +43,7 @@ angular.module('copayApp.controllers').controller('joinController', }; function resetPasswordFields() { - $scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatpassword = $scope.result = null; + $scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatPassword = $scope.result = null; $timeout(function() { $scope.$apply(); }); diff --git a/src/js/routes.js b/src/js/routes.js index 81626d5b6..52a9ade41 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -341,7 +341,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr url: '/create-personal', views: { 'tab-home@tabs': { - templateUrl: 'views/tab-create-personal.html' + templateUrl: 'views/tab-create-personal.html', + controller: 'createController' }, } }) @@ -349,7 +350,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr url: '/create-shared', views: { 'tab-home@tabs': { - templateUrl: 'views/tab-create-shared.html' + templateUrl: 'views/tab-create-shared.html', + controller: 'createController' }, } }) diff --git a/www/views/join.html b/www/views/join.html index 4acbeaa14..1bf5ed4c0 100644 --- a/www/views/join.html +++ b/www/views/join.html @@ -6,7 +6,7 @@ - +
@@ -15,7 +15,7 @@