Commit 6e312f62 authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

users can now filter corpora for treebanks using a checkbox

parent c12ffd4b
......@@ -6,7 +6,7 @@
4. Run `npm install`
5. Run `sudo npm i -g ionic`
6. 1. Run `ionic serve --no-livereload --no-interactive --no-open` and enjoy!
2. To run it in the background, use: `ionic serve --no-livereload --no-interactive --no-open &`
2. To run it in the background, use: `ionic serve --no-livereload --no-interactive --no-open &`
## 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": "mcClient",
"version": "0.5.0",
"version": "0.5.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
......
{
"AUTHOR_SEARCH": "Autor suchen...",
"AUTHOR_SELECT": "Autor auswählen",
"AUTHOR_SHOW_ONLY_TREEBANKS": "Nur hochwertig aufbereitete Texte",
"CALLIDUS_PROJECT": "CALLIDUS-Projekt",
"CANCEL": "Abbrechen",
"CASE_ABLATIVE": "Ablativ",
......
{
"AUTHOR_SEARCH": "Search author...",
"AUTHOR_SELECT": "Select author",
"AUTHOR_SHOW_ONLY_TREEBANKS": "High-quality texts only",
"CALLIDUS_PROJECT": "CALLIDUS Project",
"CANCEL": "Cancel",
"CASE_ABLATIVE": "Ablative",
......
......@@ -15,9 +15,15 @@
</ion-header>
<ion-content padding>
<ion-searchbar (ionInput)="getAuthors($event.target.value)" (ionCancel)="getAuthors('')"
placeholder="{{ 'AUTHOR_SEARCH' | translate }}"></ion-searchbar>
<ion-searchbar (ionInput)="getAuthors()" (ionCancel)="getAuthors('')"
placeholder="{{ 'AUTHOR_SEARCH' | translate }}" [(ngModel)]="currentSearchValue"></ion-searchbar>
<ion-list *ngIf="corpusProvider.availableAuthors.length > 0; else loading">
<ion-item>
<label padding-left>{{ "AUTHOR_SHOW_ONLY_TREEBANKS" | translate}}
<input padding-right type="checkbox" [(ngModel)]="showOnlyTreebanks" (change)="toggleTreebankAuthors()"/>
</label>
<br>
</ion-item>
<ion-item-sliding *ngFor="let author of authorsDisplayed">
<button ion-item (click)="showCorpora(author)">
<h1>{{author.name}}</h1>
......
......@@ -3,6 +3,9 @@ page-author {
max-height: 80%;
overflow-y: scroll;
}
input {
float: left;
}
.searchbar-input {
font-size: 2em !important;
}
......
......@@ -21,7 +21,10 @@ import {HelperProvider} from "../../providers/helper/helper";
})
export class AuthorPage {
public authorsDisplayed: Author[];
public baseAuthorList: Author[];
HelperProvider = HelperProvider;
showOnlyTreebanks: boolean = false;
currentSearchValue: string = "";
constructor(public navCtrl: NavController,
public translate: TranslateService,
......@@ -32,13 +35,14 @@ export class AuthorPage {
this.corpusProvider.isTextRangeCorrect = false;
}
getAuthors(value: string) {
if (!value) {
this.authorsDisplayed = this.corpusProvider.availableAuthors;
getAuthors() {
this.baseAuthorList = this.showOnlyTreebanks ? this.corpusProvider.availableAuthors.filter(author => author.corpora.some(corpus => this.corpusProvider.isTreebank(corpus))) : this.corpusProvider.availableAuthors;
if (!this.currentSearchValue) {
this.authorsDisplayed = this.baseAuthorList;
}
else {
this.authorsDisplayed = this.corpusProvider.availableAuthors.filter((author: Author) => {
return AuthorPage.filterAuthor(author, value)
this.authorsDisplayed = this.baseAuthorList.filter((author: Author) => {
return AuthorPage.filterAuthor(author, this.currentSearchValue)
});
}
}
......@@ -51,4 +55,11 @@ export class AuthorPage {
this.corpusProvider.currentAuthor = author;
this.navCtrl.push(AuthorDetailPage).then();
}
toggleTreebankAuthors() {
this.baseAuthorList = this.showOnlyTreebanks ? this.corpusProvider.availableAuthors.filter(author => author.corpora.some(corpus => this.corpusProvider.isTreebank(corpus))) : this.corpusProvider.availableAuthors;
this.authorsDisplayed = this.baseAuthorList.filter((author: Author) => {
return AuthorPage.filterAuthor(author, this.currentSearchValue)
});
}
}
......@@ -163,11 +163,15 @@ export class CorpusProvider {
return this.http.get(fullUrl, {params: {"urn": urn}});
}
isTreebank(corpus: CorpusMC){
return corpus.source_urn.includes("proiel");
}
private processCorpora(corpusList: CorpusMC[]) {
corpusList.forEach((corpus: CorpusMC) => {
corpus.citations = {};
this.availableCorpora.push(corpus);
if (corpus.source_urn.includes("proiel")) {
if (this.isTreebank(corpus)) {
corpus.author += " (PROIEL)"
}
let existingAuthor: Author = this.availableAuthors.find(author => author.name === corpus.author);
......
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