Questions: add 24/7 logo, add 24/7 by default question, fix loading recursive default questions
This commit is contained in:
parent
600727e820
commit
dfb49ccc2f
7 changed files with 156 additions and 9 deletions
|
@ -100,6 +100,14 @@
|
||||||
"https://www.onlinewebfonts.com/icon/464507"
|
"https://www.onlinewebfonts.com/icon/464507"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "open24_7.svg",
|
||||||
|
"license": "CC0-1.0",
|
||||||
|
"authors": [
|
||||||
|
"Pieter Vander Vennet"
|
||||||
|
],
|
||||||
|
"sources": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "payment_card.svg",
|
"path": "payment_card.svg",
|
||||||
"license": "CC0-1.0",
|
"license": "CC0-1.0",
|
||||||
|
|
106
assets/layers/questions/open24_7.svg
Normal file
106
assets/layers/questions/open24_7.svg
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="59.535809mm"
|
||||||
|
height="53.162579mm"
|
||||||
|
viewBox="0 0 59.535809 53.162579"
|
||||||
|
version="1.1"
|
||||||
|
id="svg1"
|
||||||
|
inkscape:version="1.3.2 (1:1.3.2+202311252150+091e20ef0f)"
|
||||||
|
sodipodi:docname="open24_7.svg"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview1"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#999999"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:zoom="1.2448246"
|
||||||
|
inkscape:cx="167.49348"
|
||||||
|
inkscape:cy="144.19702"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="995"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="g4" />
|
||||||
|
<defs
|
||||||
|
id="defs1">
|
||||||
|
<rect
|
||||||
|
x="195.29895"
|
||||||
|
y="583.53101"
|
||||||
|
width="265.52469"
|
||||||
|
height="247.68958"
|
||||||
|
id="rect2" />
|
||||||
|
<rect
|
||||||
|
x="69.833305"
|
||||||
|
y="301.19489"
|
||||||
|
width="537.72614"
|
||||||
|
height="337.24045"
|
||||||
|
id="rect1" />
|
||||||
|
<rect
|
||||||
|
x="69.833305"
|
||||||
|
y="301.19489"
|
||||||
|
width="537.72614"
|
||||||
|
height="337.24045"
|
||||||
|
id="rect1-4" />
|
||||||
|
</defs>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-23.847285,-105.0215)">
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
transform="scale(0.26458333)"
|
||||||
|
id="text2"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:151.181px;line-height:2;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono Bold';white-space:pre;shape-inside:url(#rect2);fill:#000000;fill-opacity:1;stroke:#0000ff;stroke-width:0.00001;stroke-linecap:round"><tspan
|
||||||
|
x="195.29883"
|
||||||
|
y="1028.9189"
|
||||||
|
id="tspan4">7</tspan></text>
|
||||||
|
<g
|
||||||
|
id="g4"
|
||||||
|
transform="rotate(19.031252,53.955502,129.65312)">
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
transform="matrix(0.24864277,-0.0904495,0.0904495,0.24864277,-37.896511,23.10344)"
|
||||||
|
id="text1"
|
||||||
|
style="font-size:151.181px;line-height:2;font-family:QTBrushStroke;-inkscape-font-specification:QTBrushStroke;white-space:pre;shape-inside:url(#rect1);fill:#ffffff;stroke:#0000ff;stroke-width:0.00001;stroke-linecap:round"><tspan
|
||||||
|
x="69.833984"
|
||||||
|
y="498.89354"
|
||||||
|
id="tspan6"><tspan
|
||||||
|
style="font-weight:bold;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono Bold';fill:#000000"
|
||||||
|
id="tspan5">24</tspan></tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
transform="matrix(0.31987307,-0.11005382,0.11005382,0.31987307,-8.6266834,2.8601416)"
|
||||||
|
id="text1-5"
|
||||||
|
style="font-size:151.181px;line-height:2;font-family:QTBrushStroke;-inkscape-font-specification:QTBrushStroke;white-space:pre;shape-inside:url(#rect1-4);display:inline;fill:#ffffff;stroke:#0000ff;stroke-width:0.00001;stroke-linecap:round"><tspan
|
||||||
|
x="69.833984"
|
||||||
|
y="498.89354"
|
||||||
|
id="tspan8"><tspan
|
||||||
|
style="font-weight:bold;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono Bold';fill:#000000"
|
||||||
|
id="tspan7">7</tspan></tspan></text>
|
||||||
|
<g
|
||||||
|
id="path2"
|
||||||
|
transform="translate(1.922053,-1.2055383)">
|
||||||
|
<path
|
||||||
|
style="color:#000000;fill:#000000;stroke-linecap:round;-inkscape-stroke:none"
|
||||||
|
d="M 41.997064,155.10511 71.103506,106.61208"
|
||||||
|
id="path3" />
|
||||||
|
<path
|
||||||
|
style="color:#000000;fill:#000000;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 72.390625,104.46875 a 2.5,2.5 0 0 0 -3.429688,0.85742 l -29.107421,48.49219 a 2.5,2.5 0 0 0 0.857421,3.42969 2.5,2.5 0 0 0 3.429688,-0.85547 l 29.105469,-48.49414 a 2.5,2.5 0 0 0 -0.855469,-3.42969 z"
|
||||||
|
id="path4" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 4.2 KiB |
2
assets/layers/questions/open24_7.svg.license
Normal file
2
assets/layers/questions/open24_7.svg.license
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
SPDX-FileCopyrightText: Pieter Vander Vennet
|
||||||
|
SPDX-License-Identifier: CC0
|
|
@ -753,6 +753,7 @@
|
||||||
"+mappings": [
|
"+mappings": [
|
||||||
{
|
{
|
||||||
"if": "opening_hours=24/7",
|
"if": "opening_hours=24/7",
|
||||||
|
"icon": "./assets/layers/questions/open24_7.svg",
|
||||||
"then": {
|
"then": {
|
||||||
"en": "24/7 opened (including holidays)",
|
"en": "24/7 opened (including holidays)",
|
||||||
"de": "durchgehend geöffnet (auch an Feiertagen)",
|
"de": "durchgehend geöffnet (auch an Feiertagen)",
|
||||||
|
@ -771,6 +772,18 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "opening_hours_24_7_default",
|
||||||
|
"builtin": "opening_hours_24_7",
|
||||||
|
"override": {
|
||||||
|
"mappings": [
|
||||||
|
{
|
||||||
|
"#": "The first mapping is 'opening_hours=24/7', we amend this to also show if no info is known",
|
||||||
|
"alsoShowIf": "opening_hours="
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "opening_hours_by_appointment",
|
"id": "opening_hours_by_appointment",
|
||||||
"builtin": "opening_hours",
|
"builtin": "opening_hours",
|
||||||
|
|
|
@ -44,6 +44,7 @@ class ParseLayer extends Conversion<
|
||||||
> {
|
> {
|
||||||
private readonly _prepareLayer: PrepareLayer
|
private readonly _prepareLayer: PrepareLayer
|
||||||
private readonly _doesImageExist: DoesImageExist
|
private readonly _doesImageExist: DoesImageExist
|
||||||
|
private readonly _options: { readonly addExpandedTagRenderingsToContext?: boolean }
|
||||||
|
|
||||||
constructor(prepareLayer: PrepareLayer, doesImageExist: DoesImageExist) {
|
constructor(prepareLayer: PrepareLayer, doesImageExist: DoesImageExist) {
|
||||||
super("Parsed a layer from file, validates it", [], "ParseLayer")
|
super("Parsed a layer from file, validates it", [], "ParseLayer")
|
||||||
|
@ -287,9 +288,11 @@ class LayerOverviewUtils extends Script {
|
||||||
tagRenderings: bootstrapTagRenderings,
|
tagRenderings: bootstrapTagRenderings,
|
||||||
sharedLayers: null,
|
sharedLayers: null,
|
||||||
publicLayers: null,
|
publicLayers: null,
|
||||||
|
}, {
|
||||||
|
addTagRenderingsToContext: true
|
||||||
})
|
})
|
||||||
|
|
||||||
let path = "assets/layers/questions/questions.json"
|
const path = "assets/layers/questions/questions.json"
|
||||||
const sharedQuestions = this.parseLayer(doesImageExist, prepareLayer, path).raw
|
const sharedQuestions = this.parseLayer(doesImageExist, prepareLayer, path).raw
|
||||||
|
|
||||||
const dict = new Map<string, QuestionableTagRenderingConfigJson>()
|
const dict = new Map<string, QuestionableTagRenderingConfigJson>()
|
||||||
|
|
|
@ -258,11 +258,11 @@ export class ExpandRewrite<T> extends Conversion<T | RewritableConfigJson<T>, T[
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let renderings = Array.isArray(rewrite.renderings)
|
const renderings = Array.isArray(rewrite.renderings)
|
||||||
? rewrite.renderings
|
? rewrite.renderings
|
||||||
: [rewrite.renderings]
|
: [rewrite.renderings]
|
||||||
for (let i = 0; i < keysToRewrite.into.length; i++) {
|
for (let i = 0; i < keysToRewrite.into.length; i++) {
|
||||||
let ts: T[] = <T[]>Utils.Clone(renderings)
|
const ts: T[] = <T[]>Utils.Clone(renderings)
|
||||||
for (const tx of ts) {
|
for (const tx of ts) {
|
||||||
let t = <T>tx
|
let t = <T>tx
|
||||||
const sourceKeysToIgnore: string[] = []
|
const sourceKeysToIgnore: string[] = []
|
||||||
|
|
|
@ -161,7 +161,9 @@ class ExpandTagRendering extends Conversion<
|
||||||
private readonly _options: {
|
private readonly _options: {
|
||||||
/* If true, will copy the 'osmSource'-tags into the condition */
|
/* If true, will copy the 'osmSource'-tags into the condition */
|
||||||
applyCondition?: true | boolean
|
applyCondition?: true | boolean
|
||||||
noHardcodedStrings?: false | boolean
|
noHardcodedStrings?: false | boolean,
|
||||||
|
addToContext?: false | boolean
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -169,11 +171,13 @@ class ExpandTagRendering extends Conversion<
|
||||||
self: LayerConfigJson,
|
self: LayerConfigJson,
|
||||||
options?: {
|
options?: {
|
||||||
applyCondition?: true | boolean
|
applyCondition?: true | boolean
|
||||||
noHardcodedStrings?: false | boolean
|
noHardcodedStrings?: false | boolean,
|
||||||
|
// If set, a question will be added to the 'sharedTagRenderings'. Should only be used for 'questions.json'
|
||||||
|
addToContext?: false | boolean
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
"Converts a tagRenderingSpec into the full tagRendering, e.g. by substituting the tagRendering by the shared-question",
|
"Converts a tagRenderingSpec into the full tagRendering, e.g. by substituting the tagRendering by the shared-question and reusing the builtins",
|
||||||
[],
|
[],
|
||||||
"ExpandTagRendering"
|
"ExpandTagRendering"
|
||||||
)
|
)
|
||||||
|
@ -204,8 +208,17 @@ class ExpandTagRendering extends Conversion<
|
||||||
if (typeof tr === "string" || tr["builtin"] !== undefined) {
|
if (typeof tr === "string" || tr["builtin"] !== undefined) {
|
||||||
const stable = this.convert(tr, ctx.inOperation("recursive_resolve"))
|
const stable = this.convert(tr, ctx.inOperation("recursive_resolve"))
|
||||||
result.push(...stable)
|
result.push(...stable)
|
||||||
|
if(this._options?.addToContext){
|
||||||
|
for (const tr of stable) {
|
||||||
|
this._state.tagRenderings?.set(tr.id, tr)
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
result.push(tr)
|
result.push(tr)
|
||||||
|
if(this._options?.addToContext){
|
||||||
|
this._state.tagRenderings?.set(tr["id"], <QuestionableTagRenderingConfigJson> tr)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +233,7 @@ class ExpandTagRendering extends Conversion<
|
||||||
}
|
}
|
||||||
const result: TagRenderingConfigJson[] = []
|
const result: TagRenderingConfigJson[] = []
|
||||||
for (const tagRenderingConfigJson of direct) {
|
for (const tagRenderingConfigJson of direct) {
|
||||||
let nm: string | string[] | undefined = tagRenderingConfigJson["builtin"]
|
const nm: string | string[] | undefined = tagRenderingConfigJson["builtin"]
|
||||||
if (nm !== undefined) {
|
if (nm !== undefined) {
|
||||||
let indirect: TagRenderingConfigJson[]
|
let indirect: TagRenderingConfigJson[]
|
||||||
if (typeof nm === "string") {
|
if (typeof nm === "string") {
|
||||||
|
@ -1261,12 +1274,14 @@ export class AutoTitleIcon extends DesugaringStep<LayerConfigJson> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PrepareLayer extends Fuse<LayerConfigJson> {
|
export class PrepareLayer extends Fuse<LayerConfigJson> {
|
||||||
constructor(state: DesugaringContext) {
|
constructor(state: DesugaringContext, options?: {addTagRenderingsToContext?: false | boolean}) {
|
||||||
super(
|
super(
|
||||||
"Fully prepares and expands a layer for the LayerConfig.",
|
"Fully prepares and expands a layer for the LayerConfig.",
|
||||||
new On("tagRenderings", new Each(new RewriteSpecial())),
|
new On("tagRenderings", new Each(new RewriteSpecial())),
|
||||||
new On("tagRenderings", new Concat(new ExpandRewrite()).andThenF(Utils.Flatten)),
|
new On("tagRenderings", new Concat(new ExpandRewrite()).andThenF(Utils.Flatten)),
|
||||||
new On("tagRenderings", (layer) => new Concat(new ExpandTagRendering(state, layer))),
|
new On("tagRenderings", (layer) => new Concat(new ExpandTagRendering(state, layer, {
|
||||||
|
addToContext: options?.addTagRenderingsToContext ?? false
|
||||||
|
}))),
|
||||||
new On("tagRenderings", new Each(new DetectInline())),
|
new On("tagRenderings", new Each(new DetectInline())),
|
||||||
new AddQuestionBox(),
|
new AddQuestionBox(),
|
||||||
new AddEditingElements(state),
|
new AddEditingElements(state),
|
||||||
|
|
Loading…
Reference in a new issue