show-text.page.html 5.78 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
        <ion-spinner *ngIf="HelperService.isLoading"></ion-spinner>
11
12
        <ion-title *ngIf="corpusService.currentCorpus | async as cc">
            {{cc.title}}
13
            {{corpusService.currentUrn?.split(":")[corpusService.currentUrn?.split(":").length - 1]}}
14
        </ion-title>
15
16
17
        <ion-buttons slot="end">
            <ion-menu-button autoHide="false"></ion-menu-button>
        </ion-buttons>
18
19
20
21
22
    </ion-toolbar>
</ion-header>


<ion-content padding>
23
24
25
    <h2 padding>
        {{'SHOW_TEXT_TITLE' | translate}}
    </h2>
26
    <ion-grid *ngIf="corpusService.currentText.length > 0; else loading">
27
        <ion-row *ngIf="HelperService.isVocabularyCheck">
28
            <ion-col style="text-align:left; padding-left:10px;">
29
                <label>
30
                    <input type="checkbox" [(ngModel)]="highlightOOV"/>
31
                    <span class="checkbox">{{ "TEXT_SHOW_OOV" | translate}}</span>
32
33
34
35
                </label>
                <br>
            </ion-col>
        </ion-row>
36
        <ion-row>
37
38
39
40
            <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"
41
                                                                                                   [class.oov]="node.is_oov">{{node.annis_tok}}</span>{{ getWhiteSpace(i) }}</span>
42
43
44
45
                </div>
                <ng-template #noOOV>
                    <span class="tok">{{corpusService.currentText}}</span>
                </ng-template>
46
            </ion-col>
47
48
            <ion-col class="toggle-menu" style="text-align:left; padding: 0">
                <ion-grid style="padding: 0">
49
50
                    <ion-row>
                        <button *ngIf="showTextComplexity; else dropright"
51
                                (click)="showTextComplexity = !showTextComplexity">
52
53
54
55
56
57
58
59
                            <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>
60
61
                            <h2 (click)="showTextComplexity = !showTextComplexity"
                                style="padding: 0 0.2em 0.2em 0; margin: 0">
62
                                {{ 'TEXT_COMPLEXITY' | translate }}</h2>
63
                        </div>
64
                        <button (click)="showTextComplexityDoc = !showTextComplexityDoc" style="padding:0.2em;">
65
66
                            <ion-icon name="help-circle"></ion-icon>
                        </button>
67
                    </ion-row>
68
69
70
71
72
73
74
75
76
77
78
79
                    <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 }}
80
81
                    </ion-row>
                    <ion-row>
82
                        <a (click)="generateDownloadLink(FileType[FileType.docx])" style="padding:0.5em;">
83
84
85
86
                            {{ 'GENERATE_FILE_DOCX' | translate }}
                        </a>
                    </ion-row>
                    <ion-row>
87
                        <a (click)="generateDownloadLink(FileType[FileType.pdf])" style="padding:0.5em;">
88
89
90
91
                            {{ 'GENERATE_FILE_PDF' | translate }}
                        </a>
                    </ion-row>
                </ion-grid>
92
93
94
95
96
97
98
99
100
101
102
            </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>
103
104
        <ion-row>
        </ion-row>
105
        <ion-row>
106
107
            <ion-col>
                <ion-button (click)="navCtrl.pop()">{{ 'BACK' | translate }}</ion-button>
108
            </ion-col>
109
110
111
112
113
114
115
116
            <ion-col>
                <ion-button (click)="HelperService.goToVocabularyCheckPage(navCtrl)">
                    {{ 'VOCABULARY_CHECK' | translate }}</ion-button>
            </ion-col>
            <ion-col>
                <ion-button (click)="HelperService.goToExerciseParametersPage(navCtrl).then()">
                    {{ "EXERCISE_SET_PARAMETERS" | translate}}</ion-button>
            </ion-col>
117
118
119
120
121
        </ion-row>
    </ion-grid>
    <ng-template #loading>
        <ion-spinner></ion-spinner>
    </ng-template>
122
</ion-content>