mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
adjust frontend to use the new tag color api
This commit is contained in:
@@ -8,15 +8,7 @@
|
||||
<div class="modal-body">
|
||||
<app-input-text i18n-title title="Name" formControlName="name" [error]="error?.name"></app-input-text>
|
||||
|
||||
|
||||
<div class="form-group paperless-input-select">
|
||||
<label for="colour" i18n>Color</label>
|
||||
<ng-select name="colour" formControlName="colour" [items]="getColours()" bindValue="id" bindLabel="name" [clearable]="false">
|
||||
<ng-template ng-option-tmp ng-label-tmp let-item="item">
|
||||
<span class="badge" [style.background]="item.id" [style.color]="item.textColor">{{item.name}}</span>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
<app-input-color i18n-title title="Color" formControlName="color" [error]="error?.color"></app-input-color>
|
||||
|
||||
<app-input-check i18n-title title="Inbox tag" formControlName="is_inbox_tag" i18n-hint hint="Inbox tags are automatically assigned to all consumed documents."></app-input-check>
|
||||
<app-input-select i18n-title title="Matching algorithm" [items]="getMatchingAlgorithms()" formControlName="matching_algorithm"></app-input-select>
|
||||
|
@@ -2,7 +2,7 @@ import { Component } from '@angular/core';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component';
|
||||
import { TAG_COLOURS, PaperlessTag } from 'src/app/data/paperless-tag';
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag';
|
||||
import { TagService } from 'src/app/services/rest/tag.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@@ -28,7 +28,7 @@ export class TagEditDialogComponent extends EditDialogComponent<PaperlessTag> {
|
||||
getForm(): FormGroup {
|
||||
return new FormGroup({
|
||||
name: new FormControl(''),
|
||||
colour: new FormControl(''),
|
||||
color: new FormControl(''),
|
||||
is_inbox_tag: new FormControl(false),
|
||||
matching_algorithm: new FormControl(1),
|
||||
match: new FormControl(""),
|
||||
@@ -36,12 +36,4 @@ export class TagEditDialogComponent extends EditDialogComponent<PaperlessTag> {
|
||||
})
|
||||
}
|
||||
|
||||
getColours() {
|
||||
return TAG_COLOURS
|
||||
}
|
||||
|
||||
getColor(id) {
|
||||
return TAG_COLOURS.find(c => c.id == id)
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -26,8 +26,8 @@
|
||||
<tbody>
|
||||
<tr *ngFor="let tag of data">
|
||||
<td scope="row">{{ tag.name }}</td>
|
||||
<td scope="row"><span class="badge" [style.color]="getColor(tag.colour).textColor"
|
||||
[style.background-color]="tag.colour">{{ getColor(tag.colour).name }}</span></td>
|
||||
<td scope="row"><span class="badge" [style.color]="tag.text_color"
|
||||
[style.background-color]="tag.color">{{tag.color}}</span></td>
|
||||
<td scope="row">{{ getMatching(tag) }}</td>
|
||||
<td scope="row">{{ tag.document_count }}</td>
|
||||
<td scope="row">
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { FILTER_HAS_TAG } from 'src/app/data/filter-rule-type';
|
||||
import { TAG_COLOURS, PaperlessTag } from 'src/app/data/paperless-tag';
|
||||
import { PaperlessTag } from 'src/app/data/paperless-tag';
|
||||
import { DocumentListViewService } from 'src/app/services/document-list-view.service';
|
||||
import { TagService } from 'src/app/services/rest/tag.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
@@ -22,14 +22,6 @@ export class TagListComponent extends GenericListComponent<PaperlessTag> {
|
||||
super(tagService, modalService, TagEditDialogComponent, toastService)
|
||||
}
|
||||
|
||||
getColor(id) {
|
||||
var color = TAG_COLOURS.find(c => c.id == id)
|
||||
if (color) {
|
||||
return color
|
||||
}
|
||||
return { id: id, name: id, textColor: "#ffffff" }
|
||||
}
|
||||
|
||||
getDeleteMessage(object: PaperlessTag) {
|
||||
return $localize`Do you really want to delete the tag "${object.name}"?`
|
||||
}
|
||||
|
Reference in New Issue
Block a user