text-range.page.html 9.27 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
        <ion-title *ngIf="corpusService.currentCorpus | async as cc">{{cc.title}}</ion-title>
12
        <ion-buttons slot="end">
13 14 15
            <ion-menu-button autoHide="false">
                <ion-icon name="md-menu"></ion-icon>
            </ion-menu-button>
16
        </ion-buttons>
17 18 19 20
    </ion-toolbar>
</ion-header>


21
<ion-content class="ion-padding">
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
    <div *ngIf="corpusService.currentCorpus | async as cc">
        <ion-grid *ngIf="corpusService.currentTextRange | async as tr">
            <ion-row>
                <h2>{{'TEXT_RANGE' | translate}}</h2>
            </ion-row>
            <ion-row>
                <ion-col>
                    {{ 'START_OF_TEXT' | translate }}
                </ion-col>
                <ion-col>
                    <ion-grid>
                        <ion-row>
                            <input id="input1" [(ngModel)]="tr.start[0]" (focus)="currentInputId = 1"
                                   (ngModelChange)="corpusService.setCurrentTextRange(currentInputId);
                                   showFurtherReferences(true).then()"
                                   placeholder="{{cc.citation_level_1}}" (blur)="resetCurrentInputId()"/>
                        </ion-row>
                        <ion-row>
                            <ion-list *ngIf="currentInputId === 1">
                                <ion-item *ngFor="let key of ObjectKeys(cc.citations)">
42
                                    <button class="autocomplete" (click)="tr.start[0] = key; applyAutoComplete(true)">
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
                                        {{ key }}
                                    </button>
                                </ion-item>
                            </ion-list>
                        </ion-row>
                    </ion-grid>
                </ion-col>
                <ion-col *ngIf="cc.citation_level_2 !== CitationLevel[CitationLevel.default]">
                    <ion-grid>
                        <ion-row>
                            <input [(ngModel)]="tr.start[1]" id="input2"
                                   (ngModelChange)="corpusService.setCurrentTextRange(currentInputId);
                                   showFurtherReferences(true).then()"
                                   placeholder="{{ cc.citation_level_2 }}" (focus)="currentInputId = 2"
                                   (blur)="resetCurrentInputId()"
                                   disabled="{{!cc.citations.hasOwnProperty(tr.start[0])}}"/>
                        </ion-row>
                        <ion-row>
                            <ion-list *ngIf="currentInputId === 2">
62 63
                                <ion-item *ngFor="let key of ObjectKeys(cc.citations[tr.start[0]].subcitations)">
                                    <button class="autocomplete" (click)="tr.start[1] = key; applyAutoComplete(true)">
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
                                        {{ key }}
                                    </button>
                                </ion-item>
                            </ion-list>
                        </ion-row>
                    </ion-grid>
                </ion-col>
                <ion-col *ngIf="cc.citation_level_3 !== CitationLevel[CitationLevel.default]">
                    <ion-grid>
                        <ion-row>
                            <input [(ngModel)]="tr.start[2]" id="input3"
                                   (ngModelChange)="corpusService.setCurrentTextRange(currentInputId);
                                   showFurtherReferences(true).then()"
                                   placeholder="{{ cc.citation_level_3 }}" (focus)="currentInputId = 3"
                                   (blur)="resetCurrentInputId()" [disabled]="isInputDisabled[1] | async"/>
                        </ion-row>
                        <ion-row>
                            <ion-list *ngIf="currentInputId === 3">
                                <ion-item
                                        *ngFor="let key of ObjectKeys(cc.citations[tr.start[0]].subcitations[tr.start[1]].subcitations)">
84
                                    <button class="autocomplete" (click)="tr.start[2] = key; applyAutoComplete(true)">
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
                                        {{ key }}
                                    </button>
                                </ion-item>
                            </ion-list>
                        </ion-row>
                    </ion-grid>
                </ion-col>
            </ion-row>
            <ion-row>
                <ion-col>
                    {{ 'END_OF_TEXT' | translate }}
                </ion-col>
                <ion-col>
                    <ion-grid>
                        <ion-row>
                            <input [(ngModel)]="tr.end[0]" id="input4"
                                   (ngModelChange)="corpusService.setCurrentTextRange(currentInputId);
                                   showFurtherReferences(false).then()"
                                   placeholder="{{ cc.citation_level_1 }}" (focus)="currentInputId = 4"
                                   (blur)="resetCurrentInputId()"/>
                        </ion-row>
                        <ion-row>
                            <ion-list *ngIf="currentInputId === 4">
                                <ion-item *ngFor="let key of ObjectKeys(cc.citations)">
109
                                    <button class="autocomplete" (click)="tr.end[0] = key; applyAutoComplete(false)">
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
                                        {{ key }}
                                    </button>
                                </ion-item>
                            </ion-list>
                        </ion-row>
                    </ion-grid>
                </ion-col>
                <ion-col *ngIf="cc.citation_level_2 !== CitationLevel[CitationLevel.default]">
                    <ion-grid>
                        <ion-row>
                            <input [(ngModel)]="tr.end[1]" id="input5"
                                   (ngModelChange)="corpusService.setCurrentTextRange(currentInputId);
                                   showFurtherReferences(false).then()"
                                   placeholder="{{ cc.citation_level_2 }}" (focus)="currentInputId = 5"
                                   (blur)="resetCurrentInputId()"
                                   disabled="{{!cc.citations.hasOwnProperty(tr.end[0])}}"/>
                        </ion-row>
                        <ion-row>
                            <ion-list *ngIf="currentInputId === 5">
129 130
                                <ion-item *ngFor="let key of ObjectKeys(cc.citations[tr.end[0]].subcitations)">
                                    <button class="autocomplete" (click)="tr.end[1] = key; applyAutoComplete(false)">
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
                                        {{ key }}
                                    </button>
                                </ion-item>
                            </ion-list>
                        </ion-row>
                    </ion-grid>
                </ion-col>
                <ion-col *ngIf="cc.citation_level_3 !== CitationLevel[CitationLevel.default]">
                    <ion-grid>
                        <ion-row>
                            <input [(ngModel)]="tr.end[2]" id="input6"
                                   (ngModelChange)="corpusService.setCurrentTextRange(currentInputId);
                                   showFurtherReferences(false).then()"
                                   placeholder="{{ cc.citation_level_3 }}" (focus)="currentInputId = 6"
                                   (blur)="resetCurrentInputId()" [disabled]="isInputDisabled[0] | async"/>
                        </ion-row>
                        <ion-row>
                            <ion-list *ngIf="currentInputId === 6">
                                <ion-item
                                        *ngFor="let key of ObjectKeys(cc.citations[tr.end[0]].subcitations[tr.end[1]].subcitations)">
151
                                    <button class="autocomplete" (click)="tr.end[2] = key; applyAutoComplete(false)">
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
                                        {{ key }}
                                    </button>
                                </ion-item>
                            </ion-list>
                        </ion-row>
                    </ion-grid>
                </ion-col>
            </ion-row>
            <ion-row>
                <ion-col>
                    <ion-button (click)="navCtrl.pop()">{{ 'BACK' | translate }}</ion-button>
                </ion-col>
                <ion-col>
                    <ion-button (click)="confirmSelection()">
                        {{ (HelperService.isVocabularyCheck ? "VOCABULARY_CHECK" : "SHOW_TEXT") | translate }}
                    </ion-button>
                </ion-col>
                <ion-col>
170 171 172
                    <ion-button (click)="confirmSelection(true)">
                        {{ "EXERCISE_SET_PARAMETERS" | translate }}
                    </ion-button>
173 174 175 176
                </ion-col>
            </ion-row>
        </ion-grid>
    </div>
177
</ion-content>