open terms of use as a modal

This commit is contained in:
Javier 2016-09-08 14:54:18 -03:00
commit ff44eb3879
3 changed files with 25 additions and 18 deletions

View file

@ -1,21 +1,21 @@
<ion-view id="terms-of-use"> <ion-modal-view id="terms-of-use">
<ion-nav-bar class="bar-ligt"> <ion-nav-bar class="bar-ligt">
<ion-nav-title>{{'Terms of Use' | translate}}</ion-nav-title> <ion-nav-title>{{'Terms of Use' | translate}}</ion-nav-title>
<ion-nav-buttons side="primary"> <ion-nav-buttons side="primary">
<button class="button no-border" href ui-sref="onboarding.disclaimer"> <button class="button no-border" ng-click="termsModal.hide()">
<i class="icon ion-arrow-left-c"></i> {{'Close' | translate}}
</button> </button>
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="termsController" ng-init="accept = false;"> <ion-content class="has-header">
<div ng-include="'views/includes/terms.html'"></div> <div ng-include="'views/includes/terms.html'"></div>
<div class="padding-vertical" ng-show="lang != 'en'"> <div class="padding-vertical" ng-show="lang != 'en'">
<a ng-click="openExternalLink(disclaimerUrl)" translate>Official English Disclaimer</a> <a ng-click="openExternalLink(disclaimerUrl)" translate>Official English Disclaimer</a>
</div> </div>
<div id="agree-to-terms"> <div id="agree-to-terms">
<ion-checkbox ng-model="accept"></ion-checkbox> <ion-checkbox ng-model="terms.accept3"></ion-checkbox>
<p translate>I have read, understood, and agree with the <a ui-sref="onboarding.terms">Terms of use</a>.</p> <p translate>I have read, understood, and agree with the <a ui-sref="onboarding.terms">Terms of use</a>.</p>
<button ng-disabled="!accept" class="button button-block button-positive" ng-click="confirm()" translate>Confirm & Finish</button> <button ng-disabled="!terms.accept3" class="button button-block button-positive" ng-click="termsModal.hide(); confirm()" translate>Confirm & Finish</button>
</div> </div>
</ion-content> </ion-content>
</ion-view> </ion-modal-view>

View file

@ -1,5 +1,5 @@
<ion-view id="onboarding-disclaimer" class="onboarding"> <ion-view id="onboarding-disclaimer" class="onboarding">
<ion-content ng-controller="disclaimerController" ng-init="accept1 = accept2 = accept3 = false"> <ion-content ng-controller="disclaimerController" ng-init=init()>
<div class="row text-center"> <div class="row text-center">
<h3 translate class="col-75 col">Almost done! Let's review</h3> <h3 translate class="col-75 col">Almost done! Let's review</h3>
</div> </div>
@ -12,9 +12,10 @@
<ion-checkbox ng-model="accept1"><span translate>I understand my funds are held securely on this device, not by a company.</span></ion-checkbox> <ion-checkbox ng-model="accept1"><span translate>I understand my funds are held securely on this device, not by a company.</span></ion-checkbox>
<ion-checkbox ng-model="accept2"><span translate>I understand if this wallet is lost or deleted, my bitcoin can only be recovered with the backup phrase.</span></ion-checkbox> <ion-checkbox ng-model="accept2"><span translate>I understand if this wallet is lost or deleted, my bitcoin can only be recovered with the backup phrase.</span></ion-checkbox>
</ion-list> </ion-list>
<div id="agree-to-terms" ng-if="accept1&&accept2"> <div id="agree-to-terms" ng-if="accept1 && accept2">
<ion-checkbox ng-model="accept3"></ion-checkbox><p translate>I have read, understood, and agree with the <a ui-sref="onboarding.terms" translate>Terms of use</a>.</p> <ion-checkbox ng-model="terms.accept3"></ion-checkbox>
<button ng-disabled="!accept1 || !accept2 || !accept3" class="button button-block button-positive" ng-click="confirm()" translate>Confirm & Finish</button> <p translate>I have read, understood, and agree with the <a ng-click="openTermsModal()" translate>Terms of use</a>.</p>
<button ng-disabled="!accept1 || !accept2 || !terms.accept3" class="button button-block button-positive" ng-click="confirm()" translate>Confirm & Finish</button>
</div> </div>
</ion-content> </ion-content>
</ion-view> </ion-view>

View file

@ -1,6 +1,14 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('disclaimerController', function($scope, $state, $log, $ionicModal, profileService) { angular.module('copayApp.controllers').controller('disclaimerController', function($scope, $timeout, $state, $log, $ionicModal, profileService) {
$scope.init = function() {
$scope.terms = {};
$scope.accept1 = $scope.accept2 = $scope.accept3 = false;
$timeout(function() {
$scope.$apply();
}, 1);
};
$scope.confirm = function() { $scope.confirm = function() {
profileService.setDisclaimerAccepted(function(err) { profileService.setDisclaimerAccepted(function(err) {
@ -11,14 +19,12 @@ angular.module('copayApp.controllers').controller('disclaimerController', functi
}); });
}; };
this.openModal = function() { $scope.openTermsModal = function() {
$ionicModal.fromTemplateUrl('views/modals/terms.html', {
$ionicModal.fromTemplateUrl('views/modals/addressbook.html', {
scope: $scope scope: $scope
}).then(function(modal) { }).then(function(modal) {
$scope.addressbookModal = modal; $scope.termsModal = modal;
$scope.addressbookModal.show(); $scope.termsModal.show();
}); });
}; };
}); });