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 7, 2020
1 parent b4aa8d6 commit 949846c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<div class="col-sm-2" translate>Call number</div>
</div>
<admin-default-holding-item
*ngFor="let item of items"
*ngFor="let item of items | slice:0: displayItemsCounter"
class="row mt-1"
[holding]="holding"
[item]="item"
Expand Down
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 949846c

Please sign in to comment.