]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Merge branch 'dev' into feature-permissions
authorMichael Shamoon <4887959+shamoon@users.noreply.github.com>
Sat, 10 Dec 2022 01:54:14 +0000 (17:54 -0800)
committerMichael Shamoon <4887959+shamoon@users.noreply.github.com>
Sat, 10 Dec 2022 01:54:14 +0000 (17:54 -0800)
1  2 
src-ui/src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.html
src-ui/src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.ts
src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html
src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts
src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html
src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts
src-ui/src/app/components/document-list/document-list.component.html
src/documents/serialisers.py
src/documents/views.py

index d4a8eba163e67f47aa3f04bfa3888d1e0d93beba,32ca3859ef2a0901fbe31d189a84270098bfaf71..3e15335a4d073a0793e03f327e3407c80053e72b
          <th scope="col" i18n>Title</th>
        </tr>
      </thead>
 -    <tbody>
 +    <tbody *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Document }">
-       <tr *ngFor="let doc of documents" (click)="openDocumentsService.openDocument(doc)">
-         <td>{{doc.created_date | customDate}}</td>
-         <td>{{doc.title | documentTitle}}<app-tag [tag]="t" *ngFor="let t of doc.tags$ | async" class="ms-1" (click)="clickTag(t); $event.stopPropagation();"></app-tag></td>
+       <tr *ngFor="let doc of documents">
+         <td><a routerLink="/documents/{{doc.id}}" class="d-block text-dark text-decoration-none">{{doc.created_date | customDate}}</a></td>
+         <td><a routerLink="/documents/{{doc.id}}" class="d-block text-dark text-decoration-none">{{doc.title | documentTitle}}<app-tag [tag]="t" *ngFor="let t of doc.tags$ | async" class="ms-1" (click)="clickTag(t, $event)"></app-tag></a></td>
        </tr>
      </tbody>
    </table>
index 78f8a1c6c8d7c9cc211b7f64ed29ffda2ebe9bfd,80aedb7f2bdb7f6f80a3dcea4af346138cb12b15..63bee171267fadf63ec4f74098fd6b88924a42a1
@@@ -37,7 -37,7 +37,7 @@@
                  <use xlink:href="assets/bootstrap-icons.svg#diagram-3"/>
                </svg>&nbsp;<span class="d-none d-md-inline" i18n>More like this</span>
              </a>
-             <a (click)="openDocumentsService.openDocument(document)" class="btn btn-sm btn-outline-secondary" *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }">
 -            <a routerLink="/documents/{{document.id}}" class="btn btn-sm btn-outline-secondary">
++            <a routerLink="/documents/{{document.id}}" class="btn btn-sm btn-outline-secondary" *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }">
                <svg class="sidebaricon" fill="currentColor" class="sidebaricon">
                  <use xlink:href="assets/bootstrap-icons.svg#pencil"/>
                </svg>&nbsp;<span class="d-none d-md-inline" i18n>Edit</span>
index a32e66b390de76d8e75898f248fb5b7ed8f98ecc,512cb51aeebc99fbdfa1aa495df3b254594461d7..a6c9c25d3da2827797947cfba0b0bcff6e0ab176
@@@ -10,9 -10,7 +10,8 @@@ import { PaperlessDocument } from 'src/
  import { DocumentService } from 'src/app/services/rest/document.service'
  import { SettingsService } from 'src/app/services/settings.service'
  import { NgbPopover } from '@ng-bootstrap/ng-bootstrap'
- import { OpenDocumentsService } from 'src/app/services/open-documents.service'
  import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
 +import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component'
  
  @Component({
    selector: 'app-document-card-large',
      '../popover-preview/popover-preview.scss',
    ],
  })
 -export class DocumentCardLargeComponent implements OnInit {
 +export class DocumentCardLargeComponent
 +  extends ComponentWithPermissions
 +  implements OnInit
 +{
    constructor(
      private documentService: DocumentService,
-     private settingsService: SettingsService,
-     public openDocumentsService: OpenDocumentsService
+     private settingsService: SettingsService
 -  ) {}
 +  ) {
 +    super()
 +  }
  
    @Input()
    selected = false
index e2dfee50b1441c78e2d60bf11d76e88081e8ce2c,5e46ed7b4dd18f763d6f241f418638d3290ac990..c4e15442b4f9130aa2c407891783f3c8ab74d125
@@@ -67,7 -67,7 +67,7 @@@
        </div>
        <div class="d-flex justify-content-between align-items-center">
          <div class="btn-group w-100">
-           <a (click)="openDocumentsService.openDocument(document)" class="btn btn-sm btn-outline-secondary" title="Edit" *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }" i18n-title>
 -          <a routerLink="/documents/{{document.id}}" class="btn btn-sm btn-outline-secondary" title="Edit" i18n-title>
++          <a routerLink="/documents/{{document.id}}" class="btn btn-sm btn-outline-secondary" title="Edit" i18n-title *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }" i18n-title>
              <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-pencil" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                <path fill-rule="evenodd" d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5L13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175l-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"/>
              </svg>
index 583fde4eed6232600401930de960647c9ef6823c,8e6ae33a66284afeee4b3425796be31a379685c4..0aa7bd7586c3bef14de4a0f39629eeeb6ac53c22
@@@ -10,9 -11,7 +10,8 @@@ import { PaperlessDocument } from 'src/
  import { DocumentService } from 'src/app/services/rest/document.service'
  import { SettingsService } from 'src/app/services/settings.service'
  import { NgbPopover } from '@ng-bootstrap/ng-bootstrap'
- import { OpenDocumentsService } from 'src/app/services/open-documents.service'
  import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
 +import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component'
  
  @Component({
    selector: 'app-document-card-small',
      '../popover-preview/popover-preview.scss',
    ],
  })
 -export class DocumentCardSmallComponent implements OnInit {
 +export class DocumentCardSmallComponent extends ComponentWithPermissions {
    constructor(
      private documentService: DocumentService,
-     private settingsService: SettingsService,
-     public openDocumentsService: OpenDocumentsService
+     private settingsService: SettingsService
 -  ) {}
 +  ) {
 +    super()
 +  }
  
    @Input()
    selected = false
Simple merge
index 312e0115c557faf07eed7a683b63a777f8774487,7ff6e90d99300945dc440346220bd5bcdcd59126..a3ab7382f4126b2484e5f4155f396536f2b25a81
@@@ -256,10 -226,11 +256,12 @@@ class DocumentViewSet
              fields = fields_param.split(",")
          else:
              fields = None
+         truncate_content = self.request.query_params.get("truncate_content", "False")
          serializer_class = self.get_serializer_class()
 +        kwargs.setdefault("user", self.request.user)  # PassUserMixin
          kwargs.setdefault("context", self.get_serializer_context())
          kwargs.setdefault("fields", fields)
+         kwargs.setdefault("truncate_content", truncate_content.lower() in ["true", "1"])
          return serializer_class(*args, **kwargs)
  
      def update(self, request, *args, **kwargs):