1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-23 01:27:14 +02:00
pigallery2/frontend/app/gallery/directory/directory.gallery.component.ts

36 lines
999 B
TypeScript
Raw Normal View History

2017-03-18 01:11:53 +02:00
import {Component, Input, OnChanges} from "@angular/core";
2016-12-27 21:55:51 +02:00
import {DirectoryDTO} from "../../../../common/entities/DirectoryDTO";
2016-12-27 00:36:38 +02:00
import {RouterLink} from "@angular/router";
2016-03-26 20:24:12 +02:00
import {Utils} from "../../../../common/Utils";
2017-03-18 01:11:53 +02:00
import {Photo} from "../Photo";
2016-03-20 21:05:51 +02:00
@Component({
selector: 'gallery-directory',
2016-03-26 17:25:48 +02:00
templateUrl: 'app/gallery/directory/directory.gallery.component.html',
2017-03-18 01:11:53 +02:00
styleUrls: ['app/gallery/directory/directory.gallery.component.css'],
2016-12-27 00:36:38 +02:00
providers: [RouterLink],
2016-03-20 21:05:51 +02:00
})
2017-03-18 01:11:53 +02:00
export class GalleryDirectoryComponent implements OnChanges {
2016-12-27 21:55:51 +02:00
@Input() directory: DirectoryDTO;
2017-03-18 01:11:53 +02:00
photo: Photo = null;
2016-05-09 17:04:56 +02:00
2016-03-20 21:05:51 +02:00
constructor() {
}
2017-03-18 01:11:53 +02:00
ngOnChanges() {
setImmediate(() => {
if (this.directory.photos.length > 0) {
this.photo = new Photo(this.directory.photos[0], 100, 100);
console.log(this.photo);
}
});
}
2016-05-09 17:04:56 +02:00
getDirectoryPath() {
return Utils.concatUrls(this.directory.path, this.directory.name);
2016-03-26 20:24:12 +02:00
}
2016-05-09 17:04:56 +02:00
2016-03-20 21:05:51 +02:00
}