1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/gallery/gallery.component.ts
Braun Patrik f53c537a9d adding client side config
Implementing search disable
2016-05-10 21:33:58 +02:00

54 lines
1.8 KiB
TypeScript

///<reference path="../../browser.d.ts"/>
import {Component, OnInit} from "@angular/core";
import {AuthenticationService} from "../model/network/authentication.service.ts";
import {Router, RouteParams} from "@angular/router-deprecated";
import {GalleryService} from "./gallery.service";
import {GalleryDirectoryComponent} from "./directory/directory.gallery.component";
import {GalleryGridComponent} from "./grid/grid.gallery.component";
import {FrameComponent} from "../frame/frame.component";
import {GalleryLightboxComponent} from "./lightbox/lightbox.gallery.component";
import {GallerySearchComponent} from "./search/search.gallery.component";
import {Config} from "../config/Config";
@Component({
selector: 'gallery',
templateUrl: 'app/gallery/gallery.component.html',
styleUrls: ['app/gallery/gallery.component.css'],
directives: [GalleryGridComponent,
GalleryDirectoryComponent,
GalleryLightboxComponent,
FrameComponent,
GallerySearchComponent]
})
export class GalleryComponent implements OnInit {
public showSearchBar:boolean = true;
constructor(private _galleryService:GalleryService,
private _params:RouteParams,
private _authService:AuthenticationService,
private _router:Router) {
this.showSearchBar = Config.Client.Search.searchEnabled;
}
ngOnInit() {
if (!this._authService.isAuthenticated()) {
this._router.navigate(['Login']);
return;
}
let directoryName = this._params.get('directory');
console.log(this._params);
console.log(directoryName);
directoryName = directoryName ? directoryName : "";
this._galleryService.getDirectory(directoryName);
}
}