Commit 54fff84d authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

text range selection is now facilitated by clicking on the autocomplete suggestions

parent 8d0b08c7
{ {
"name": "mcClient", "name": "mcClient",
"version": "0.4.8", "version": "0.4.9",
"author": "Ionic Framework", "author": "Ionic Framework",
"homepage": "http://ionicframework.com/", "homepage": "http://ionicframework.com/",
"private": true, "private": true,
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
"CASE_LOCATIVE": "Lokativ", "CASE_LOCATIVE": "Lokativ",
"CASE_NOMINATIVE": "Nominativ", "CASE_NOMINATIVE": "Nominativ",
"CASE_VOCATIVE": "Vokativ", "CASE_VOCATIVE": "Vokativ",
"CORPORA_UNAVAILABLE": "Korpora nicht verfügbar :(",
"CORPORA_REFRESH": "Korpora aktualisieren", "CORPORA_REFRESH": "Korpora aktualisieren",
"CORPUS_UPDATE_COMPLETED": "Korpus-Update abgeschlossen", "CORPUS_UPDATE_COMPLETED": "Korpus-Update abgeschlossen",
"DEPENDENCY_ADJECTIVAL_CLAUSE": "Attributsatz", "DEPENDENCY_ADJECTIVAL_CLAUSE": "Attributsatz",
...@@ -47,6 +46,7 @@ ...@@ -47,6 +46,7 @@
"EMAIL": "E-Mail", "EMAIL": "E-Mail",
"END": "Ende", "END": "Ende",
"ERROR_CITATIONS_UNAVAILABLE": "Zitierschema nicht verfügbar :(", "ERROR_CITATIONS_UNAVAILABLE": "Zitierschema nicht verfügbar :(",
"ERROR_CORPORA_UNAVAILABLE": "Korpora nicht verfügbar :(",
"ERROR_GENERAL_ALERT": "Huch, da ist etwas schief gelaufen... :(", "ERROR_GENERAL_ALERT": "Huch, da ist etwas schief gelaufen... :(",
"EXERCISE_DOWNLOAD_NEXT_STEPS": "Nächste Schritte (XML)", "EXERCISE_DOWNLOAD_NEXT_STEPS": "Nächste Schritte (XML)",
"EXERCISE_FEEDBACK": "Feedback", "EXERCISE_FEEDBACK": "Feedback",
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
"CASE_LOCATIVE": "Locative", "CASE_LOCATIVE": "Locative",
"CASE_NOMINATIVE": "Nominative", "CASE_NOMINATIVE": "Nominative",
"CASE_VOCATIVE": "Vocative", "CASE_VOCATIVE": "Vocative",
"CORPORA_UNAVAILABLE": "Corpora unavailable :(",
"CORPORA_REFRESH": "Refresh corpora", "CORPORA_REFRESH": "Refresh corpora",
"CORPUS_UPDATE_COMPLETED": "Corpus update completed", "CORPUS_UPDATE_COMPLETED": "Corpus update completed",
"DEPENDENCY_ADJECTIVAL_CLAUSE": "Adjectival Clause", "DEPENDENCY_ADJECTIVAL_CLAUSE": "Adjectival Clause",
...@@ -47,6 +46,7 @@ ...@@ -47,6 +46,7 @@
"EMAIL": "E-Mail", "EMAIL": "E-Mail",
"END": "End", "END": "End",
"ERROR_CITATIONS_UNAVAILABLE": "Citation scheme unavailable :(", "ERROR_CITATIONS_UNAVAILABLE": "Citation scheme unavailable :(",
"ERROR_CORPORA_UNAVAILABLE": "Corpora unavailable :(",
"ERROR_GENERAL_ALERT": "Oops, something went wrong... :(", "ERROR_GENERAL_ALERT": "Oops, something went wrong... :(",
"EXERCISE_DOWNLOAD_NEXT_STEPS": "Next steps (XML)", "EXERCISE_DOWNLOAD_NEXT_STEPS": "Next steps (XML)",
"EXERCISE_FEEDBACK": "Feedback", "EXERCISE_FEEDBACK": "Feedback",
......
...@@ -7,7 +7,6 @@ import {VocabularyProvider} from "../../providers/vocabulary/vocabulary"; ...@@ -7,7 +7,6 @@ import {VocabularyProvider} from "../../providers/vocabulary/vocabulary";
import {HelperProvider} from "../../providers/helper/helper"; import {HelperProvider} from "../../providers/helper/helper";
import {AnnisResponse} from "../../models/annisResponse"; import {AnnisResponse} from "../../models/annisResponse";
import {HttpErrorResponse} from "@angular/common/http"; import {HttpErrorResponse} from "@angular/common/http";
import {VocabularyCheckPage} from "../vocabulary-check/vocabulary-check";
import {ExerciseProvider} from "../../providers/exercise/exercise"; import {ExerciseProvider} from "../../providers/exercise/exercise";
/** /**
......
...@@ -2,21 +2,15 @@ import {Component} from '@angular/core'; ...@@ -2,21 +2,15 @@ import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams, ToastController} from 'ionic-angular'; import {IonicPage, NavController, NavParams, ToastController} from 'ionic-angular';
import {CorpusProvider} from "../../providers/corpus/corpus"; import {CorpusProvider} from "../../providers/corpus/corpus";
import { import {
CaseValue, ExerciseType, ExerciseTypeTranslation,
DependencyValue,
ExerciseType, ExerciseTypeTranslation, PartOfSpeechValue,
Phenomenon, Phenomenon,
PhenomenonTranslation PhenomenonTranslation
} from "../../models/enum"; } from "../../models/enum";
import {ExerciseProvider} from "../../providers/exercise/exercise"; import {ExerciseProvider} from "../../providers/exercise/exercise";
import {TranslateService} from "@ngx-translate/core"; import {TranslateService} from "@ngx-translate/core";
import {HelperProvider} from "../../providers/helper/helper"; import {HelperProvider} from "../../providers/helper/helper";
import {AnnisResponse} from "../../models/annisResponse";
import {NodeMC} from "../../models/nodeMC";
import {LinkMC} from "../../models/linkMC";
import {VocabularyProvider} from "../../providers/vocabulary/vocabulary"; import {VocabularyProvider} from "../../providers/vocabulary/vocabulary";
import {ExerciseParametersPage} from "../exercise-parameters/exercise-parameters"; import {ExerciseParametersPage} from "../exercise-parameters/exercise-parameters";
import {HttpErrorResponse} from "@angular/common/http";
/** /**
* Generated class for the ShowTextPage page. * Generated class for the ShowTextPage page.
......
...@@ -43,8 +43,9 @@ ...@@ -43,8 +43,9 @@
<ion-row> <ion-row>
<ion-col col-5 padding-right> <ion-col col-5 padding-right>
<ion-label>{{ 'START' | translate }}</ion-label> <ion-label>{{ 'START' | translate }}</ion-label>
<ion-input (ionChange)="showFurtherReferences($event).then()" (ionFocus)="showStartList = true" <ion-input (ionChange)="showFurtherReferences($event).then()"
(ionBlur)="showStartList = false" [(ngModel)]="corpusProvider.currentTextRange.start" (ionFocus)="showStartList = true; showEndList = false"
[(ngModel)]="corpusProvider.currentTextRange.start"
placeholder="{{ '0' + (corpusProvider.currentCorpus.citation_level_2 === CitationLevel[CitationLevel.default] ? '' : (corpusProvider.currentCorpus.citation_level_3 === CitationLevel[CitationLevel.default] ? '.0' : '.0.0'))}}"></ion-input> placeholder="{{ '0' + (corpusProvider.currentCorpus.citation_level_2 === CitationLevel[CitationLevel.default] ? '' : (corpusProvider.currentCorpus.citation_level_3 === CitationLevel[CitationLevel.default] ? '.0' : '.0.0'))}}"></ion-input>
</ion-col> </ion-col>
<ion-col col-2> <ion-col col-2>
...@@ -56,31 +57,38 @@ ...@@ -56,31 +57,38 @@
</ion-col> </ion-col>
<ion-col col-4 offset-1> <ion-col col-4 offset-1>
<ion-label>{{ 'END' | translate }}</ion-label> <ion-label>{{ 'END' | translate }}</ion-label>
<ion-input (ionChange)="showFurtherReferences($event).then()" (ionFocus)="showEndList = true" <ion-input (ionChange)="showFurtherReferences($event).then()"
list="citationLevels" (ionBlur)="showEndList = false" (ionFocus)="showEndList = true; showStartList = false"
[(ngModel)]="corpusProvider.currentTextRange.end" [(ngModel)]="corpusProvider.currentTextRange.end"
placeholder="{{ '0' + (corpusProvider.currentCorpus.citation_level_2 === CitationLevel[CitationLevel.default] ? '' : (corpusProvider.currentCorpus.citation_level_3 === CitationLevel[CitationLevel.default] ? '.0' : '.0.0'))}}"></ion-input> placeholder="{{ '0' + (corpusProvider.currentCorpus.citation_level_2 === CitationLevel[CitationLevel.default] ? '' : (corpusProvider.currentCorpus.citation_level_3 === CitationLevel[CitationLevel.default] ? '.0' : '.0.0'))}}"></ion-input>
</ion-col> </ion-col>
</ion-row> </ion-row>
<ion-row> <ion-row>
<ion-col> <ion-col>
<ion-grid *ngIf="showStartList"> <ion-list *ngIf="showStartList">
<ion-row *ngFor="let citation of currentlyAvailableCitations"> <ion-item-sliding *ngFor="let citation of currentlyVisibleCitations">
<ion-col> <button ion-item class="autocomplete"
<!--TODO: ADD A CLICK EVENT TO SELECT THE CHOSEN VALUE AS A START/END STRING; WORK AROUND THE PROBLEM THAT THE ionBlur EVENT MAKES THIS LIST DISAPPEAR JUST BEFORE THE CLICK EVENT CAN TRIGGER--> (click)="corpusProvider.currentTextRange.start = citation; showStartList = false">
<div>{{citation}}</div> {{ citation }}
</ion-col> </button>
</ion-row> </ion-item-sliding>
</ion-grid> </ion-list>
<ion-infinite-scroll (ionInfinite)="expandCitationList($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-col> </ion-col>
<ion-col> <ion-col>
<ion-grid *ngIf="showEndList"> <ion-list *ngIf="showEndList">
<ion-row *ngFor="let citation of currentlyAvailableCitations"> <ion-item-sliding *ngFor="let citation of currentlyVisibleCitations">
<ion-col> <button ion-item (click)="corpusProvider.currentTextRange.end = citation; showEndList = false"
<div>{{citation}}</div> class="autocomplete">
</ion-col> {{ citation }}
</ion-row> </button>
</ion-grid> </ion-item-sliding>
</ion-list>
<ion-infinite-scroll (ionInfinite)="expandCitationList($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-col> </ion-col>
</ion-row> </ion-row>
</ion-grid> </ion-grid>
......
...@@ -7,4 +7,7 @@ page-corpus-detail { ...@@ -7,4 +7,7 @@ page-corpus-detail {
ion-label { ion-label {
font-size: 2.2em; font-size: 2.2em;
} }
.autocomplete {
color: darkgray;
}
} }
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams, ToastController, ViewController} from 'ionic-angular'; import {InfiniteScroll, IonicPage, NavController, NavParams, ToastController, ViewController} from 'ionic-angular';
import {CorpusProvider} from "../../providers/corpus/corpus"; import {CorpusProvider} from "../../providers/corpus/corpus";
import {CitationLevel} from "../../models/enum"; import {CitationLevel} from "../../models/enum";
import {ShowTextPage} from "../show-text/show-text"; import {ShowTextPage} from "../show-text/show-text";
...@@ -34,6 +34,7 @@ export class TextRangePage { ...@@ -34,6 +34,7 @@ export class TextRangePage {
public invalidTextRangeString: string; public invalidTextRangeString: string;
ObjectKeys = Object.keys; ObjectKeys = Object.keys;
currentlyAvailableCitations: string[] = []; currentlyAvailableCitations: string[] = [];
public currentlyVisibleCitations: string[] = [];
public citationValuesStart: number[]; public citationValuesStart: number[];
public citationValuesEnd: number[]; public citationValuesEnd: number[];
public isTextRangeCheckRunning: boolean = false; public isTextRangeCheckRunning: boolean = false;
...@@ -217,6 +218,12 @@ export class TextRangePage { ...@@ -217,6 +218,12 @@ export class TextRangePage {
}); });
} }
expandCitationList(infiniteScroll: InfiniteScroll) {
let currentLength: number = this.currentlyVisibleCitations.length;
this.currentlyVisibleCitations = this.currentlyVisibleCitations.concat(this.currentlyAvailableCitations.slice(currentLength, currentLength + 10));
infiniteScroll.complete();
}
private getText() { private getText() {
this.corpusProvider.currentText = ""; this.corpusProvider.currentText = "";
if (HelperProvider.isVocabularyCheck) { if (HelperProvider.isVocabularyCheck) {
...@@ -244,6 +251,7 @@ export class TextRangePage { ...@@ -244,6 +251,7 @@ export class TextRangePage {
private initPage() { private initPage() {
this.currentlyAvailableCitations = Object.keys(this.corpusProvider.currentCorpus.citations); this.currentlyAvailableCitations = Object.keys(this.corpusProvider.currentCorpus.citations);
this.currentlyVisibleCitations = this.currentlyAvailableCitations.slice(0, 10);
if (this.corpusProvider.currentCorpus.citation_level_2 === CitationLevel[CitationLevel.default]) { if (this.corpusProvider.currentCorpus.citation_level_2 === CitationLevel[CitationLevel.default]) {
let randomLabel: string = this.corpusProvider.currentCorpus.citations[Object.keys(this.corpusProvider.currentCorpus.citations)[0]].label; let randomLabel: string = this.corpusProvider.currentCorpus.citations[Object.keys(this.corpusProvider.currentCorpus.citations)[0]].label;
this.corpusProvider.currentTextRange.start = this.corpusProvider.currentTextRange.end = randomLabel; this.corpusProvider.currentTextRange.start = this.corpusProvider.currentTextRange.end = randomLabel;
...@@ -315,7 +323,9 @@ export class TextRangePage { ...@@ -315,7 +323,9 @@ export class TextRangePage {
// remove empty elements from the split array // remove empty elements from the split array
let citationLabels: string[] = value.split(".").filter(x => x); let citationLabels: string[] = value.split(".").filter(x => x);
if (citationLabels.length > 0 && this.corpusProvider.currentCorpus.citations[citationLabels[0]]) { if (citationLabels.length > 0 && this.corpusProvider.currentCorpus.citations[citationLabels[0]]) {
this.updateReferences(citationLabels).then(); this.updateReferences(citationLabels).then(() => {
this.currentlyVisibleCitations = this.currentlyAvailableCitations.slice(0, 10);
});
} }
} }
} }
......
...@@ -101,7 +101,7 @@ export class CorpusProvider { ...@@ -101,7 +101,7 @@ export class CorpusProvider {
constructor(public translate: TranslateService, constructor(public translate: TranslateService,
public http: HttpClient, public http: HttpClient,
public toastCtrl: ToastController) { public toastCtrl: ToastController) {
this.translate.get("CORPORA_UNAVAILABLE").subscribe(value => this.corporaUnavailableString = value); this.translate.get("ERROR_CORPORA_UNAVAILABLE").subscribe(value => this.corporaUnavailableString = value);
this.checkForUpdates().then(); this.checkForUpdates().then();
} }
......
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