Commit 55c7bcaf authored by beyeranq's avatar beyeranq
Browse files

nav

parents 423b65aa 1ef9234b
{ {
"name": "mc_frontend", "name": "mc_frontend",
"version": "1.3.8", "version": "1.3.9",
"author": "Ionic Framework", "author": "Ionic Framework",
"homepage": "https://ionicframework.com/", "homepage": "https://ionicframework.com/",
"scripts": { "scripts": {
......
<ion-app> <ion-app>
<ion-router-outlet></ion-router-outlet> <ion-menu contentId="content1" side="start" menuId="{{HelperService.menuId}}">
<ion-header>
<ion-toolbar>
<ion-title>{{ 'MACHINA_CALLIDA' | translate }}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-button
(click)="HelperService.goToAuthorPage(navCtrl).then(closeMenu.bind(this))">{{ 'EXERCISE_GENERATE' | translate }}</ion-button>
</ion-content>
</ion-menu>
<ion-router-outlet id="content1"></ion-router-outlet>
</ion-app> </ion-app>
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {StatusBar} from '@ionic-native/status-bar/ngx'; import {StatusBar} from '@ionic-native/status-bar/ngx';
import {Config, Platform} from '@ionic/angular'; import {Config, MenuController, NavController, Platform} from '@ionic/angular';
import {SplashScreen} from '@ionic-native/splash-screen/ngx'; import {SplashScreen} from '@ionic-native/splash-screen/ngx';
import {TranslateService} from '@ngx-translate/core'; import {TranslateService} from '@ngx-translate/core';
import {HelperService} from 'src/app/helper.service'; import {HelperService} from 'src/app/helper.service';
...@@ -10,13 +10,16 @@ import {HelperService} from 'src/app/helper.service'; ...@@ -10,13 +10,16 @@ import {HelperService} from 'src/app/helper.service';
templateUrl: 'app.component.html' templateUrl: 'app.component.html'
}) })
export class AppComponent { export class AppComponent {
public HelperService = HelperService;
constructor(platform: Platform, constructor(platform: Platform,
public statusBar: StatusBar, public statusBar: StatusBar,
private translate: TranslateService, private translate: TranslateService,
private config: Config, private config: Config,
private splashScreen: SplashScreen, private splashScreen: SplashScreen,
public helperService: HelperService public helperService: HelperService,
public navCtrl: NavController,
public menuCtrl: MenuController
) { ) {
platform.ready().then(() => { platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available. // Okay, so the platform is ready and our plugins are available.
...@@ -27,6 +30,10 @@ export class AppComponent { ...@@ -27,6 +30,10 @@ export class AppComponent {
this.initTranslate(); this.initTranslate();
} }
closeMenu(result: boolean) {
this.menuCtrl.close(HelperService.menuId).then();
}
initTranslate() { initTranslate() {
// Set the default language for translation strings, and the current language. // Set the default language for translation strings, and the current language.
this.translate.setDefaultLang('en'); this.translate.setDefaultLang('en');
...@@ -43,5 +50,4 @@ export class AppComponent { ...@@ -43,5 +50,4 @@ export class AppComponent {
// this.config.set('backButtonText', values.BACK_BUTTON_TEXT); // 'ios', // this.config.set('backButtonText', values.BACK_BUTTON_TEXT); // 'ios',
// }); // });
} }
} }
...@@ -24,6 +24,6 @@ export class AuthorDetailPage { ...@@ -24,6 +24,6 @@ export class AuthorDetailPage {
showPossibleReferences(corpus: CorpusMC) { showPossibleReferences(corpus: CorpusMC) {
this.corpusService.currentCorpus = corpus; this.corpusService.currentCorpus = corpus;
this.corpusService.currentTextRange = new TextRange({start: ['', '', ''], end: ['', '', '']}); this.corpusService.currentTextRange = new TextRange({start: ['', '', ''], end: ['', '', '']});
HelperService.goToTextRangePage(this.navCtrl); HelperService.goToTextRangePage(this.navCtrl).then();
} }
} }
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<br> <br>
</ion-col> </ion-col>
</ion-row> </ion-row>
<ion-row *ngIf="HelperService.mostRecentSetup.currentCorpus && HelperService.mostRecentSetup.currentUrn"> <ion-row *ngIf="HelperService.mostRecentSetup?.currentCorpus && HelperService.mostRecentSetup?.currentUrn">
<ion-col> <ion-col>
<a (click)="restoreLastSetup()">{{ [HelperService.mostRecentSetup.currentCorpus.author, <a (click)="restoreLastSetup()">{{ [HelperService.mostRecentSetup.currentCorpus.author,
HelperService.mostRecentSetup.currentCorpus.title, HelperService.mostRecentSetup.currentCorpus.title,
......
...@@ -60,9 +60,9 @@ export class AuthorPage { ...@@ -60,9 +60,9 @@ export class AuthorPage {
restoreLastSetup() { restoreLastSetup() {
this.corpusService.restoreLastCorpus().then(() => { this.corpusService.restoreLastCorpus().then(() => {
if (HelperService.isVocabularyCheck) { if (HelperService.isVocabularyCheck) {
HelperService.goToVocabularyCheckPage(this.navCtrl); HelperService.goToVocabularyCheckPage(this.navCtrl).then();
} else { } else {
HelperService.goToShowTextPage(this.navCtrl); HelperService.goToShowTextPage(this.navCtrl).then();
} }
}, () => { }, () => {
}); });
......
...@@ -16,12 +16,12 @@ export class ConfirmCancelPage implements OnInit { ...@@ -16,12 +16,12 @@ export class ConfirmCancelPage implements OnInit {
} }
exit() { exit() {
HelperService.currentPopover.dismiss(); HelperService.currentPopover.dismiss().then();
HelperService.currentPopover = null; HelperService.currentPopover = null;
} }
confirm() { confirm() {
HelperService.goToHomePage(this.navCtrl); HelperService.goToHomePage(this.navCtrl).then();
this.exit(); this.exit();
} }
} }
...@@ -120,7 +120,7 @@ export class ExerciseListPage implements OnInit { ...@@ -120,7 +120,7 @@ export class ExerciseListPage implements OnInit {
this.corpusService.annisResponse = ar; this.corpusService.annisResponse = ar;
const met: MoodleExerciseType = MoodleExerciseType[exercise.exercise_type]; const met: MoodleExerciseType = MoodleExerciseType[exercise.exercise_type];
this.corpusService.exercise.type = ExerciseType[met.toString()]; this.corpusService.exercise.type = ExerciseType[met.toString()];
HelperService.goToPreviewPage(this.navCtrl); HelperService.goToPreviewPage(this.navCtrl).then();
}, () => { }, () => {
}); });
} }
......
...@@ -136,7 +136,7 @@ export class ExerciseParametersPage implements OnInit { ...@@ -136,7 +136,7 @@ export class ExerciseParametersPage implements OnInit {
this.corpusService.annisResponse.exercise_id = ar.exercise_id; this.corpusService.annisResponse.exercise_id = ar.exercise_id;
this.corpusService.annisResponse.uri = ar.uri; this.corpusService.annisResponse.uri = ar.uri;
this.corpusService.annisResponse.solutions = ar.solutions; this.corpusService.annisResponse.solutions = ar.solutions;
HelperService.goToPreviewPage(this.navCtrl); HelperService.goToPreviewPage(this.navCtrl).then();
}, async (error: HttpErrorResponse) => { }, async (error: HttpErrorResponse) => {
HelperService.isLoading = false; HelperService.isLoading = false;
HelperService.currentError = error; HelperService.currentError = error;
......
...@@ -80,6 +80,7 @@ export class HelperService { ...@@ -80,6 +80,7 @@ export class HelperService {
name: 'English', name: 'English',
shortcut: 'en' shortcut: 'en'
}), new Language({name: 'Deutsch', shortcut: 'de'})]; }), new Language({name: 'Deutsch', shortcut: 'de'})];
public static menuId = 'menu1';
public static mostRecentSetup: ApplicationState = null; public static mostRecentSetup: ApplicationState = null;
public static partOfSpeechMap: { [rawValue: string]: PartOfSpeechValue } = { public static partOfSpeechMap: { [rawValue: string]: PartOfSpeechValue } = {
ADJ: PartOfSpeechValue.adjective, ADJ: PartOfSpeechValue.adjective,
...@@ -135,55 +136,62 @@ export class HelperService { ...@@ -135,55 +136,62 @@ export class HelperService {
}); });
} }
static goToAuthorPage(navCtrl: NavController) { static goToAuthorPage(navCtrl: NavController): Promise<boolean> {
navCtrl.navigateForward('/author').then(); HelperService.isVocabularyCheck = false;
return navCtrl.navigateForward('/author');
} }
static goToExerciseListPage(navCtrl: NavController) { static goToExerciseListPage(navCtrl: NavController): Promise<boolean> {
navCtrl.navigateForward('/exercise-list').then(); return navCtrl.navigateForward('/exercise-list');
} }
static goToExerciseParametersPage(navCtrl: NavController) { static goToExerciseParametersPage(navCtrl: NavController): Promise<boolean> {
navCtrl.navigateForward('exercise-parameters').then(); return navCtrl.navigateForward('exercise-parameters');
} }
static goToHomePage(navCtrl: NavController) { static goToHomePage(navCtrl: NavController): Promise<boolean> {
navCtrl.navigateRoot('/home').then(); return navCtrl.navigateRoot('/home');
} }
static goToImprintPage(navCtrl: NavController) { static goToImprintPage(navCtrl: NavController): Promise<boolean> {
navCtrl.navigateForward('/imprint').then(); return navCtrl.navigateForward('/imprint');
} }
static goToInfoPage(navCtrl: NavController) { static goToInfoPage(navCtrl: NavController): Promise<boolean> {
navCtrl.navigateForward('/info').then(); return navCtrl.navigateForward('/info');
} }
static goToPreviewPage(navCtrl: NavController) { static goToPreviewPage(navCtrl: NavController): Promise<boolean> {
navCtrl.navigateForward('preview').then(); return navCtrl.navigateForward('preview');
} }
static goToShowTextPage(navCtrl: NavController, isVocabularyCheck: boolean = false) { static goToShowTextPage(navCtrl: NavController, isVocabularyCheck: boolean = false): Promise<boolean> {
navCtrl.navigateForward('/show-text').then(() => { return new Promise<boolean>((resolve) => {
HelperService.isVocabularyCheck = isVocabularyCheck; navCtrl.navigateForward('/show-text').then((result: boolean) => {
HelperService.isVocabularyCheck = isVocabularyCheck;
return resolve(result);
});
}); });
} }
static goToSourcesPage(navCtrl: NavController) { static goToSourcesPage(navCtrl: NavController): Promise<boolean> {
navCtrl.navigateForward('/sources').then(); return navCtrl.navigateForward('/sources');
} }
static goToTestPage(navCtrl: NavController) { static goToTestPage(navCtrl: NavController): Promise<boolean> {
navCtrl.navigateRoot('/test').then(); return navCtrl.navigateRoot('/test');
} }
static goToTextRangePage(navCtrl: NavController) { static goToTextRangePage(navCtrl: NavController): Promise<boolean> {
navCtrl.navigateForward('/text-range').then(); return navCtrl.navigateForward('/text-range');
} }
static goToVocabularyCheckPage(navCtrl: NavController) { static goToVocabularyCheckPage(navCtrl: NavController): Promise<boolean> {
navCtrl.navigateForward('/vocabulary-check').then(() => { return new Promise<boolean>((resolve) => {
HelperService.isVocabularyCheck = true; navCtrl.navigateForward('/vocabulary-check').then((result: boolean) => {
HelperService.isVocabularyCheck = true;
return resolve(result);
});
}); });
} }
......
<ion-header> <ion-header>
<ion-toolbar> <ion-toolbar>
<div class="toolbar-left"> <ion-buttons slot="start">
<img src="assets/imgs/logo.png" width="32px" height="32px" alt="Logo von Callidus: Fuchs"> <ion-menu-button autoHide="false"></ion-menu-button>
</div> </ion-buttons>
<div class="toolbar-left"> <div class="home-logo">
<ion-title>{{ 'MACHINA_CALLIDA' | translate }}</ion-title> <img src="assets/imgs/logo.png" width="32px" height="32px" alt="CALLIDUS Logo">
</div>
<div class="toolbar-right">
<ion-spinner *ngIf="HelperService.isLoading"></ion-spinner>
<ion-select [(ngModel)]="HelperService.currentLanguage" (ngModelChange)="changeLanguage($event)"
name="currentLanguage" placeholder="{{HelperService.currentLanguage?.name}}">
<ion-select-option *ngFor="let lang of HelperService.languages" value="{{lang.shortcut}}">{{lang.name}}
</ion-select-option>
</ion-select>
</div> </div>
<ion-buttons slot="end">
<div>
<ion-spinner *ngIf="HelperService.isLoading"></ion-spinner>
<ion-select [(ngModel)]="HelperService.currentLanguage" (ngModelChange)="changeLanguage($event)"
name="currentLanguage" placeholder="{{HelperService.currentLanguage?.name}}">
<ion-select-option *ngFor="let lang of HelperService.languages"
value="{{lang.shortcut}}">{{lang.name}}</ion-select-option>
</ion-select>
</div>
</ion-buttons>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
...@@ -29,19 +31,8 @@ ...@@ -29,19 +31,8 @@
</ion-row> </ion-row>
<ion-row> <ion-row>
<ion-col> <ion-col>
<div class="card"> <ion-button
<img src="/assets/imgs/brain-creative.jpg" alt="Brain" style="width:80%; height:80%"> (click)="HelperService.goToAuthorPage(navCtrl).then()">{{ 'EXERCISE_GENERATE' | translate }}</ion-button>
<h1>{{ 'EXERCISE_GENERATE' | translate }}</h1>
<p>{{'TEXT_SELECTION' | translate }}<br>
{{'TEXT_COMPLEXITY' | translate }}<br>
{{'VOCABULARY_CHECK' | translate }}<br>
{{'EXERCISE_PARAMETERS' | translate }}<br>
{{'PREVIEW' | translate }}
</p>
<p>
<ion-button (click)="goToAuthorPage()">{{ 'CONTINUE' | translate }}</ion-button>
</p>
</div>
</ion-col> </ion-col>
<ion-col> <ion-col>
<div class="card"> <div class="card">
...@@ -76,20 +67,8 @@ ...@@ -76,20 +67,8 @@
</div> </div>
</ion-col> </ion-col>
<ion-col> <ion-col>
<div class="card"> <ion-button
<img src="/assets/imgs/brain-creative.jpg" alt="Brain" style="width:80%; height:80%"> (click)="HelperService.goToExerciseListPage(navCtrl).then()">{{ 'EXERCISE_LIST' | translate }}</ion-button>
<h1>{{ 'CONCEPT' | translate }}</h1>
<p>{{'CONCEPT_VOCABULARY_ACQUISITION' | translate }}<br>
{{'CONCEPT_UNIT' | translate }}<br>
{{'CONCEPT_REPOSITORY' | translate }}<br>
Software<br>
{{'SOURCES' | translate }}<br>
</p>
<p>
<ion-button (click)="HelperService.goToInfoPage(navCtrl)">{{ 'CONTINUE' | translate }}
</ion-button>
</p>
</div>
</ion-col> </ion-col>
</ion-row> </ion-row>
<ion-row> <ion-row>
......
.home-logo {
text-align: center;
}
.lastMainElement { .lastMainElement {
height: 40%; height: 40%;
} }
......
...@@ -50,11 +50,6 @@ export class HomePage implements OnInit { ...@@ -50,11 +50,6 @@ export class HomePage implements OnInit {
} }
} }
goToAuthorPage() {
HelperService.isVocabularyCheck = false;
this.navCtrl.navigateForward('/author').then();
}
refreshCorpora() { refreshCorpora() {
this.isCorpusUpdateInProgress = true; this.isCorpusUpdateInProgress = true;
this.corpusService.getCorpora(0).then(async () => { this.corpusService.getCorpora(0).then(async () => {
......
...@@ -33,7 +33,7 @@ export class RankingPage { ...@@ -33,7 +33,7 @@ export class RankingPage {
const urnEnd: string = ar.nodes.slice(-1)[0].id.split('/')[1]; const urnEnd: string = ar.nodes.slice(-1)[0].id.split('/')[1];
this.corpusService.currentUrn = urnStart.concat('-', urnEnd.split(':').slice(-1)[0]); this.corpusService.currentUrn = urnStart.concat('-', urnEnd.split(':').slice(-1)[0]);
this.corpusService.processAnnisResponse(ar); this.corpusService.processAnnisResponse(ar);
HelperService.goToShowTextPage(this.navCtrl, true); HelperService.goToShowTextPage(this.navCtrl, true).then();
}, async (error: HttpErrorResponse) => { }, async (error: HttpErrorResponse) => {
}); });
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<ion-row> <ion-row>
<ion-col> <ion-col>
<ion-button <ion-button
(click)="HelperService.goToExerciseParametersPage(navCtrl)">{{ "EXERCISE_SET_PARAMETERS" | translate}}</ion-button> (click)="HelperService.goToExerciseParametersPage(navCtrl).then()">{{ "EXERCISE_SET_PARAMETERS" | translate}}</ion-button>
</ion-col> </ion-col>
<ion-col> <ion-col>
<ion-button <ion-button
......
...@@ -174,7 +174,7 @@ ...@@ -174,7 +174,7 @@
<ion-icon name="send"></ion-icon> <ion-icon name="send"></ion-icon>
<ion-label>{{ 'TEST_MODULE_SEND_DATA' | translate }}</ion-label> <ion-label>{{ 'TEST_MODULE_SEND_DATA' | translate }}</ion-label>
</ion-tab-button> </ion-tab-button>
<ion-tab-button (click)="HelperService.goToAuthorPage(navCtrl)"> <ion-tab-button (click)="HelperService.goToAuthorPage(navCtrl).then()">
<ion-icon name="walk"></ion-icon> <ion-icon name="walk"></ion-icon>
<ion-label>{{ 'EXERCISE_GENERATE' | translate }}</ion-label> <ion-label>{{ 'EXERCISE_GENERATE' | translate }}</ion-label>
</ion-tab-button> </ion-tab-button>
......
...@@ -238,11 +238,11 @@ export class TextRangePage { ...@@ -238,11 +238,11 @@ export class TextRangePage {
this.corpusService.isTextRangeCorrect = true; this.corpusService.isTextRangeCorrect = true;
this.corpusService.getText().then(() => { this.corpusService.getText().then(() => {
if (skipText) { if (skipText) {
HelperService.goToExerciseParametersPage(this.navCtrl); HelperService.goToExerciseParametersPage(this.navCtrl).then();
} else if (HelperService.isVocabularyCheck) { } else if (HelperService.isVocabularyCheck) {
HelperService.goToVocabularyCheckPage(this.navCtrl); HelperService.goToVocabularyCheckPage(this.navCtrl).then();
} else { } else {
HelperService.goToShowTextPage(this.navCtrl); HelperService.goToShowTextPage(this.navCtrl).then();
} }
}, () => { }, () => {
}); });
......
...@@ -55,9 +55,6 @@ ...@@ -55,9 +55,6 @@
} }
ion-buttons { ion-buttons {
position: absolute;
right: 0;
top: 0;
color: var(--ion-color-primary); color: var(--ion-color-primary);
} }
......
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