made admin pages work for admin, fixed some bugs

This commit is contained in:
Timo 2020-12-02 15:25:41 +02:00
parent 4d7204a26d
commit fe7c272137
6 changed files with 28 additions and 24 deletions

View File

@ -39,17 +39,9 @@
<label translate="manual-annotation.dialog.content.dictionary"></label>
<mat-select formControlName="dictionary">
<mat-optgroup [label]="'group.redactions' | translate">
<mat-option *ngFor="let dictionary of redactionDictionaries" [value]="dictionary.type">
{{ dictionary.label }}
</mat-option>
</mat-optgroup>
<mat-optgroup [label]="'group.hints' | translate">
<mat-option *ngFor="let dictionary of hintDictionaries" [value]="dictionary.type">
{{ dictionary.label }}
</mat-option>
</mat-optgroup>
<mat-option *ngFor="let dictionary of redactionDictionaries" [value]="dictionary.type">
{{ dictionary.label }}
</mat-option>
</mat-select>
</div>
</div>

View File

@ -40,7 +40,13 @@
<div class="flex red-content-inner">
<div class="left-container">
<div class="red-input-group">
<input type="text" (keyup)="searchChanged(inputElement.value)" #inputElement placeholder="{{ 'dictionary-overview.search' | translate }}" />
<input
[class.with-matches]="searchText.length > 0"
type="text"
(keyup)="searchChanged(inputElement.value)"
#inputElement
placeholder="{{ 'dictionary-overview.search' | translate }}"
/>
<div class="input-icons">
<div class="no-input" *ngIf="searchText.length === 0">
@ -50,8 +56,8 @@
<div class="search-match-text">
{{ currentMatch + '/' + searchPositions.length }}
</div>
<mat-icon svgIcon="red:arrow-down" class="transform-180 pointer" (click)="nextSearchMatch()"></mat-icon>
<mat-icon svgIcon="red:arrow-down" class="pointer" (click)="previousSearchMatch()"></mat-icon>
<mat-icon svgIcon="red:arrow-down" class="transform-180 pointer" (click)="previousSearchMatch()"></mat-icon>
<mat-icon svgIcon="red:arrow-down" class="pointer" (click)="nextSearchMatch()"></mat-icon>
<mat-icon svgIcon="red:close" (click)="searchChanged(''); inputElement.value = ''; inputElement.focus()" class="pointer"></mat-icon>
</div>
</div>

View File

@ -74,6 +74,10 @@ ace-editor {
input {
padding-right: 32px;
&.with-matches {
padding-right: 108px;
}
}
.input-icons {

View File

@ -173,6 +173,7 @@ export class DictionaryOverviewScreenComponent {
}
nextSearchMatch() {
// length = 3
if (this.searchPositions.length > 0) {
this.currentMatch = this.currentMatch < this.searchPositions.length ? this.currentMatch + 1 : 1;
this._gotoLine();
@ -181,7 +182,7 @@ export class DictionaryOverviewScreenComponent {
previousSearchMatch() {
if (this.searchPositions.length > 0) {
this.currentMatch = this.currentMatch > 1 ? this.currentMatch - 1 : this.searchPositions.length - 1;
this.currentMatch = this.currentMatch > 1 ? this.currentMatch - 1 : this.searchPositions.length;
this._gotoLine();
}
}

View File

@ -109,12 +109,14 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
instance.docViewer.on('keyUp', ($event) => {
// arrows and full-screen
if ($event.key.startsWith('Arrow') || $event.key === 'f') {
this._ngZone.run(() => {
this.keyUp.emit($event);
});
$event.preventDefault();
$event.stopPropagation();
if ($event.target?.tagName?.toLowerCase() !== 'input') {
if ($event.key.startsWith('Arrow') || $event.key === 'f') {
this._ngZone.run(() => {
this.keyUp.emit($event);
});
$event.preventDefault();
$event.stopPropagation();
}
}
if (this._allowedKeyboardShortcuts.indexOf($event.key) < 0) {

View File

@ -11,14 +11,13 @@ export class AppStateGuard implements CanActivate {
async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> {
await this._userService.loadAllUsersIfNecessary();
await this._appStateService.loadDictionaryDataIfNecessary();
await this._appStateService.updateDictionaryVersion();
if (this._userService.isUser()) {
await this._appStateService.loadAllProjectsIfNecessary();
}
await this._appStateService.loadDictionaryDataIfNecessary();
await this._appStateService.updateDictionaryVersion();
return true;
}
}