* code cleanup

This commit is contained in:
Danyi Dávid 2019-10-23 17:18:15 +02:00
parent 0d0ed38966
commit 9bd38ddaf5
17 changed files with 191 additions and 195 deletions

View File

@ -4,7 +4,7 @@ root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

View File

@ -1,4 +1,4 @@
import {trigger, state, animate, transition, style} from '@angular/animations';
import { trigger, state, animate, transition, style } from '@angular/animations';
export const fadeInAnimation =
trigger('fadeInAnimation', [

View File

@ -1,4 +1,4 @@
import {trigger, state, animate, transition, style} from '@angular/animations';
import { trigger, state, animate, transition, style } from '@angular/animations';
export const slideInOutAnimation =
trigger('slideInOutAnimation', [

View File

@ -13,4 +13,5 @@ import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader'
],
bootstrap: [AppComponent],
})
export class AppServerModule {}
export class AppServerModule {
}

View File

@ -1,7 +1,7 @@
<div class="main container">
<h1>
<a [routerLink]="['']" title="Back to albums list"><i class="fa fa-level-up"></i></a>
{{album.name}}
{{album?.name}}
<a rel="nofollow" [href]="exportUrl" title="Download compressed album"><i class="fa fa-download"></i></a>
</h1>
<div class="row images">

View File

@ -1,5 +1,4 @@
import { Component, EventEmitter, HostListener, OnInit, Output } from '@angular/core';
import { Location } from "@angular/common";
import { environment } from "../../../environments/environment";
import { Title } from "@angular/platform-browser";
@ -45,8 +44,7 @@ export class DisplayImageComponent implements OnInit {
}
public get imageUrl(): string {
let url = environment.apiUrl + `/image/${this.slug}/${this.image}`;
return url;
return environment.apiUrl + `/image/${this.slug}/${this.image}`;
}
public activate(slug = "", image = "", extitle = "") {

View File

@ -2,8 +2,5 @@ import { Injectable } from '@angular/core';
@Injectable()
export class DisplayImageService {
constructor() { }
activate: (message?: string, title?: string, extitle? :string) => Promise<boolean>;
activate: (message?: string, title?: string, extitle?: string) => Promise<boolean>;
}

View File

@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { GalleryComponent } from "./gallery/gallery.component";
import { GalleryService } from "./shared/gallery.service";
import { GalleryService } from "./shared";
import { AlbumComponent } from "./album/album.component";
import { DisplayImageComponent } from "./display-image/display-image.component";
@ -49,4 +49,5 @@ const routes: Routes = [
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class GalleryRoutingModule { }
export class GalleryRoutingModule {
}

View File

@ -24,6 +24,7 @@ import { ThumbnailComponent } from './thumbnail/thumbnail.component';
DisplayImageComponent,
ThumbnailComponent,
],
providers: [ GalleryService, DisplayImageService ]
providers: [GalleryService, DisplayImageService]
})
export class GalleryModule { }
export class GalleryModule {
}

View File

@ -30,6 +30,14 @@ export class GalleryComponent implements OnInit {
property: 'og:image',
content: this.imageUrl(this.albums[0])
});
this.metaService.updateTag({
property: 'og:title',
content: "photos.yvan.hu"
});
this.metaService.updateTag({
property: 'og:description',
content: "My public photo gallery"
});
});
}

View File

@ -7,7 +7,7 @@ import { environment } from "../../../environments/environment";
import { Album } from "./album.model";
@Injectable()
export class GalleryService implements Resolve<Array<Album>|false> {
export class GalleryService implements Resolve<Array<Album> | false> {
public albums: Array<Album> = [];
@ -24,12 +24,12 @@ export class GalleryService implements Resolve<Array<Album>|false> {
* @returns {Promise<Array<Album>>}
* @todo add some cache ttl to albums?
*/
public resolve(route: ActivatedRouteSnapshot): Promise<Array<Album>|false> {
if(this.albums.length) {
public resolve(route: ActivatedRouteSnapshot): Promise<Array<Album> | false> {
if (this.albums.length) {
return Promise.resolve(this.albums);
}
return this.listGalleries().toPromise().then(result => {
if(result) {
if (result) {
this.albums = result;
return result;
}

View File

@ -1,4 +1,4 @@
import {ThumbLabel} from "./thumb-label.model";
import { ThumbLabel } from "./thumb-label.model";
export class Thumbnail {
public slug: string = '';

View File

@ -1,22 +1,16 @@
import {Component, Input, OnInit} from '@angular/core';
import { Component, Input } from '@angular/core';
import {ThumbLabel} from "../shared/thumb-label.model";
import { ThumbLabel } from "../shared/thumb-label.model";
@Component({
selector: 'app-thumbnail, [app-thumbnail]',
templateUrl: './thumbnail.component.html',
styleUrls: ['./thumbnail.component.css']
})
export class ThumbnailComponent implements OnInit {
export class ThumbnailComponent {
@Input() image: string = "";
@Input() label: ThumbLabel = null;
@Input() target: any = {};
@Input() width: number = 0;
@Input() height: number = 0;
constructor() {}
ngOnInit() {}
}

View File

@ -4,10 +4,6 @@
<meta charset="utf-8">
<title>Gallery</title>
<base href="/">
<meta name="og:title" content="Angullery"/>
<meta name="og:description" content="A really simple photo album"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<link rel="icon" type="image/x-icon" href="favicon.ico">