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