]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Handle "private" tags, doctypes, correspondents 2839/head
authorshamoon <4887959+shamoon@users.noreply.github.com>
Tue, 7 Mar 2023 00:32:20 +0000 (16:32 -0800)
committershamoon <4887959+shamoon@users.noreply.github.com>
Thu, 9 Mar 2023 03:07:47 +0000 (19:07 -0800)
src-ui/messages.xlf
src-ui/src/app/components/common/input/select/select.component.html
src-ui/src/app/components/common/input/select/select.component.scss
src-ui/src/app/components/common/input/select/select.component.ts
src-ui/src/app/components/common/tag/tag.component.html
src-ui/src/app/components/common/tag/tag.component.scss

index f7cc20fc3a2da9fc98e02b1c070e904688ebf8b3..3484957ab2e4ee3500026368f4516bd5407181bd 100644 (file)
         </context-group>
         <context-group purpose="location">
           <context context-type="sourcefile">src/app/components/common/input/select/select.component.html</context>
-          <context context-type="linenumber">31</context>
+          <context context-type="linenumber">32</context>
         </context-group>
         <context-group purpose="location">
           <context context-type="sourcefile">src/app/components/common/input/tags/tags.component.html</context>
         <source>Add item</source>
         <context-group purpose="location">
           <context context-type="sourcefile">src/app/components/common/input/select/select.component.html</context>
-          <context context-type="linenumber">11</context>
+          <context context-type="linenumber">12</context>
         </context-group>
         <note priority="1" from="description">Used for both types, correspondents, storage paths</note>
       </trans-unit>
+      <trans-unit id="3686284950598311784" datatype="html">
+        <source>Private</source>
+        <context-group purpose="location">
+          <context context-type="sourcefile">src/app/components/common/input/select/select.component.ts</context>
+          <context context-type="linenumber">36</context>
+        </context-group>
+        <context-group purpose="location">
+          <context context-type="sourcefile">src/app/components/common/tag/tag.component.html</context>
+          <context context-type="linenumber">7</context>
+        </context-group>
+        <context-group purpose="location">
+          <context context-type="sourcefile">src/app/components/common/tag/tag.component.html</context>
+          <context context-type="linenumber">8</context>
+        </context-group>
+      </trans-unit>
       <trans-unit id="6560126119609945418" datatype="html">
         <source>Add tag</source>
         <context-group purpose="location">
index aa005fb1fc4af2c158d673e9c9f5c5e70786a350..9a18873386b73c9113f83b874198390977f89952 100644 (file)
@@ -5,6 +5,7 @@
         [disabled]="disabled"
         [style.color]="textColor"
         [style.background]="backgroundColor"
+        [class.private]="isPrivate"
         [clearable]="allowNull"
         [items]="items"
         [addTag]="allowCreateNew && addItemRef"
index 3d5f375262efe48f2b077ddb8b7cb147c342e868..2ed6995c8423b7ed908b2e9a898b37bdfb2fb7a9 100644 (file)
@@ -12,3 +12,8 @@
         }
     }
 }
+
+::ng-deep .private .ng-value-container {
+    font-style: italic;
+    opacity: .75;
+}
index 877b0f78da686726d7f8fa8a6413e22890d54b10..0f65d76b661a088f68983bf5c647977e1cde8503 100644 (file)
@@ -26,8 +26,23 @@ export class SelectComponent extends AbstractInputComponent<number> {
     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<number> {
     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
index ed51597dc25fe6d6358d4b5ee8b47fba9432d91e..ff07b4864eafca683a2702b3eee46a1b3e9cfef4 100644 (file)
@@ -1,2 +1,9 @@
-<span *ngIf="!clickable" class="badge" [style.background]="tag.color" [style.color]="tag.text_color">{{tag.name}}</span>
-<a [title]="linkTitle" *ngIf="clickable" class="badge" [style.background]="tag.color" [style.color]="tag.text_color">{{tag.name}}</a>
+<ng-container *ngIf="tag !== undefined; else privateTag" >
+    <span *ngIf="!clickable" class="badge" [style.background]="tag.color" [style.color]="tag.text_color">{{tag.name}}</span>
+    <a [title]="linkTitle" *ngIf="clickable" class="badge" [style.background]="tag.color" [style.color]="tag.text_color">{{tag.name}}</a>
+</ng-container>
+
+<ng-template #privateTag>
+    <span *ngIf="!clickable" class="badge private" i18n>Private</span>
+    <a [title]="linkTitle" *ngIf="clickable" class="badge private" i18n>Private</a>
+</ng-template>
index d5d77448d94ba341d8bc6e0c1f45faaeae2de75f..3de7e7f13ceb3f72de42104fe57a2fb6f8d2504c 100644 (file)
@@ -4,3 +4,10 @@ a {
     word-break: break-word;
     text-align: end;
 }
+
+.private {
+    background-color: #000000;
+    color: #ffffff;
+    opacity: .5;
+    font-style: italic;
+}