Skip to content

Commit

Permalink
Add the sensor explanation as a page after the consent
Browse files Browse the repository at this point in the history
To clarify which button people should press, specific to the version.
This fixes e-mission/e-mission-docs#483
  • Loading branch information
shankari committed Apr 19, 2020
1 parent 40dbe85 commit 4bcd9ed
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
17 changes: 10 additions & 7 deletions www/js/intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,28 @@ angular.module('emission.intro', ['emission.splash.startprefs',
}
}
console.log("Explanation = "+$scope.locationPermExplanation);

$scope.getConsentFile = function () {

// The language comes in between the first and second part
$scope.geti18nFile = function (fpFirstPart, fpSecondPart) {
var lang = $translate.use();
$scope.consentFile = "templates/intro/sensor_explanation.html";
var defaultVal = fpFirstPart + fpSecondPart;
if (lang != 'en') {
var url = "www/i18n/intro/consent-" + lang + ".html";
var url = fpFirstPart + lang + fpSecondPart;
$cordovaFile.checkFile(cordova.file.applicationDirectory, url).then( function(result){
window.Logger.log(window.Logger.LEVEL_DEBUG,
"Successfully found the consent file, result is " + JSON.stringify(result));
$scope.consentFile = url.replace("www/", "");
return url.replace("www/", "");
}, function (err) {
window.Logger.log(window.Logger.LEVEL_DEBUG,
"Consent file not found, loading english version, error is " + JSON.stringify(err));
$scope.consentFile = "templates/intro/sensor_explanation.html";
return defaultVal;
});
}
return defaultVal;
}

$scope.getConsentFile();
$scope.consentFile = $scope.geti18nFile("templates/intro/consent", ".html");
$scope.explainFile = $scope.geti18nFile("templates/intro/sensor_explanation", ".html");

$scope.getIntroBox = function() {
return $ionicSlideBoxDelegate.$getByHandle('intro-box');
Expand Down
2 changes: 1 addition & 1 deletion www/templates/intro/consent.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ <h3>Questions</h3>
<button class="button button-block button-assertive button-outline" ng-click="disagree()" id="consent-button"><span translate>{{'.button-decline'}}</span></button>
</div>
<div class="col" style="margin-left: 5px">
<button class="button button-block button-positive button-outline" ng-click="agree()" id="consent-button"><span translate>{{'.button-accept'}}</span></button>
<button class="button button-block button-positive button-outline" ng-click="next()" id="consent-button"><span translate>{{'.button-accept'}}</span></button>
</div>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions www/templates/intro/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<ion-slide>
<ng-include src="consentFile"></ng-include>
</ion-slide>
<ion-slide>
<ng-include src="explainFile"></ng-include>
</ion-slide>
<ion-slide>
<ng-include src="'templates/intro/login.html'"></ng-include>
</ion-slide>
Expand Down

0 comments on commit 4bcd9ed

Please sign in to comment.