Fixes to personal layout

This commit is contained in:
Pieter Vander Vennet 2020-09-18 22:23:49 +02:00
parent 9bdfd73db4
commit 9409f20bca
5 changed files with 31 additions and 11 deletions

View file

@ -51,8 +51,10 @@ export class PersonalLayersPanel extends UIElement {
continue; continue;
} }
let icon = layer.icon ?? "./assets/checkmark.svg"; let icon = layer.icon ?? "./assets/checkmark.svg";
if (typeof (icon) !== "string") { let iconUnset = layer.icon ?? "";
icon = icon.GetContent({"id": "node/-1"}).txt ?? "./assets/checkmark.svg"; if (layer.icon !== undefined && typeof (layer.icon) !== "string") {
icon = layer.icon.GetContent({"id": "node/-123456"}).txt ?? "./assets/checkmark.svg";
iconUnset = icon;
} }
let name = layer.name ?? layer.id; let name = layer.name ?? layer.id;
@ -65,10 +67,16 @@ export class PersonalLayersPanel extends UIElement {
"</b> ", "</b> ",
layer.description !== undefined ? new Combine(["<br/>", layer.description]) : "", layer.description !== undefined ? new Combine(["<br/>", layer.description]) : "",
]) ])
const iconImage = `<img src="${icon}">`;
const iconUnsetImage = `<img src="${iconUnset}">`
const cb = new CheckBox( const cb = new CheckBox(
new SubtleButton(icon ?? "./assets/checkmark.svg", content),
new SubtleButton( new SubtleButton(
new FixedUiElement(`<img src="${icon}">`).SetStyle("opacity:0.1"), new FixedUiElement(iconImage).SetStyle(""),
content),
new SubtleButton(
new FixedUiElement(iconUnsetImage).SetStyle("opacity:0.1;"),
new Combine(["<del>", new Combine(["<del>",
content, content,
"</del>" "</del>"

View file

@ -93,6 +93,7 @@ export default class Translation extends UIElement {
const tr = {}; const tr = {};
for (const lng in this.translations) { for (const lng in this.translations) {
let txt = this.translations[lng]; let txt = this.translations[lng];
console.log(txt)
txt = txt.replace(/\..*/, ""); txt = txt.replace(/\..*/, "");
txt = Utils.EllipsesAfter(txt, 255); txt = Utils.EllipsesAfter(txt, 255);
tr[lng] = txt; tr[lng] = txt;

View file

@ -59,9 +59,11 @@
"amenity=toilets" "amenity=toilets"
], ],
"description": { "description": {
"render": {
"en": "A publicly accessible toilet or restroom", "en": "A publicly accessible toilet or restroom",
"de": "Eine öffentlich zugängliche Toilette" "de": "Eine öffentlich zugängliche Toilette"
} }
}
}, },
{ {
"title": { "title": {

View file

@ -664,9 +664,10 @@ body {
.subtle-button img { .subtle-button img {
max-width: 3em; max-width: 3em;
max-height: 3em; height: 3em;
margin-right: 0.5em; margin-right: 0.5em;
padding: 0.5em; padding: 0;
padding-bottom:0.2em;
} }

View file

@ -7,11 +7,10 @@ import {UIEventSource} from "./Logic/UIEventSource";
import * as $ from "jquery"; import * as $ from "jquery";
import {FromJSON} from "./Customizations/JSON/FromJSON"; import {FromJSON} from "./Customizations/JSON/FromJSON";
import {TagRendering} from "./UI/TagRendering"; import {TagRendering} from "./UI/TagRendering";
import {State} from "./State";
TagRendering.injectFunction(); TagRendering.injectFunction();
let defaultLayout = "buurtnatuur"
// --------------------- Special actions based on the parameters ----------------- // --------------------- Special actions based on the parameters -----------------
// @ts-ignore // @ts-ignore
if (location.href.startsWith("http://buurtnatuur.be")) { if (location.href.startsWith("http://buurtnatuur.be")) {
@ -20,6 +19,15 @@ if (location.href.startsWith("http://buurtnatuur.be")) {
} }
if (location.href.indexOf("buurtnatuur.be") >= 0) {
defaultLayout = "buurtnatuur"
}
if(location.href.indexOf("pietervdvn.github.io") >= 0){
defaultLayout = "bookcases"
}
let testing: UIEventSource<string>; let testing: UIEventSource<string>;
if (location.hostname === "localhost" || location.hostname === "127.0.0.1") { if (location.hostname === "localhost" || location.hostname === "127.0.0.1") {
@ -36,7 +44,7 @@ if (location.hostname === "localhost" || location.hostname === "127.0.0.1") {
// ----------------- SELECT THE RIGHT QUESTSET ----------------- // ----------------- SELECT THE RIGHT QUESTSET -----------------
let defaultLayout = "buurtnatuur"
const path = window.location.pathname.split("/").slice(-1)[0]; const path = window.location.pathname.split("/").slice(-1)[0];
if (path !== "index.html" && path !== "") { if (path !== "index.html" && path !== "") {