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:
parent
a1de381caa
commit
4e848fdbed
@ -129,6 +129,8 @@ export class ClientOtherConfig {
|
|||||||
captionFirstNaming: boolean = false; // shows the caption instead of the filename in the photo grid
|
captionFirstNaming: boolean = false; // shows the caption instead of the filename in the photo grid
|
||||||
@ConfigProperty()
|
@ConfigProperty()
|
||||||
enableDownloadZip: boolean = false;
|
enableDownloadZip: boolean = false;
|
||||||
|
@ConfigProperty({description: 'Adds a button to flattens the file structure, by listing the content of all subdirectories.'})
|
||||||
|
enableDirectoryFlattening: boolean = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubConfigClass()
|
@SubConfigClass()
|
||||||
|
@ -23,14 +23,23 @@
|
|||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container *ngIf="config.Client.Other.enableDownloadZip && directory && ItemCount > 0">
|
<ng-container *ngIf="config.Client.Other.enableDownloadZip && directory && ItemCount > 0">
|
||||||
<a *ngIf="config.Client.Other.enableDownloadZip && directory && ItemCount > 0"
|
<a [href]="getDownloadZipLink()"
|
||||||
[href]="getDownloadZipLink()"
|
|
||||||
class="btn btn-download">
|
class="btn btn-download">
|
||||||
<span class="oi oi-data-transfer-download"
|
<span class="oi oi-data-transfer-download"
|
||||||
title="download" i18n-title></span>
|
title="download" i18n-title></span>
|
||||||
</a>
|
</a>
|
||||||
<div class="divider"> </div>
|
<div class="divider"> </div>
|
||||||
</ng-container>
|
</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"> </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"
|
||||||
|
@ -9,7 +9,7 @@ import {Utils} from '../../../../../common/Utils';
|
|||||||
import {SortingMethods} from '../../../../../common/entities/SortingMethods';
|
import {SortingMethods} from '../../../../../common/entities/SortingMethods';
|
||||||
import {Config} from '../../../../../common/config/public/Config';
|
import {Config} from '../../../../../common/config/public/Config';
|
||||||
import {SearchResultDTO} from '../../../../../common/entities/SearchResultDTO';
|
import {SearchResultDTO} from '../../../../../common/entities/SearchResultDTO';
|
||||||
import {SearchQueryTypes} from '../../../../../common/entities/SearchQueryDTO';
|
import {SearchQueryTypes, TextSearch, TextSearchQueryMatchTypes} from '../../../../../common/entities/SearchQueryDTO';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-gallery-navbar',
|
selector: 'app-gallery-navbar',
|
||||||
@ -107,6 +107,13 @@ export class GalleryNavigatorComponent implements OnChanges {
|
|||||||
return Utils.concatUrls(this.directory.path, this.directory.name);
|
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 {
|
interface NavigatorPath {
|
||||||
|
@ -118,6 +118,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<small class="form-text text-muted" *ngIf="description">{{description}}
|
<small class="form-text text-muted" *ngIf="description">{{description}}
|
||||||
|
<a *ngIf="link" [href]="link">{{linkText || link}}</a>
|
||||||
</small>
|
</small>
|
||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
</div>
|
</div>
|
||||||
|
@ -48,6 +48,8 @@ export class SettingsEntryComponent implements ControlValueAccessor, Validator,
|
|||||||
@Input() simplifiedMode = false;
|
@Input() simplifiedMode = false;
|
||||||
@Input() allowSpaces = false;
|
@Input() allowSpaces = false;
|
||||||
@Input() description: string;
|
@Input() description: string;
|
||||||
|
@Input() link: string;
|
||||||
|
@Input() linkText: string;
|
||||||
@Input() typeOverride: 'searchQuery';
|
@Input() typeOverride: 'searchQuery';
|
||||||
state: IState;
|
state: IState;
|
||||||
isNumberArray = false;
|
isNumberArray = false;
|
||||||
|
@ -62,11 +62,20 @@
|
|||||||
|
|
||||||
<app-settings-entry
|
<app-settings-entry
|
||||||
name="Download Zip"
|
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
|
i18n-description i18n-name
|
||||||
[ngModel]="states.Client.enableDownloadZip">
|
[ngModel]="states.Client.enableDownloadZip">
|
||||||
</app-settings-entry>
|
</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/>
|
<hr/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user