Commit ca14ec8a authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

fixed display of H5P in test module and accessibility of vocabulary mode after restoring last setup

parent c80d23c1
# Installation instructions (Docker):
1. Install Docker (https://docs.docker.com/v17.12/install/) and Docker-Compose (https://docs.docker.com/compose/install/)
2. Clone the repo:
`git clone https://scm.cms.hu-berlin.de/callidus/mc_frontend.git`
......@@ -8,24 +7,21 @@
4. Run `docker-compose build`.
Make sure to assign at least 4GB RAM (Memory) to the Docker container, otherwise the build will fail.
5. Run `docker-compose up -d` and enjoy!
----------------------------------------------------------------
##### Build
If you don't want to use Docker for building, you need to run `npm install` first.
To build the application for production environments, use: `ionic cordova build browser --prod --release --max-old-space-size=4096` and serve the content of the `www/` folder, e.g. with Nginx.
----------------------------------------------------------------
##### Extending the application
##### Development
To add new pages to the application, use: `ionic generate page PAGE_NAME`.
To spin up a local web server, run: `ng serve`
----------------------------------------------------------------
##### Access to the Docker container
Use `docker-compose down` to stop and remove the currently running containers.
To access a running container directly, get the container ID via `docker ps` and connect via `docker exec -it CONTAINER_ID bash`. Or, for root access, use: `docker exec -u 0 -it CONTAINER_ID bash`
To snapshot a running container, use `docker commit CONTAINER_ID`. It returns a snapshot ID, which you can access via `docker run -it SNAPSHOT_ID`.
----------------------------------------------------------------
## Configuration
### Backend URL
To change the URL for the backend, use the `ionic.config.json` file (proxies > proxyUrl). By default, the system assumes that backend and frontend are installed on the same machine.
......
{
"name": "mc_frontend",
"version": "0.7.8",
"version": "0.7.9",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
......
......@@ -8,9 +8,6 @@
<button (click)="HelperService.goToHomePage(navCtrl)">
<ion-icon name="home"></ion-icon>
</button>
<button (click)="HelperService.goToFeedbackPage(navCtrl)">
<ion-icon name="help-circle"></ion-icon>
</button>
</div>
</ion-toolbar>
......
......@@ -8,9 +8,6 @@
<button (click)="HelperService.goToHomePage(navCtrl)">
<ion-icon name="home"></ion-icon>
</button>
<button (click)="HelperService.goToFeedbackPage(navCtrl)">
<ion-icon name="help-circle"></ion-icon>
</button>
</div>
</ion-toolbar>
</ion-header>
......
......@@ -57,10 +57,11 @@ export class AuthorPage {
restoreLastSetup() {
this.corpusService.restoreLastCorpus().then(() => {
this.corpusService.isTextRangeCorrect = true;
if (HelperService.isVocabularyCheck) {
this.navCtrl.navigateForward('/vocabulary-check').then();
HelperService.goToVocabularyCheckPage(this.navCtrl);
} else {
this.navCtrl.navigateForward('show-text').then();
HelperService.goToShowTextPage(this.navCtrl);
}
}, () => {
});
......
......@@ -283,7 +283,6 @@ export class CorpusService {
}
this.currentCorpus = HelperService.mostRecentSetup.currentCorpus;
this.currentTextRange = HelperService.mostRecentSetup.currentTextRange;
this.isTextRangeCorrect = true;
this.currentUrn = HelperService.mostRecentSetup.currentUrn;
this.getText().then(() => {
return resolve();
......
......@@ -15,9 +15,6 @@
<button (click)="HelperService.goToHomePage(navCtrl)">
<ion-icon name="home"></ion-icon>
</button>
<button (click)="HelperService.goToFeedbackPage(navCtrl)">
<ion-icon name="help-circle"></ion-icon>
</button>
</div>
</ion-toolbar>
</ion-header>
......
......@@ -10,6 +10,7 @@ import {CaseValue, DependencyValue, PartOfSpeechValue} from "src/app/models/enum
})
export class HelperService {
public static baseUrl: string = location.protocol.concat('//').concat(window.location.host) + window.location.pathname.split("/").slice(0, -1).join("/");
public static caseMap: { [rawValue: string]: CaseValue } = {
'Nom': CaseValue.nominative,
'Gen': CaseValue.genitive,
......@@ -101,10 +102,6 @@ export class HelperService {
navCtrl.navigateForward('/author').then();
}
static goToFeedbackPage(navCtrl: NavController) {
navCtrl.navigateForward('/feedback').then();
}
static goToHomePage(navCtrl: NavController) {
navCtrl.navigateRoot('/home').then();
}
......@@ -117,6 +114,10 @@ export class HelperService {
navCtrl.navigateForward('/info').then();
}
static goToShowTextPage(navCtrl: NavController) {
navCtrl.navigateForward('/show-text').then();
}
static goToSourcesPage(navCtrl: NavController) {
navCtrl.navigateForward('/sources').then();
}
......@@ -126,8 +127,10 @@ export class HelperService {
}
static goToVocabularyCheckPage(navCtrl: NavController) {
HelperService.isVocabularyCheck = true;
navCtrl.navigateForward('/vocabulary-check').then();
navCtrl.navigateForward('/vocabulary-check').then(() => {
HelperService.isVocabularyCheck = true;
}, () => {
});
}
initConfig() {
......
......@@ -8,9 +8,6 @@
<button (click)="HelperService.goToHomePage(navCtrl)">
<ion-icon name="home"></ion-icon>
</button>
<button (click)="HelperService.goToFeedbackPage(navCtrl)">
<ion-icon name="help-circle"></ion-icon>
</button>
</div>
</ion-toolbar>
</ion-header>
......
......@@ -9,9 +9,6 @@
<button (click)="HelperService.goToHomePage(navCtrl)">
<ion-icon name="home"></ion-icon>
</button>
<button (click)="HelperService.goToFeedbackPage(navCtrl)">
<ion-icon name="help-circle"></ion-icon>
</button>
</div>
</ion-toolbar>
</ion-header>
......
......@@ -9,9 +9,6 @@
<button (click)="HelperService.goToHomePage(navCtrl)">
<ion-icon name="home"></ion-icon>
</button>
<button (click)="HelperService.goToFeedbackPage(navCtrl)">
<ion-icon name="help-circle"></ion-icon>
</button>
</div>
</ion-toolbar>
</ion-header>
......
......@@ -33,7 +33,7 @@ export class RankingPage {
this.vocService.getVocabularyCheck(this.corpusService.currentUrn, true).subscribe((ar: AnnisResponse) => {
HelperService.isLoading = false;
this.corpusService.processAnnisResponse(ar);
this.navCtrl.navigateForward('show-text').then();
HelperService.goToShowTextPage(this.navCtrl);
}, async (error: HttpErrorResponse) => {
HelperService.isLoading = false;
HelperService.currentError = error;
......
......@@ -11,9 +11,6 @@
<button (click)="HelperService.goToHomePage(navCtrl)">
<ion-icon name="home"></ion-icon>
</button>
<button (click)="HelperService.goToFeedbackPage(navCtrl)">
<ion-icon name="help-circle"></ion-icon>
</button>
</div>
</ion-toolbar>
</ion-header>
......
......@@ -27,8 +27,4 @@ export class ShowTextPage {
goToExerciseParametersPage() {
this.navCtrl.navigateForward('exercise-parameters').then();
}
goToVocabularyCheckPage(){
this.navCtrl.navigateForward('vocabulary-check').then();
}
}
......@@ -75,7 +75,6 @@ export class TestPage implements OnDestroy, OnInit {
"voc_list_71", "voc_list_72", "voc_list_73", "voc_list_74", "voc_list_75", "voc_list_76",
"voc_list_77", "voc_list_78", "voc_list_79", "voc_list_80", "voc_list_81", "voc_list_82",
"voc_list_83", "voc_list_84", "voc_list_85", "voc_list_86"]
// voc_list_14 = voc_list_7 (et) --> 14 deleted
}), new ExercisePart({
startIndex: 0, durationSeconds: 300, exercises: ["fill_blanks_1", "multi_choice_1", "multi_choice_2",
"multi_choice_3", "multi_choice_4", "multi_choice_5", "multi_choice_6",
......@@ -188,7 +187,6 @@ export class TestPage implements OnDestroy, OnInit {
setTimeout(() => {
(($) => {
$(() => {
// $('.h5p-container').empty();
$('.h5p-container').empty().h5p({
frameJs: 'assets/dist/js/h5p-standalone-frame.min.js',
frameCss: 'assets/dist/styles/h5p.css',
......@@ -375,8 +373,7 @@ export class TestPage implements OnDestroy, OnInit {
document.querySelector(this.h5pRowIDstring).classList.remove(this.hideClassString);
let fileName: string = currentExerciseName.split("_").slice(-1) + "_" + this.translate.currentLang + ".json";
let exerciseType = currentExerciseName.split("_").slice(0, 2).join("_");
const baseUrl: string = location.protocol.concat('//').concat(window.location.host);
window.localStorage.setItem(HelperService.config['localStorageKeyH5P'], baseUrl + "/assets/h5p/" + exerciseType + "/content/" + fileName);
window.localStorage.setItem(HelperService.config['localStorageKeyH5P'], HelperService.baseUrl + "/assets/h5p/" + exerciseType + "/content/" + fileName);
if (exerciseType.startsWith(this.vocListString)) {
exerciseType = this.fillBlanksString;
}
......
......@@ -9,9 +9,6 @@
<button (click)="HelperService.goToHomePage(navCtrl)">
<ion-icon name="home"></ion-icon>
</button>
<button (click)="HelperService.goToFeedbackPage(navCtrl)">
<ion-icon name="help-circle"></ion-icon>
</button>
</div>
</ion-toolbar>
</ion-header>
......
......@@ -379,9 +379,9 @@ export class TextRangePage {
this.corpusService.isTextRangeCorrect = true;
this.corpusService.getText().then(() => {
if (HelperService.isVocabularyCheck) {
this.navCtrl.navigateForward('/vocabulary-check').then();
HelperService.goToVocabularyCheckPage(this.navCtrl);
} else {
this.navCtrl.navigateForward('show-text').then();
HelperService.goToShowTextPage(this.navCtrl);
}
}, () => {
});
......
......@@ -9,9 +9,6 @@
<button (click)="HelperService.goToHomePage(navCtrl)">
<ion-icon name="home"></ion-icon>
</button>
<button (click)="HelperService.goToFeedbackPage(navCtrl)">
<ion-icon name="help-circle"></ion-icon>
</button>
</div>
</ion-toolbar>
</ion-header>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment