Fixed issues with new badges

This commit is contained in:
lotte
2023-01-24 08:24:37 +01:00
parent 85562679a2
commit d7b38b2a78
4 changed files with 3 additions and 27 deletions

View File

@@ -2,6 +2,5 @@
[viewMode]="viewModes.ListElement" [viewMode]="viewModes.ListElement"
[index]="index" [index]="index"
[linkType]="linkType" [linkType]="linkType"
[listID]="listID" [listID]="listID"></ds-themed-listable-object-component-loader>
[hideBadges]="true"></ds-themed-listable-object-component-loader>
<ds-item-admin-search-result-actions-element [item]="dso" [small]="false"></ds-item-admin-search-result-actions-element> <ds-item-admin-search-result-actions-element [item]="dso" [small]="false"></ds-item-admin-search-result-actions-element>

View File

@@ -1,9 +1 @@
<div [ngClass]="{'d-none' : hideBadges}" #badges>
<div *ngIf="privateBadge" class="private-badge">
<span class="badge badge-danger">{{ "item.badge.private" | translate }}</span>
</div>
<div *ngIf="withdrawnBadge" class="withdrawn-badge">
<span class="badge badge-warning">{{ "item.badge.withdrawn" | translate }}</span>
</div>
</div>
<ng-template dsListableObject></ng-template> <ng-template dsListableObject></ng-template>

View File

@@ -74,22 +74,11 @@ export class ListableObjectComponentLoaderComponent implements OnInit, OnChanges
*/ */
@Input() value: string; @Input() value: string;
/**
* Whether or not informational badges (e.g. Private, Withdrawn) should be hidden
*/
@Input() hideBadges = false;
/** /**
* Directive hook used to place the dynamic child component * Directive hook used to place the dynamic child component
*/ */
@ViewChild(ListableObjectDirective, {static: true}) listableObjectDirective: ListableObjectDirective; @ViewChild(ListableObjectDirective, {static: true}) listableObjectDirective: ListableObjectDirective;
/**
* View on the badges template, to be passed on to the loaded component (which will place the badges in the desired
* location, or on top if not specified)
*/
@ViewChild('badges', { static: true }) badges: ElementRef;
/** /**
* Emit when the listable object has been reloaded. * Emit when the listable object has been reloaded.
*/ */
@@ -160,10 +149,7 @@ export class ListableObjectComponentLoaderComponent implements OnInit, OnChanges
this.compRef = viewContainerRef.createComponent( this.compRef = viewContainerRef.createComponent(
componentFactory, componentFactory,
0, 0,
undefined, undefined);
[
[this.badges.nativeElement],
]);
this.connectInputsAndOutputs(); this.connectInputsAndOutputs();

View File

@@ -16,7 +16,7 @@ import { CollectionElementLinkType } from '../../collection-element-link.type';
}) })
export class ThemedListableObjectComponentLoaderComponent extends ThemedComponent<ListableObjectComponentLoaderComponent> { export class ThemedListableObjectComponentLoaderComponent extends ThemedComponent<ListableObjectComponentLoaderComponent> {
protected inAndOutputNames: (keyof ListableObjectComponentLoaderComponent & keyof this)[] = [ protected inAndOutputNames: (keyof ListableObjectComponentLoaderComponent & keyof this)[] = [
'object', 'index', 'viewMode', 'context', 'linkType', 'listID', 'linkType', 'showLabel', 'value', 'hideBadges', 'contentChange']; 'object', 'index', 'viewMode', 'context', 'linkType', 'listID', 'linkType', 'showLabel', 'value', 'contentChange'];
@Input() object: ListableObject; @Input() object: ListableObject;
@Input() index: number; @Input() index: number;
@@ -26,7 +26,6 @@ export class ThemedListableObjectComponentLoaderComponent extends ThemedComponen
@Input() listID: string; @Input() listID: string;
@Input() showLabel = true; @Input() showLabel = true;
@Input() value: string; @Input() value: string;
@Input() hideBadges = false;
@Output() contentChange = new EventEmitter<ListableObject>(); @Output() contentChange = new EventEmitter<ListableObject>();
protected getComponentName(): string { protected getComponentName(): string {