Skip to content

Commit

Permalink
holding: fix holding display problem.
Browse files Browse the repository at this point in the history
If a document is a serial or electronic, all linked holdings was force
to be displayed as serial/electronic. This PR fix this problem ; despite
of the document metadata, the holding is display depending of the
holding_type metadata from the holding.

Closes rero/rero-ils#1252

Co-Authored-by: Renaud Michotte <[email protected]>
  • Loading branch information
zannkukai committed Oct 1, 2020
1 parent e2986d6 commit f55935f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export class HoldingComponent implements OnInit, OnDestroy {
/** Holding record */
@Input() holding: any;

/** Document harvested */
@Input() holdingType: 'electronic' | 'serial' | 'standard';
/** shortcut for holding type */
holdingType: 'electronic' | 'serial' | 'standard';

/** Items */
items: any = null;
Expand Down Expand Up @@ -70,6 +70,7 @@ export class HoldingComponent implements OnInit, OnDestroy {

/** Init */
ngOnInit() {
this.holdingType = this.holding.metadata.holdings_type;
if (this.holdingType !== 'electronic') {
this._loadItems();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,20 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

<div class="row" *ngIf="canAdd">
<div class="col" [ngSwitch]="holdingType">
<a *ngSwitchCase="'standard'" class="btn btn-sm btn-outline-primary mt-2 float-right"
[routerLink]="['/', 'records', 'items', 'new']" [queryParams]="{ document: documentPid }">
<i class="fa fa-plus-square-o"></i> {{ 'Add' | translate }}...
</a>
<a *ngSwitchCase="'serial'" class="btn btn-sm btn-outline-primary float-right"
[routerLink]="['/', 'records', 'holdings', 'new']" [queryParams]="{ document: documentPid }">
<i class="fa fa-plus-square-o"></i> {{ 'Add' | translate }}...
</a>
</div>
<div class="row" *ngIf="canAdd">
<div class="col" [ngSwitch]="holdingType">
<a *ngSwitchCase="'standard'" class="btn btn-sm btn-outline-primary mt-2 float-right"
[routerLink]="['/', 'records', 'items', 'new']" [queryParams]="{ document: documentPid }">
<i class="fa fa-plus-square-o"></i> {{ 'Add' | translate }}...
</a>
<a *ngSwitchCase="'serial'" class="btn btn-sm btn-outline-primary float-right"
[routerLink]="['/', 'records', 'holdings', 'new']" [queryParams]="{ document: documentPid }">
<i class="fa fa-plus-square-o"></i> {{ 'Add' | translate }}...
</a>
</div>
</div>

<ng-container *ngIf="holdings">
<admin-document-holding *ngFor="let holding of holdings" [holding]="holding" [holdingType]="holdingType"
(deleteHolding)="deleteHolding($event)">
<admin-document-holding *ngFor="let holding of holdings" [holding]="holding" (deleteHolding)="deleteHolding($event)">
</admin-document-holding>
</ng-container>

0 comments on commit f55935f

Please sign in to comment.