From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 7 Mar 2023 00:32:20 +0000 (-0800) Subject: Handle "private" tags, doctypes, correspondents X-Git-Tag: v1.14.0-beta.rc1~37^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2839%2Fhead;p=thirdparty%2Fpaperless-ngx.git Handle "private" tags, doctypes, correspondents --- diff --git a/src-ui/messages.xlf b/src-ui/messages.xlf index f7cc20fc3a..3484957ab2 100644 --- a/src-ui/messages.xlf +++ b/src-ui/messages.xlf @@ -1824,7 +1824,7 @@ src/app/components/common/input/select/select.component.html - 31 + 32 src/app/components/common/input/tags/tags.component.html @@ -1963,10 +1963,25 @@ Add item src/app/components/common/input/select/select.component.html - 11 + 12 Used for both types, correspondents, storage paths + + Private + + src/app/components/common/input/select/select.component.ts + 36 + + + src/app/components/common/tag/tag.component.html + 7 + + + src/app/components/common/tag/tag.component.html + 8 + + Add tag diff --git a/src-ui/src/app/components/common/input/select/select.component.html b/src-ui/src/app/components/common/input/select/select.component.html index aa005fb1fc..9a18873386 100644 --- a/src-ui/src/app/components/common/input/select/select.component.html +++ b/src-ui/src/app/components/common/input/select/select.component.html @@ -5,6 +5,7 @@ [disabled]="disabled" [style.color]="textColor" [style.background]="backgroundColor" + [class.private]="isPrivate" [clearable]="allowNull" [items]="items" [addTag]="allowCreateNew && addItemRef" diff --git a/src-ui/src/app/components/common/input/select/select.component.scss b/src-ui/src/app/components/common/input/select/select.component.scss index 3d5f375262..2ed6995c84 100644 --- a/src-ui/src/app/components/common/input/select/select.component.scss +++ b/src-ui/src/app/components/common/input/select/select.component.scss @@ -12,3 +12,8 @@ } } } + +::ng-deep .private .ng-value-container { + font-style: italic; + opacity: .75; +} diff --git a/src-ui/src/app/components/common/input/select/select.component.ts b/src-ui/src/app/components/common/input/select/select.component.ts index 877b0f78da..0f65d76b66 100644 --- a/src-ui/src/app/components/common/input/select/select.component.ts +++ b/src-ui/src/app/components/common/input/select/select.component.ts @@ -26,8 +26,23 @@ export class SelectComponent extends AbstractInputComponent { this.addItemRef = this.addItem.bind(this) } + _items: any[] + @Input() - items: any[] + set items(items) { + if (this.value && items.find((i) => i.id === this.value) === undefined) { + items.push({ + id: this.value, + name: $localize`Private`, + private: true, + }) + } + this._items = items + } + + get items(): any[] { + return this._items + } @Input() textColor: any @@ -61,6 +76,10 @@ export class SelectComponent extends AbstractInputComponent { return this.createNew.observers.length > 0 } + get isPrivate(): boolean { + return this.items.find((i) => i.id === this.value)?.private + } + getSuggestions() { if (this.suggestions && this.items) { return this.suggestions diff --git a/src-ui/src/app/components/common/tag/tag.component.html b/src-ui/src/app/components/common/tag/tag.component.html index ed51597dc2..ff07b4864e 100644 --- a/src-ui/src/app/components/common/tag/tag.component.html +++ b/src-ui/src/app/components/common/tag/tag.component.html @@ -1,2 +1,9 @@ -{{tag.name}} -{{tag.name}} + + {{tag.name}} + {{tag.name}} + + + + Private + Private + diff --git a/src-ui/src/app/components/common/tag/tag.component.scss b/src-ui/src/app/components/common/tag/tag.component.scss index d5d77448d9..3de7e7f13c 100644 --- a/src-ui/src/app/components/common/tag/tag.component.scss +++ b/src-ui/src/app/components/common/tag/tag.component.scss @@ -4,3 +4,10 @@ a { word-break: break-word; text-align: end; } + +.private { + background-color: #000000; + color: #ffffff; + opacity: .5; + font-style: italic; +}