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
@ -8,7 +8,7 @@
|
||||
<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"
|
||||
<gallery-directory *ngFor="let directory of directories"
|
||||
[directory]="directory"></gallery-directory>
|
||||
|
||||
<gallery-map [photos]="_galleryService.content.directory.photos"></gallery-map>
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
<gallery-map [photos]="_galleryService.content.searchResult.photos"></gallery-map>
|
||||
|
||||
<div *ngFor="let directory of _galleryService.content.searchResult.directories">
|
||||
<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>
|
||||
|
@ -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