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;
console.log()
if (req.query.type) {
type = parseInt(req.query.type);
}

View File

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

View File

@ -40,7 +40,7 @@ export class GalleryService {
return Promise.resolve(new Message(null, null));
}
let queryString = "/gallery/search/" + text;
let queryString = "/search/" + text;
if (type) {
queryString += "?type=" + type;
}
@ -72,7 +72,7 @@ export class GalleryService {
this.searchId = null;
}, 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>) => {
if (!message.error && message.result) {
this.content = message.result;

View File

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

View File

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

View File

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