Skip to content

Commit

Permalink
Merge pull request #12 from mlibrary/issue-working11
Browse files Browse the repository at this point in the history
improved file listing in search and other changes
  • Loading branch information
blancoj authored Nov 2, 2024
2 parents 73f7e00 + cddcd83 commit 87b6fdc
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 69 deletions.
8 changes: 7 additions & 1 deletion src/app/admin/admin-sidebar/admin-sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
*/
sidebarExpanded: Observable<boolean>;

inFocus$: BehaviorSubject<boolean>;
inFocus$: BehaviorSubject<boolean> = new BehaviorSubject(false);

constructor(
protected menuService: MenuService,
Expand All @@ -70,10 +70,16 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
ngOnInit(): void {
super.ngOnInit();
this.sidebarWidth = this.variableService.getVariable('--ds-sidebar-items-width');

// Ensure the menu is shown and expanded initially
this.menuService.showMenu(this.menuID); // Assuming 'showMenu' makes the menu visible but does not expand it
this.menuService.expandMenu(this.menuID); // Expanding the menu initially

this.authService.isAuthenticated()
.subscribe((loggedIn: boolean) => {
if (loggedIn) {
this.menuService.showMenu(this.menuID);
this.menuService.expandMenu(this.menuID); // Ensuring it's expanded when authenticated

Check failure on line 82 in src/app/admin/admin-sidebar/admin-sidebar.component.ts

View workflow job for this annotation

GitHub Actions / tests (16.x)

Trailing spaces not allowed

Check failure on line 82 in src/app/admin/admin-sidebar/admin-sidebar.component.ts

View workflow job for this annotation

GitHub Actions / tests (18.x)

Trailing spaces not allowed
}
});
this.menuCollapsed.pipe(first())
Expand Down
70 changes: 30 additions & 40 deletions src/app/shared/listfiles/listfiles.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,49 @@
<div *ngIf="!item.isWithdrawn">


<ng-container *ngVar="(bitstreams$ | async) as bitstreams">
<ng-container *ngVar="(bitstreams$ | async) as bitstreams">
<ds-metadata-field-wrapper *ngIf="bitstreams?.length > 0" [label]="">

<div class="row">
<div class="col-md-12 ml-4">

<ds-metadata-field-wrapper *ngIf="bitstreams?.length > 0" [label]="">
<!-- To remove Files from display on the
<ds-metadata-field-wrapper *ngIf="bitstreams?.length > 0" [label]="label | translate">
-->
<div class="file-section" *ngFor="let file of bitstreams; let last=last;">
<span style="white-space: nowrap;" class="file-section pr-3" *ngFor="let file of bitstreams; let last=last;">

<ds-themed-file-download-link [bitstream]="file" [item]="item">
<span style="text-decoration:none;width:20px; display: inline-block; margin-right: 3px;" [innerHtml]="dsoNameService.getIconForFile(file)"></span>

<div class="row">
<div class="col-md-6">
<span style="text-decoration:none;width:20px; display: inline-block; margin-right: 10px;" [innerHtml]="dsoNameService.getIconForFile(file)"></span>

<ng-container *ngIf="getIconForRequestCopy(item.firstMetadataValue('dc.requestcopy.email')) != ''">
<span style="text-decoration:none;width:20px; display: inline-block; margin-right: 3px;" [innerHtml]="getIconForRequestCopy(item.firstMetadataValue('dc.requestcopy.email'))"></span>
</ng-container>

<ds-themed-file-download-link [bitstream]="file" [item]="item">
<span>{{ dsoNameService.getName(file) }}</span>
</ds-themed-file-download-link>
<ng-container *ngIf="getIconForFileRestriction(file.firstMetadataValue('dc.description')) != ''">
<span style="text-decoration:none;width:20px; display: inline-block; margin-right: 3px;" [innerHtml]="getIconForFileRestriction(file.firstMetadataValue('dc.description'))"></span>
</ng-container>

<span> ({{(file?.sizeBytes) | dsFileSize }})</span>
</ds-themed-file-download-link>

<!-- <span *ngIf="!last" innerHTML="{{separator}}"></span> -->
<!-- For a hidden file -->
<div *ngIf="file?.formatId == this.formatId">
THIS IS A HIDDEN FILE
</div>

<span style="font-size:12px; vertical-align:sub"> ({{(file?.sizeBytes) | dsFileSize }})</span>

</div>
<div class="col-md-6">

<ng-container *ngIf="getIconForRequestCopy(item.firstMetadataValue('dc.requestcopy.email')) != ''">
<span style="text-decoration:none;width:20px; display: inline-block; margin-right: 10px;" [innerHtml]="getIconForRequestCopy(item.firstMetadataValue('dc.requestcopy.email'))"></span>Click file name to request access from the owner
</ng-container>
</span>

<ng-container *ngIf="getIconForFileRestriction(file.firstMetadataValue('dc.description')) != ''">
<span style="text-decoration:none;width:20px; display: inline-block; margin-right: 10px;" [innerHtml]="getIconForFileRestriction(file.firstMetadataValue('dc.description'))"></span>
</ng-container>
</div>

<!-- For a hidden file -->
<div *ngIf="file?.formatId == this.formatId">
THIS IS A HIDDEN FILE
</div>
{{file.firstMetadataValue('dc.description')}}
</div>
</div>
</div>
<!-- </div> -->

</div>
<!-- </div> -->

<ds-themed-loading *ngIf="isLoading" message="{{'loading.default' | translate}}" [showMessage]="false"></ds-themed-loading>
<div *ngIf="!isLastPage" class="mt-1" id="view-more">
<button class="bitstream-view-more btn btn-outline-secondary btn-sm" (click)="getNextPageDisplay()">{{'item.page.bitstreams.view-more' | translate}}</button>
</div>
<div *ngIf="isLastPage && currentPage != 1" class="mt-1" id="collapse">
<button class="bitstream-collapse btn btn-outline-secondary btn-sm" (click)="currentPage = undefined; getNextPageDisplay();">{{'item.page.bitstreams.collapse' | translate}}</button>
</div>
<ds-themed-loading *ngIf="isLoading" message="{{'loading.default' | translate}}" [showMessage]="false"></ds-themed-loading>
<div *ngIf="!isLastPage" class="mt-1" id="view-more">
<button class="bitstream-view-more btn btn-outline-secondary btn-sm" (click)="getNextPageDisplay()">{{'item.page.bitstreams.view-more' | translate}}</button>
</div>
<div *ngIf="isLastPage && currentPage != 1" class="mt-1" id="collapse">
<button class="bitstream-collapse btn btn-outline-secondary btn-sm" (click)="currentPage = undefined; getNextPageDisplay();">{{'item.page.bitstreams.collapse' | translate}}</button>
</div>


</ds-metadata-field-wrapper>
Expand Down
7 changes: 5 additions & 2 deletions src/app/shared/listfiles/listfiles.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export class ListfilesComponent implements OnInit {
public dsoNameService: DSONameService,
@Inject(APP_CONFIG) protected appConfig: AppConfig
) {
this.pageSize = this.appConfig.item.bitstream.pageSize;
//this.pageSize = this.appConfig.item.bitstream.pageSize;
// Just going to hardcode it to 1000
this.pageSize = 1000;

}

ngOnInit(): void {
Expand Down Expand Up @@ -143,4 +146,4 @@ export class ListfilesComponent implements OnInit {
});
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,55 @@
</div>
-->

<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
<div class="d-flex">
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context" [showAccessStatus]="true"></ds-themed-badges>
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
<div class="d-flex">
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context" [showAccessStatus]="true"></ds-themed-badges>
</div>

<ds-truncatable [id]="dso.id" *ngIf="object !== undefined && object !== null">
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" [attr.rel]="(linkType == linkTypes.ExternalLink) ? 'noopener noreferrer' : null"
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out"
[innerHTML]="dsoTitle"></a>
<span *ngIf="linkType == linkTypes.None" class="lead item-list-title dont-break-out"
[innerHTML]="dsoTitle"></span>

<div>
<ng-container *ngIf="dso.firstMetadataValue('dc.publisher') || dso.firstMetadataValue('dc.date.issued')">
(<span *ngIf="dso.firstMetadataValue('dc.date.issued')" class="item-list-date" [innerHTML]="firstMetadataValue('dc.date.issued')"></span>)
</ng-container>
</div>

<ds-truncatable [id]="dso.id" *ngIf="object !== undefined && object !== null">
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" [attr.rel]="(linkType == linkTypes.ExternalLink) ? 'noopener noreferrer' : null"
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out"
[innerHTML]="dsoTitle"></a>
<span *ngIf="linkType == linkTypes.None" class="lead item-list-title dont-break-out"
[innerHTML]="dsoTitle"></span>
<span class="text-muted">
<ds-truncatable-part [id]="dso.id" [minLines]="1">
<span class="text-muted">
<ds-truncatable-part [id]="dso.id" [minLines]="1">

<span *ngIf="dso.allMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0" class="item-list-authors">
<span *ngIf="dso.allMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0" class="item-list-authors">
<span *ngIf="allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length <= 3">
<span *ngFor="let author of allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">
<span [innerHTML]="author"><span [innerHTML]="author"></span></span>
<span *ngIf="!last">; </span>
<span [innerHTML]="author"></span>
<span *ngIf="!last">; </span>
</span>
</span>
<span *ngIf="allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 3">
<span *ngFor="let author of allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).slice(0,3); let last=last;">
<span [innerHTML]="author"></span>
<span *ngIf="!last">; </span>
</span>
<span>; et. al.</span>
</span>
</span>

<ng-container *ngIf="dso.firstMetadataValue('dc.publisher') || dso.firstMetadataValue('dc.date.issued')">
(<span *ngIf="dso.firstMetadataValue('dc.date.issued')" class="item-list-date" [innerHTML]="firstMetadataValue('dc.date.issued')"></span>)
</ng-container>

</ds-truncatable-part>
</span>
</ds-truncatable-part>
</span>

<ds-listfiles [item]="dso"></ds-listfiles>
<ds-listfiles [item]="dso"></ds-listfiles>

<!-- No need for abstract in search result page
<div *ngIf="dso.firstMetadataValue('dc.description.abstract')" class="item-list-abstract">
<ds-truncatable-part [id]="dso.id" [minLines]="3"><span
[innerHTML]="firstMetadataValue('dc.description.abstract')"></span>
</ds-truncatable-part>
</div>
-->
</ds-truncatable>
</div>
-->
</ds-truncatable>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
(changeViewMode)="changeViewMode.emit($event)"></ds-view-mode-switch>
-->
<div class="sidebar-content">
<!-- Move setting search box to the top -->
<ds-themed-search-settings [currentSortOption]="currentSortOption"
[sortOptionsList]="sortOptionsList"></ds-themed-search-settings>
<ds-search-switch-configuration *ngIf="configurationList"
[configurationList]="configurationList"
[defaultConfiguration]="configuration"
Expand All @@ -24,8 +27,6 @@
[filters]="filters"
[refreshFilters]="refreshFilters"
[inPlaceSearch]="inPlaceSearch"></ds-themed-search-filters>
<ds-themed-search-settings [currentSortOption]="currentSortOption"
[sortOptionsList]="sortOptionsList"></ds-themed-search-settings>
</div>
</div>
</div>

0 comments on commit 87b6fdc

Please sign in to comment.