1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

Improving zip folder download link

This commit is contained in:
Patrik J. Braun 2021-05-08 09:06:56 +02:00
parent 18db27b418
commit f6fd2ccc02
3 changed files with 32 additions and 12 deletions

View File

@ -14,8 +14,13 @@
display: inline-block; display: inline-block;
} }
.divider{ .btn-download {
margin: 5px 10px; padding-left: 1px;
padding-right: 1px;
}
.divider {
margin: 5px 5px 5px 10px;
border-left: 1px solid #6c757d; border-left: 1px solid #6c757d;
display: inline-block; display: inline-block;
} }
@ -43,6 +48,6 @@ nav {
} }
.search-type{ .search-type {
margin-left: 5px; margin-left: 5px;
} }

View File

@ -15,13 +15,22 @@
</ol> </ol>
<div class="right-side"> <div class="right-side">
<a *ngIf="config.Client.Other.enableDownloadZip && directory && ItemCount > 0" [href]="getDownloadZipLink()" <ng-container *ngIf="ItemCount > 0 && config.Client.Other.NavBar.showItemCount">
[queryParams]="queryService.getParams()">Download</a> <div class="photos-count">
<div class="divider" *ngIf="directory && ItemCount > 0">&nbsp;</div>
<div class="photos-count" *ngIf="ItemCount > 0 && config.Client.Other.NavBar.showItemCount">
{{ItemCount}} <span i18n>items</span> {{ItemCount}} <span i18n>items</span>
</div> </div>
<div class="divider" *ngIf="ItemCount > 0 && config.Client.Other.NavBar.showItemCount">&nbsp;</div> <div class="divider">&nbsp;</div>
</ng-container>
<ng-container *ngIf="config.Client.Other.enableDownloadZip && directory && ItemCount > 0">
<a *ngIf="config.Client.Other.enableDownloadZip && directory && ItemCount > 0"
[href]="getDownloadZipLink()"
class="btn btn-download">
<span class="oi oi-data-transfer-download"
title="download" i18n-title></span>
</a>
<div class="divider">&nbsp;</div>
</ng-container>
<div class="btn-group" dropdown placement="bottom right"> <div class="btn-group" dropdown placement="bottom right">
<button id="button-alignment" dropdownToggle type="button" <button id="button-alignment" dropdownToggle type="button"
class="btn btn-secondary dropdown-toggle" class="btn btn-secondary dropdown-toggle"

View File

@ -1,7 +1,7 @@
import {Component, Input, OnChanges} from '@angular/core'; import {Component, Input, OnChanges} from '@angular/core';
import {DirectoryDTO} from '../../../../../common/entities/DirectoryDTO'; import {DirectoryDTO} from '../../../../../common/entities/DirectoryDTO';
import {RouterLink} from '@angular/router'; import {RouterLink} from '@angular/router';
import {UserDTO, UserDTOUtils} from '../../../../../common/entities/UserDTO'; import {UserDTOUtils} from '../../../../../common/entities/UserDTO';
import {AuthenticationService} from '../../../model/network/authentication.service'; import {AuthenticationService} from '../../../model/network/authentication.service';
import {QueryService} from '../../../model/query.service'; import {QueryService} from '../../../model/query.service';
import {GalleryService} from '../gallery.service'; import {GalleryService} from '../gallery.service';
@ -94,7 +94,13 @@ export class GalleryNavigatorComponent implements OnChanges {
} }
getDownloadZipLink(): string { getDownloadZipLink(): string {
return Utils.concatUrls(Config.Client.urlBase, '/api/gallery/zip/', this.getDirectoryPath()); let queryParams = '';
Object.entries(this.queryService.getParams()).forEach(e => {
queryParams += e[0] + '=' + e[1];
});
return Utils.concatUrls(Config.Client.urlBase,
'/api/gallery/zip/',
this.getDirectoryPath(), '?' + queryParams);
} }
getDirectoryPath(): string { getDirectoryPath(): string {