Small fixes in CustomGenerator; artworkmap is now a json-preset

This commit is contained in:
Pieter Vander Vennet 2020-08-25 02:12:26 +02:00
parent c8b2dab669
commit 1cdf2ee9bc
9 changed files with 224 additions and 150 deletions

View file

@ -578,17 +578,20 @@ export class ThemeGenerator extends UIElement {
textField = new TextField<string>({
placeholder: "single key",
startValidated: false,
value: new UIEventSource<string>(""),
value:value,
toString: str => str,
fromString: str => {
if(str === undefined){
return "";
}
if (str === "*") {
return str;
}
str = str.trim();
if (str.match("^_*[a-zA-Z]*[a-zA-Z0-9:]*$") == null) {
if (str.match("^_*[a-zA-Z]*[a-zA-Z0-9:_]*$") == null) {
return undefined;
}
return str.trim();
return str;
}
})
@ -619,13 +622,18 @@ export class ThemeGenerator extends UIElement {
});
}
let sendingPing = false;
value.addCallback((v) => {
if (v === undefined || v === "") {
delete root[key];
} else {
root[key] = v;
}
self.themeObject.ping(); // We assume the root is a part of the themeObject
if(!sendingPing){
sendingPing = true;
self.themeObject.ping(); // We assume the root is a part of the themeObject
sendingPing = false;
}
});
self.themeObject.addCallback(() => {

View file

@ -13,6 +13,7 @@ export class ValidatedTextField {
"$": (str) => true,
"string": (str) => true,
"date": (str) => true, // TODO validate and add a date picker
"wikidata": (str) => true, // TODO validate wikidata IDS
"int": (str) => {str = ""+str; return str !== undefined && str.indexOf(".") < 0 && !isNaN(Number(str))},
"nat": (str) => {str = ""+str; return str !== undefined && str.indexOf(".") < 0 && !isNaN(Number(str)) && Number(str) > 0},
"float": (str) => !isNaN(Number(str)),

View file

@ -62,14 +62,19 @@ export class MoreScreen extends UIElement {
}
if (layout.name === CustomLayout.NAME) {
continue;
continue;
}
const currentLocation = State.state.locationControl.data;
const linkText =
`https://pietervdvn.github.io/MapComplete/${layout.name}.html?z=${currentLocation.zoom}&lat=${currentLocation.lat}&lon=${currentLocation.lon}`
let linkText =
`./${layout.name}.html?z=${currentLocation.zoom}&lat=${currentLocation.lat}&lon=${currentLocation.lon}`
if (location.hostname === "localhost" || location.hostname === "127.0.0.1") {
linkText = `./index.html?layout=${layout.name}&z=${currentLocation.zoom}&lat=${currentLocation.lat}&lon=${currentLocation.lon}`
}
let description = Translations.W(layout.description);
if(description !== undefined){
if (description !== undefined) {
description = new Combine(["<br/>", description]);
}
const link =

View file

@ -29,38 +29,7 @@ export default class Translations {
},
artwork: {
name: new T({ en: 'Artwork', nl: 'Kunstwerk', fr: "Oeuvre d'art" }),
title: new T({ en: 'Artwork', nl: 'Kunstwerk', fr: "Oeuvre d'art" }),
type: {
render: new T({
en: 'This is artwork of the type: {artwork_type}',
nl: 'Dit is een kunstwerk van het type: {artwork_type}',
fr: "Ceci est un travail d'art de type: {artwork_type}"
}),
template: new T({ en: 'Some other type: $$$', nl: 'Een ander type: $$$', fr: 'Un autre type: $$$' }),
question: new T({
en: 'What is the type of this artwork?',
nl: 'Wat voor type kunstwerk is dit?',
fr: "Quel est le type de cette oeuvre d'art?"
}),
architecture: new T({ en: "architecture", nl: "architectuur", fr: "architecture" }),
mural: new T({ en: "mural", nl: "muurschildering", fr: "mural" }),
painting: new T({ en: "painting", nl: "schilderij", fr: "peinture" }),
sculpture: new T({ en: "sculpture", nl: "beeldhouwwerk", fr: "sculpture" }),
statue: new T({ en: "statue", nl: "standbeeld", fr: "statue" }),
bust: new T({ en: "bust", nl: "buste", fr: "buste" }),
stone: new T({ en: "stone", nl: "steen", fr: "rocher" }),
installation: new T({ en: "installation", nl: "installatie", fr: "installation" }),
graffiti: new T({ en: "graffiti", nl: "graffiti", fr: "graffiti" }),
relief: new T({ en: "relief", nl: "verlichting", fr: "relief" }),
azulejo: new T({ en: "azulejo", nl: "azulejo", fr: "azulejo" }),
tilework: new T({ en: "tilework", nl: "tegelwerk", fr: "carrelage" })
}, artist: {
question: new T({en:"Which artist created this artwork?"})
}
},
cyclofix: {
title: new T({
en: 'Cyclofix - an open map for cyclists',
@ -754,7 +723,7 @@ export default class Translations {
header: new T({
en: "<h2>Add a point?</h2>You clicked somewhere where no data is known yet.<br/>",
nl: "<h2>Punt toevoegen?</h2>Je klikte ergens waar er nog geen data is.<br/>",
fr: "<h2>Pas de données</h2> vous avez cliqué sur un endroit ou il n'y a pas encore de données. <br/>"
fr: "<h2>Pas de données</h2>Vous avez cliqué sur un endroit ou il n'y a pas encore de données. <br/>"
}),
pleaseLogin: new T({