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-title>{{'Terms of Use' | translate}}</ion-nav-title>
<ion-nav-buttons side="primary">
<button class="button no-border" href ui-sref="onboarding.disclaimer">
<i class="icon ion-arrow-left-c"></i>
<button class="button no-border" ng-click="termsModal.hide()">
{{'Close' | translate}}
</button>
</ion-nav-buttons>
</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 class="padding-vertical" ng-show="lang != 'en'">
<a ng-click="openExternalLink(disclaimerUrl)" translate>Official English Disclaimer</a>
</div>
<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>
<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>
</ion-content>
</ion-view>
</ion-modal-view>

View file

@ -1,5 +1,5 @@
<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">
<h3 translate class="col-75 col">Almost done! Let's review</h3>
</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="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>
<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>
<button ng-disabled="!accept1 || !accept2 || !accept3" class="button button-block button-positive" ng-click="confirm()" translate>Confirm & Finish</button>
<div id="agree-to-terms" ng-if="accept1 && accept2">
<ion-checkbox ng-model="terms.accept3"></ion-checkbox>
<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>
</ion-content>
</ion-view>

View file

@ -1,6 +1,14 @@
'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() {
profileService.setDisclaimerAccepted(function(err) {
@ -11,14 +19,12 @@ angular.module('copayApp.controllers').controller('disclaimerController', functi
});
};
this.openModal = function() {
$ionicModal.fromTemplateUrl('views/modals/addressbook.html', {
$scope.openTermsModal = function() {
$ionicModal.fromTemplateUrl('views/modals/terms.html', {
scope: $scope
}).then(function(modal) {
$scope.addressbookModal = modal;
$scope.addressbookModal.show();
$scope.termsModal = modal;
$scope.termsModal.show();
});
};
});