1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

disabling search at photos

This commit is contained in:
Braun Patrik 2016-05-16 19:36:04 +02:00
parent ad3d6911bd
commit 540df6c6a8
6 changed files with 20 additions and 13 deletions

View File

@ -72,7 +72,6 @@ export class GalleryMWs {
} }
let type:SearchTypes; let type:SearchTypes;
console.log()
if (req.query.type) { if (req.query.type) {
type = parseInt(req.query.type); type = parseInt(req.query.type);
} }

View File

@ -44,15 +44,15 @@ export class GalleryRouter {
}; };
private addSearch() { private addSearch() {
this.app.get("/api/gallery/search/:text", this.app.get("/api/search/:text",
// AuthenticationMWs.authenticate, AuthenticationMWs.authenticate,
GalleryMWs.search, GalleryMWs.search,
RenderingMWs.renderResult RenderingMWs.renderResult
); );
}; };
private addInstantSearch() { private addInstantSearch() {
this.app.get("/api/gallery/instant-search/:text", this.app.get("/api/instant-search/:text",
AuthenticationMWs.authenticate, AuthenticationMWs.authenticate,
GalleryMWs.instantSearch, GalleryMWs.instantSearch,
RenderingMWs.renderResult RenderingMWs.renderResult
@ -60,7 +60,7 @@ export class GalleryRouter {
}; };
private addAutoComplete() { private addAutoComplete() {
this.app.get("/api/gallery/autocomplete/:text", this.app.get("/api/autocomplete/:text",
AuthenticationMWs.authenticate, AuthenticationMWs.authenticate,
GalleryMWs.autocomplete, GalleryMWs.autocomplete,
RenderingMWs.renderResult RenderingMWs.renderResult

View File

@ -40,7 +40,7 @@ export class GalleryService {
return Promise.resolve(new Message(null, null)); return Promise.resolve(new Message(null, null));
} }
let queryString = "/gallery/search/" + text; let queryString = "/search/" + text;
if (type) { if (type) {
queryString += "?type=" + type; queryString += "?type=" + type;
} }
@ -72,7 +72,7 @@ export class GalleryService {
this.searchId = null; this.searchId = null;
}, 3000); //TODO: set timeout to config }, 3000); //TODO: set timeout to config
return this._networkService.getJson("/gallery/instant-search/" + text).then( return this._networkService.getJson("/instant-search/" + text).then(
(message:Message<ContentWrapper>) => { (message:Message<ContentWrapper>) => {
if (!message.error && message.result) { if (!message.error && message.result) {
this.content = message.result; this.content = message.result;

View File

@ -5,16 +5,21 @@
<div class="photo-position" *ngIf="gridPhoto.photo.metadata.positionData"> <div class="photo-position" *ngIf="gridPhoto.photo.metadata.positionData">
<span class="glyphicon glyphicon-map-marker"></span> <span class="glyphicon glyphicon-map-marker"></span>
<template [ngIf]="getPositionText()">
<a [routerLink]="['Search',{searchText: getPositionText(), type:SearchTypes[SearchTypes.position]}]" <a [routerLink]="['Search',{searchText: getPositionText(), type:SearchTypes[SearchTypes.position]}]"
*ngIf="getPositionText()"> *ngIf="searchEnabled">
{{getPositionText()}} {{getPositionText()}}
</a> </a>
<span *ngIf="!searchEnabled">{{getPositionText()}}</span>
</template>
</div> </div>
<div class="photo-keywords"> <div class="photo-keywords">
<template ngFor let-keyword [ngForOf]="gridPhoto.photo.metadata.keywords" let-last="last"> <template ngFor let-keyword [ngForOf]="gridPhoto.photo.metadata.keywords" let-last="last">
<a [routerLink]="['Search',{searchText: keyword, type: SearchTypes[SearchTypes.keyword]}]">#{{keyword}}</a> <a *ngIf="searchEnabled"
[routerLink]="['Search',{searchText: keyword, type: SearchTypes[SearchTypes.keyword]}]">#{{keyword}}</a>
<span *ngIf="!searchEnabled">#{{keyword}}</span>
<template [ngIf]="!last">,</template> <template [ngIf]="!last">,</template>
</template> </template>

View File

@ -5,6 +5,7 @@ import {IRenderable, Dimension} from "../../../model/IRenderable";
import {GridPhoto} from "../GridPhoto"; import {GridPhoto} from "../GridPhoto";
import {SearchTypes} from "../../../../../common/entities/AutoCompleteItem"; import {SearchTypes} from "../../../../../common/entities/AutoCompleteItem";
import {RouterLink} from "@angular/router-deprecated"; import {RouterLink} from "@angular/router-deprecated";
import {Config} from "../../../config/Config";
@Component({ @Component({
selector: 'gallery-grid-photo', selector: 'gallery-grid-photo',
@ -22,9 +23,11 @@ export class GalleryPhotoComponent implements IRenderable {
background: "" background: ""
}; };
SearchTypes:any = []; SearchTypes:any = [];
searchEnabled:boolean = true;
constructor() { constructor() {
this.SearchTypes = SearchTypes; this.SearchTypes = SearchTypes;
this.searchEnabled = Config.Client.Search.searchEnabled;
} }
getPositionText():string { getPositionText():string {

View File

@ -13,7 +13,7 @@ export class AutoCompleteService {
} }
public autoComplete(text:string):Promise<Message<Array<AutoCompleteItem> >> { public autoComplete(text:string):Promise<Message<Array<AutoCompleteItem> >> {
return this._networkService.getJson("/gallery/autocomplete/" + text); return this._networkService.getJson("/autocomplete/" + text);
} }