mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Migrate frontend prefix to -pngx
This commit is contained in:
@@ -7,7 +7,7 @@ import { PermissionsService } from '../services/permissions.service'
|
||||
template: `
|
||||
<div>
|
||||
<button
|
||||
*appIfObjectPermissions="{
|
||||
*pngxIfObjectPermissions="{
|
||||
object: { id: 2, owner: user1 },
|
||||
action: 'view'
|
||||
}"
|
||||
|
@@ -14,12 +14,12 @@ import {
|
||||
} from '../services/permissions.service'
|
||||
|
||||
@Directive({
|
||||
selector: '[appIfObjectPermissions]',
|
||||
selector: '[pngxIfObjectPermissions]',
|
||||
})
|
||||
export class IfObjectPermissionsDirective implements OnInit, OnChanges {
|
||||
// The role the user must have
|
||||
@Input()
|
||||
appIfObjectPermissions: {
|
||||
pngxIfObjectPermissions: {
|
||||
object: ObjectWithPermissions
|
||||
action: PermissionAction
|
||||
}
|
||||
@@ -39,10 +39,10 @@ export class IfObjectPermissionsDirective implements OnInit, OnChanges {
|
||||
|
||||
public ngOnInit(): void {
|
||||
if (
|
||||
!this.appIfObjectPermissions?.object ||
|
||||
!this.pngxIfObjectPermissions?.object ||
|
||||
this.permissionsService.currentUserHasObjectPermissions(
|
||||
this.appIfObjectPermissions.action,
|
||||
this.appIfObjectPermissions.object
|
||||
this.pngxIfObjectPermissions.action,
|
||||
this.pngxIfObjectPermissions.object
|
||||
)
|
||||
) {
|
||||
if (!this.createdView)
|
||||
|
@@ -6,7 +6,7 @@ import { PermissionsService } from '../services/permissions.service'
|
||||
@Component({
|
||||
template: `
|
||||
<div>
|
||||
<button *appIfOwner="{ id: 2, owner: user1 }">Some Text</button>
|
||||
<button *pngxIfOwner="{ id: 2, owner: user1 }">Some Text</button>
|
||||
</div>
|
||||
`,
|
||||
})
|
||||
|
@@ -11,12 +11,12 @@ import { ObjectWithPermissions } from '../data/object-with-permissions'
|
||||
import { PermissionsService } from '../services/permissions.service'
|
||||
|
||||
@Directive({
|
||||
selector: '[appIfOwner]',
|
||||
selector: '[pngxIfOwner]',
|
||||
})
|
||||
export class IfOwnerDirective implements OnInit, OnChanges {
|
||||
// The role the user must have
|
||||
@Input()
|
||||
appIfOwner: ObjectWithPermissions
|
||||
pngxIfOwner: ObjectWithPermissions
|
||||
|
||||
createdView: EmbeddedViewRef<any>
|
||||
|
||||
@@ -32,7 +32,7 @@ export class IfOwnerDirective implements OnInit, OnChanges {
|
||||
) {}
|
||||
|
||||
public ngOnInit(): void {
|
||||
if (this.permissionsService.currentUserOwnsObject(this.appIfOwner)) {
|
||||
if (this.permissionsService.currentUserOwnsObject(this.pngxIfOwner)) {
|
||||
if (!this.createdView)
|
||||
this.createdView = this.viewContainerRef.createEmbeddedView(
|
||||
this.templateRef
|
||||
|
@@ -6,7 +6,7 @@ import { PermissionsService } from '../services/permissions.service'
|
||||
@Component({
|
||||
template: `
|
||||
<div>
|
||||
<button *appIfPermissions="{ action: 'add', type: '%s_user' }">
|
||||
<button *pngxIfPermissions="{ action: 'add', type: '%s_user' }">
|
||||
Some Text
|
||||
</button>
|
||||
</div>
|
||||
|
@@ -12,11 +12,11 @@ import {
|
||||
} from '../services/permissions.service'
|
||||
|
||||
@Directive({
|
||||
selector: '[appIfPermissions]',
|
||||
selector: '[pngxIfPermissions]',
|
||||
})
|
||||
export class IfPermissionsDirective implements OnInit {
|
||||
@Input()
|
||||
appIfPermissions:
|
||||
pngxIfPermissions:
|
||||
| Array<{ action: PermissionAction; type: PermissionType }>
|
||||
| { action: PermissionAction; type: PermissionType }
|
||||
|
||||
@@ -34,7 +34,7 @@ export class IfPermissionsDirective implements OnInit {
|
||||
public ngOnInit(): void {
|
||||
if (
|
||||
[]
|
||||
.concat(this.appIfPermissions)
|
||||
.concat(this.pngxIfPermissions)
|
||||
.every((perm: { action: PermissionAction; type: PermissionType }) =>
|
||||
this.permissionsService.currentUserCan(perm.action, perm.type)
|
||||
)
|
||||
|
@@ -8,10 +8,10 @@ import { By } from '@angular/platform-browser'
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th></th>
|
||||
<th class="d-none d-lg-table-cell" appSortable="archive_serial_number">
|
||||
<th class="d-none d-lg-table-cell" pngxSortable="archive_serial_number">
|
||||
ASN
|
||||
</th>
|
||||
<th class="d-none d-md-table-cell" appSortable="correspondent__name">
|
||||
<th class="d-none d-md-table-cell" pngxSortable="correspondent__name">
|
||||
Correspondent
|
||||
</th>
|
||||
</thead>
|
||||
|
@@ -13,13 +13,13 @@ export interface SortEvent {
|
||||
}
|
||||
|
||||
@Directive({
|
||||
selector: 'th[appSortable]',
|
||||
selector: 'th[pngxSortable]',
|
||||
})
|
||||
export class SortableDirective {
|
||||
constructor() {}
|
||||
|
||||
@Input()
|
||||
appSortable: string = ''
|
||||
pngxSortable: string = ''
|
||||
|
||||
@Input()
|
||||
currentSortReverse: boolean = false
|
||||
@@ -31,18 +31,20 @@ export class SortableDirective {
|
||||
|
||||
@HostBinding('class.asc') get asc() {
|
||||
return (
|
||||
this.currentSortField === this.appSortable && !this.currentSortReverse
|
||||
this.currentSortField === this.pngxSortable && !this.currentSortReverse
|
||||
)
|
||||
}
|
||||
@HostBinding('class.des') get des() {
|
||||
return this.currentSortField === this.appSortable && this.currentSortReverse
|
||||
return (
|
||||
this.currentSortField === this.pngxSortable && this.currentSortReverse
|
||||
)
|
||||
}
|
||||
|
||||
@HostListener('click') rotate() {
|
||||
if (this.currentSortField != this.appSortable) {
|
||||
this.sort.emit({ column: this.appSortable, reverse: false })
|
||||
if (this.currentSortField != this.pngxSortable) {
|
||||
this.sort.emit({ column: this.pngxSortable, reverse: false })
|
||||
} else if (
|
||||
this.currentSortField == this.appSortable &&
|
||||
this.currentSortField == this.pngxSortable &&
|
||||
!this.currentSortReverse
|
||||
) {
|
||||
this.sort.emit({ column: this.currentSortField, reverse: true })
|
||||
|
Reference in New Issue
Block a user