Hide edit buttons when not logged in, css tweaks

This commit is contained in:
Pieter Vander Vennet 2020-07-13 16:18:04 +02:00
parent bedb55e25f
commit ff1690e307
11 changed files with 50 additions and 29 deletions

View file

@ -5,13 +5,14 @@ import {Statues} from "./Layouts/Statues";
import {Bookcases} from "./Layouts/Bookcases";
import Cyclofix from "./Layouts/Cyclofix";
import {All} from "./Layouts/All";
import {Layout} from "./Layout";
export class AllKnownLayouts {
public static allSets: any = AllKnownLayouts.AllLayouts();
private static AllLayouts() {
private static AllLayouts() : any{
const all = new All();
const layouts = [
const layouts : Layout[] = [
new Groen(),
new GRB(),
new Cyclofix(),

View file

@ -145,7 +145,7 @@ export class Bookcases extends LayerDefinition {
new TagRenderingOptions({
freeform: {
key: "description",
renderTemplate: "<b>Beschrijving door de uitbater</b><br>{description}",
renderTemplate: "<b>Beschrijving door de uitbater:</b><br>{description}",
template: "$$$",
}
})

View file

@ -16,6 +16,7 @@ export class Layout {
public startLat: number;
public welcomeTail: string;
public locationContains: string[];
constructor(
name: string,
@ -41,13 +42,5 @@ export class Layout {
this.welcomeTail = welcomeTail;
}
/*
static statues = new Layout(
);
*/
}

View file

@ -23,5 +23,6 @@ export class Bookcases extends Layout{
" </a> of door je " +
" <span onclick=\"authOsm()\" class=\"activate-osm-authentication\">aan te melden</span>.</p>",
"Klik op een boekenruilkastje om vragen te beantwoorden");
this.locationContains= ["Bookcases.html", "Bookcase.html","bookcase"]
}
}

View file

@ -47,5 +47,7 @@ export class Groen extends Layout {
"Als je inlogt, komt er een tweede cookie bij met je inloggegevens." +
"</small>"
);
this.locationContains = ["buurtnatuur.be"]
}
}

View file

@ -11,6 +11,7 @@ import {UIRadioButtonWithOther} from "../UI/Base/UIRadioButtonWithOther";
import {VariableUiElement} from "../UI/Base/VariableUIElement";
import {TagDependantUIElement, TagDependantUIElementConstructor} from "./UIElementConstructor";
import {OnlyShowIfConstructor} from "./OnlyShowIf";
import {UserDetails} from "../Logic/OsmConnection";
export class TagRenderingOptions implements TagDependantUIElementConstructor {
@ -111,6 +112,7 @@ class TagRendering extends UIElement implements TagDependantUIElement {
private _priority: number;
private _userDetails: UIEventSource<UserDetails>;
Priority(): number {
return this._priority;
@ -162,6 +164,9 @@ class TagRendering extends UIElement implements TagDependantUIElement {
this.ListenTo(this._questionSkipped);
this.ListenTo(this._editMode);
this._userDetails = changes.login.userDetails;
this.ListenTo(this._userDetails);
this._question = options.question;
this._priority = options.priority ?? 0;
this._primer = options.primer ?? "";
@ -397,8 +402,14 @@ class TagRendering extends UIElement implements TagDependantUIElement {
if (html == "") {
return "";
}
let editButton = "";
if(this._userDetails.data.loggedIn){
editButton = this._editButton.Render();
}
return "<span class='answer'>" +
"<span class='answer-text'>" + html + "</span>" + this._editButton.Render() +
"<span class='answer-text'>" + html + "</span>" +
editButton +
"</span>";
}