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

Adding directory flattening button #174

This commit is contained in:
Patrik J. Braun 2022-02-06 16:05:13 +01:00
parent a1de381caa
commit 4e848fdbed
6 changed files with 34 additions and 4 deletions

View File

@ -129,6 +129,8 @@ export class ClientOtherConfig {
captionFirstNaming: boolean = false; // shows the caption instead of the filename in the photo grid
@ConfigProperty()
enableDownloadZip: boolean = false;
@ConfigProperty({description: 'Adds a button to flattens the file structure, by listing the content of all subdirectories.'})
enableDirectoryFlattening: boolean = false;
}
@SubConfigClass()

View File

@ -23,14 +23,23 @@
</ng-container>
<ng-container *ngIf="config.Client.Other.enableDownloadZip && directory && ItemCount > 0">
<a *ngIf="config.Client.Other.enableDownloadZip && directory && ItemCount > 0"
[href]="getDownloadZipLink()"
<a [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>
<ng-container *ngIf="config.Client.Other.enableDirectoryFlattening && directory">
<a
[routerLink]="['/search', getDirectoryFlattenSearchQuery()]"
class="btn btn-download">
<span class="oi oi-fork"
title="Flatten directory" i18n-title></span>
</a>
<div class="divider">&nbsp;</div>
</ng-container>
<div class="btn-group" dropdown placement="bottom right">
<button id="button-alignment" dropdownToggle type="button"
class="btn btn-secondary dropdown-toggle"

View File

@ -9,7 +9,7 @@ import {Utils} from '../../../../../common/Utils';
import {SortingMethods} from '../../../../../common/entities/SortingMethods';
import {Config} from '../../../../../common/config/public/Config';
import {SearchResultDTO} from '../../../../../common/entities/SearchResultDTO';
import {SearchQueryTypes} from '../../../../../common/entities/SearchQueryDTO';
import {SearchQueryTypes, TextSearch, TextSearchQueryMatchTypes} from '../../../../../common/entities/SearchQueryDTO';
@Component({
selector: 'app-gallery-navbar',
@ -107,6 +107,13 @@ export class GalleryNavigatorComponent implements OnChanges {
return Utils.concatUrls(this.directory.path, this.directory.name);
}
getDirectoryFlattenSearchQuery(): string {
return JSON.stringify({
type: SearchQueryTypes.directory,
matchType: TextSearchQueryMatchTypes.like,
text: Utils.concatUrls('./', this.directory.path, this.directory.name)
} as TextSearch);
}
}
interface NavigatorPath {

View File

@ -118,6 +118,7 @@
</div>
</div>
<small class="form-text text-muted" *ngIf="description">{{description}}
<a *ngIf="link" [href]="link">{{linkText || link}}</a>
</small>
<ng-content></ng-content>
</div>

View File

@ -48,6 +48,8 @@ export class SettingsEntryComponent implements ControlValueAccessor, Validator,
@Input() simplifiedMode = false;
@Input() allowSpaces = false;
@Input() description: string;
@Input() link: string;
@Input() linkText: string;
@Input() typeOverride: 'searchQuery';
state: IState;
isNumberArray = false;

View File

@ -62,11 +62,20 @@
<app-settings-entry
name="Download Zip"
description="Enable download zip of a directory contents"
description="[Experimental: does not work for searches] Enable download zip of a directory contents"
i18n-description i18n-name
[ngModel]="states.Client.enableDownloadZip">
</app-settings-entry>
<app-settings-entry
name="Directory flattening"
description="[Experimental: won't work if the gallery multiple folders with the same path] Adds a button to flattens the file structure, by listing the content of all subdirectories."
link="https://github.com/bpatrik/pigallery2/issues/174"
linkText="See 174."
i18n-description i18n-name
[ngModel]="states.Client.enableDirectoryFlattening">
</app-settings-entry>
<hr/>