mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
order directories by name
This commit is contained in:
parent
e8d96ea700
commit
5d42e0c23a
@ -1,39 +1,39 @@
|
||||
<gallery-lightbox #lightbox (onLastElement)="onLightboxLastElement()"></gallery-lightbox>
|
||||
<app-frame>
|
||||
|
||||
<div navbar>
|
||||
<gallery-search #search *ngIf="showSearchBar"></gallery-search>
|
||||
</div>
|
||||
<div navbar>
|
||||
<gallery-search #search *ngIf="showSearchBar"></gallery-search>
|
||||
</div>
|
||||
|
||||
<div body class="container" style="width: 100%; padding:0" *ngIf="_galleryService.content.directory">
|
||||
<gallery-navbar [directory]="_galleryService.content.directory"></gallery-navbar>
|
||||
<div body class="container" style="width: 100%; padding:0" *ngIf="_galleryService.content.directory">
|
||||
<gallery-navbar [directory]="_galleryService.content.directory"></gallery-navbar>
|
||||
|
||||
<gallery-directory *ngFor="let directory of _galleryService.content.directory.directories"
|
||||
[directory]="directory"></gallery-directory>
|
||||
<gallery-directory *ngFor="let directory of directories"
|
||||
[directory]="directory"></gallery-directory>
|
||||
|
||||
<gallery-map [photos]="_galleryService.content.directory.photos"></gallery-map>
|
||||
<gallery-grid [photos]="_galleryService.content.directory.photos" [lightbox]="lightbox"></gallery-grid>
|
||||
</div>
|
||||
<gallery-map [photos]="_galleryService.content.directory.photos"></gallery-map>
|
||||
<gallery-grid [photos]="_galleryService.content.directory.photos" [lightbox]="lightbox"></gallery-grid>
|
||||
</div>
|
||||
|
||||
<div body class="container" style="width: 100%; padding:0" *ngIf="_galleryService.content.searchResult">
|
||||
<ol class="breadcrumb">
|
||||
<li class="active">
|
||||
Searching for:
|
||||
<span [ngSwitch]="_galleryService.content.searchResult.searchType">
|
||||
<div body class="container" style="width: 100%; padding:0" *ngIf="_galleryService.content.searchResult">
|
||||
<ol class="breadcrumb">
|
||||
<li class="active">
|
||||
Searching for:
|
||||
<span [ngSwitch]="_galleryService.content.searchResult.searchType">
|
||||
<span *ngSwitchCase="0" class="glyphicon glyphicon-picture"></span>
|
||||
<span *ngSwitchCase="1" class="glyphicon glyphicon-folder-open"></span>
|
||||
<span *ngSwitchCase="2" class="glyphicon glyphicon-tag"></span>
|
||||
<span *ngSwitchCase="3" class="glyphicon glyphicon-map-marker"></span>
|
||||
</span>
|
||||
<strong>{{_galleryService.content.searchResult.searchText}}</strong>
|
||||
</li>
|
||||
</ol>
|
||||
<strong>{{_galleryService.content.searchResult.searchText}}</strong>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<gallery-map [photos]="_galleryService.content.searchResult.photos"></gallery-map>
|
||||
<gallery-map [photos]="_galleryService.content.searchResult.photos"></gallery-map>
|
||||
|
||||
<div *ngFor="let directory of _galleryService.content.searchResult.directories">
|
||||
<gallery-directory *ngIf="directory" [directory]="directory"></gallery-directory>
|
||||
</div>
|
||||
<gallery-grid [photos]="_galleryService.content.searchResult.photos" [lightbox]="lightbox"></gallery-grid>
|
||||
<div *ngFor="let directory of directories">
|
||||
<gallery-directory *ngIf="directory" [directory]="directory"></gallery-directory>
|
||||
</div>
|
||||
<gallery-grid [photos]="_galleryService.content.searchResult.photos" [lightbox]="lightbox"></gallery-grid>
|
||||
</div>
|
||||
</app-frame>
|
||||
|
@ -6,6 +6,7 @@ import {GalleryGridComponent} from "./grid/grid.gallery.component";
|
||||
import {GallerySearchComponent} from "./search/search.gallery.component";
|
||||
import {SearchTypes} from "../../../common/entities/AutoCompleteItem";
|
||||
import {Config} from "../../../common/config/public/Config";
|
||||
import {DirectoryDTO} from "../../../common/entities/DirectoryDTO";
|
||||
|
||||
@Component({
|
||||
selector: 'gallery',
|
||||
@ -18,6 +19,7 @@ export class GalleryComponent implements OnInit {
|
||||
@ViewChild(GalleryGridComponent) grid: GalleryGridComponent;
|
||||
|
||||
public showSearchBar: boolean = true;
|
||||
public directories: DirectoryDTO[] = [];
|
||||
|
||||
constructor(public _galleryService: GalleryService,
|
||||
private _authService: AuthenticationService,
|
||||
@ -33,8 +35,12 @@ export class GalleryComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
|
||||
const dirSorter = (a: DirectoryDTO, b: DirectoryDTO) => {
|
||||
return a.name.localeCompare(b.name);
|
||||
};
|
||||
|
||||
this._route.params
|
||||
.subscribe((params: Params) => {
|
||||
.subscribe(async (params: Params) => {
|
||||
let searchText = params['searchText'];
|
||||
if (searchText && searchText != "") {
|
||||
console.log("searching");
|
||||
@ -43,11 +49,13 @@ export class GalleryComponent implements OnInit {
|
||||
if (typeString && typeString != "") {
|
||||
console.log("with type");
|
||||
let type: SearchTypes = <any>SearchTypes[typeString];
|
||||
this._galleryService.search(searchText, type);
|
||||
await this._galleryService.search(searchText, type);
|
||||
this.directories = this._galleryService.content.searchResult.directories.sort(dirSorter);
|
||||
return;
|
||||
}
|
||||
|
||||
this._galleryService.search(searchText);
|
||||
await this._galleryService.search(searchText);
|
||||
this.directories = this._galleryService.content.searchResult.directories.sort(dirSorter);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -55,7 +63,8 @@ export class GalleryComponent implements OnInit {
|
||||
let directoryName = params['directory'];
|
||||
directoryName = directoryName ? directoryName : "";
|
||||
|
||||
this._galleryService.getDirectory(directoryName);
|
||||
await this._galleryService.getDirectory(directoryName);
|
||||
this.directories = this._galleryService.content.directory.directories.sort(dirSorter);
|
||||
|
||||
});
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pigallery2",
|
||||
"version": "1.0.0-beta.0.1",
|
||||
"version": "1.0.0-beta.1",
|
||||
"description": "This is a photo gallery optimised for running low resource servers (especially on raspberry pi)",
|
||||
"author": "Patrik J. Braun",
|
||||
"homepage": "https://github.com/bpatrik/PiGallery2",
|
||||
|
Loading…
Reference in New Issue
Block a user