show-text.page.html 5.58 KB
Newer Older
1 2
<ion-header>
    <ion-toolbar>
3 4
        <ion-buttons slot="start">
            <div class="home-logo">
5
                <a (click)="HelperService.goToHomePage(navCtrl)">
6 7 8 9
                    <img src="assets/imgs/logo.png" width="32px" height="32px" alt="CALLIDUS Logo">
                </a>
            </div>
        </ion-buttons>
10 11 12 13
        <ion-spinner *ngIf="HelperService.isLoading"></ion-spinner>
        <ion-title>
            {{corpusService.currentCorpus?.title}} {{corpusService.currentUrn?.split(":")[corpusService.currentUrn?.split(":").length - 1]}}
        </ion-title>
14 15 16
        <ion-buttons slot="end">
            <ion-menu-button autoHide="false"></ion-menu-button>
        </ion-buttons>
17 18 19 20 21
    </ion-toolbar>
</ion-header>


<ion-content padding>
22 23 24
    <h2 padding>
        {{'SHOW_TEXT_TITLE' | translate}}
    </h2>
25
    <ion-grid *ngIf="corpusService.currentText.length > 0; else loading">
26
        <ion-row *ngIf="HelperService.isVocabularyCheck">
27
            <ion-col style="text-align:left; padding-left:10px;">
28
                <label>
29
                    <input type="checkbox" [(ngModel)]="highlightOOV"/>
30
                    <span class="checkbox">{{ "TEXT_SHOW_OOV" | translate}}</span>
31 32 33 34
                </label>
                <br>
            </ion-col>
        </ion-row>
35
        <ion-row>
36 37 38 39
            <ion-col class="text" size="8">
                <div *ngIf="highlightOOV; else noOOV">
                    <!-- do not add whitespace/newline etc. between the span elements!                   -->
                    <span *ngFor="let node of corpusService.annisResponse.nodes; index as i"><span class="tok"
40
                                                                                                   [class.oov]="node.is_oov">{{node.annis_tok}}</span>{{ getWhiteSpace(i) }}</span>
41 42 43 44
                </div>
                <ng-template #noOOV>
                    <span class="tok">{{corpusService.currentText}}</span>
                </ng-template>
45
            </ion-col>
46
            <ion-col class="toggle-menu" style="text-align:left" padding>
47 48 49 50 51 52 53 54 55 56 57 58 59 60
                <ion-grid>
                    <ion-row>
                        <button *ngIf="showTextComplexity; else dropright"
                                (click)="showTextComplexity = !showTextComplexity">
                            <ion-icon name="arrow-dropdown"></ion-icon>
                        </button>
                        <ng-template #dropright>
                            <button (click)="showTextComplexity = !showTextComplexity">
                                <ion-icon name="arrow-dropright"></ion-icon>
                            </button>
                        </ng-template>
                        <div>
                            <h2 (click)="showTextComplexity = !showTextComplexity">{{ 'TEXT_COMPLEXITY' | translate }}</h2>
                        </div>
61 62 63
                        <button (click)="showTextComplexityDoc = !showTextComplexityDoc">
                            <ion-icon name="help-circle"></ion-icon>
                        </button>
64
                    </ion-row>
65 66 67 68 69 70 71 72 73 74 75 76
                    <ion-row *ngIf="showTextComplexity" style="text-align:left; padding: 0 0 1em 0">
                        <ion-grid>
                            <ion-row *ngFor="let key of ObjectKeys(textComplexityMap)">
                                <label>
                                    {{ textComplexityMap[key] | translate }}:
                                    {{corpusService.annisResponse.text_complexity[key]}}
                                </label>
                            </ion-row>
                        </ion-grid>
                    </ion-row>
                    <ion-row *ngIf="showTextComplexityDoc" style="text-align:left; padding: 0 0 1em 0">
                        {{ 'TEXT_COMPLEXITY_DOCUMENTATION' | translate }}
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
                    </ion-row>
                    <ion-row>
                        <a (click)="generateDownloadLink(FileType[FileType.docx])">
                            {{ 'GENERATE_FILE_DOCX' | translate }}
                        </a>
                    </ion-row>
                    <ion-row>
                        <a (click)="generateDownloadLink(FileType[FileType.pdf])">
                            {{ 'GENERATE_FILE_PDF' | translate }}
                        </a>
                    </ion-row>
                    <ion-row>
                        <a (click)="HelperService.goToVocabularyCheckPage(navCtrl)">
                            {{ 'VOCABULARY_CHECK' | translate }}</a>
                    </ion-row>
                    <ion-row>
                        <a (click)="HelperService.goToExerciseParametersPage(navCtrl).then()">
                            {{ "EXERCISE_SET_PARAMETERS" | translate}}</a>
                    </ion-row>
                </ion-grid>
97 98 99 100 101 102 103 104 105 106 107
            </ion-col>
        </ion-row>
        <ion-row>
            <ion-col>
                <ion-spinner *ngIf="isDownloading"></ion-spinner>
                <!--  hidden download link, do not delete this!
                This is preferable compared to a button click event, because the browser knows from the beginning that
                it is going to be a download (instead of an ordinary link or click).         -->
                <a style="display: none" id="download" href="" download>Download</a>
            </ion-col>
        </ion-row>
108 109
        <ion-row>
        </ion-row>
110
        <ion-row>
111 112
            <ion-col>
                <ion-button (click)="navCtrl.pop()">{{ 'BACK' | translate }}</ion-button>
113 114 115 116 117 118
            </ion-col>
        </ion-row>
    </ion-grid>
    <ng-template #loading>
        <ion-spinner></ion-spinner>
    </ng-template>
119
</ion-content>