From 68929e4067888aac18648d4be7bcf476142db03a Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 27 Jul 2020 00:14:41 +0200 Subject: [PATCH] Add phone number to bikeshop --- Customizations/Layers/BikeShops.ts | 2 ++ .../Questions/PhoneNumberQuestion.ts | 18 ++++++++++++++++++ Customizations/Questions/bike/ShopDiy.ts | 1 - Customizations/Questions/bike/ShopName.ts | 1 - Customizations/Questions/bike/ShopPump.ts | 1 - Customizations/Questions/bike/ShopRental.ts | 1 - Customizations/Questions/bike/ShopRepair.ts | 1 - Customizations/Questions/bike/ShopRetail.ts | 1 - .../Questions/bike/ShopSecondHand.ts | 1 - UI/UIElement.ts | 1 + UI/i18n/Translations.ts | 14 +++++++++++++- 11 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 Customizations/Questions/PhoneNumberQuestion.ts diff --git a/Customizations/Layers/BikeShops.ts b/Customizations/Layers/BikeShops.ts index e07b981..6cd25d9 100644 --- a/Customizations/Layers/BikeShops.ts +++ b/Customizations/Layers/BikeShops.ts @@ -11,6 +11,7 @@ import ShopDiy from "../Questions/bike/ShopDiy"; import ShopName from "../Questions/bike/ShopName"; import ShopSecondHand from "../Questions/bike/ShopSecondHand"; import { TagRenderingOptions } from "../TagRendering"; +import {PhoneNumberQuestion} from "../Questions/PhoneNumberQuestion"; export default class BikeShops extends LayerDefinition { @@ -50,6 +51,7 @@ export default class BikeShops extends LayerDefinition { this.elementsToShow = [ new ImageCarouselWithUploadConstructor(), new ShopName(), + new PhoneNumberQuestion("{name}"), new ShopRetail(), new ShopRental(), new ShopRepair(), diff --git a/Customizations/Questions/PhoneNumberQuestion.ts b/Customizations/Questions/PhoneNumberQuestion.ts new file mode 100644 index 0000000..5e1c991 --- /dev/null +++ b/Customizations/Questions/PhoneNumberQuestion.ts @@ -0,0 +1,18 @@ +import {TagRenderingOptions} from "../TagRendering"; +import {UIElement} from "../../UI/UIElement"; +import Translations from "../../UI/i18n/Translations"; + +export class PhoneNumberQuestion extends TagRenderingOptions { + + constructor(category: string | UIElement) { + super({ + question: Translations.t.general.questions.phoneNumberOf.Subs({category: category}), + freeform: { + renderTemplate: Translations.t.general.questions.phoneNumberIs.Subs({category: category}), + template: "$phone$", + key: "phone" + } + }); + } + +} \ No newline at end of file diff --git a/Customizations/Questions/bike/ShopDiy.ts b/Customizations/Questions/bike/ShopDiy.ts index 4821731..8ddbdf4 100644 --- a/Customizations/Questions/bike/ShopDiy.ts +++ b/Customizations/Questions/bike/ShopDiy.ts @@ -8,7 +8,6 @@ export default class ShopPump extends TagRenderingOptions { const key = 'service:bicycle:diy' const to = Translations.t.cyclofix.shop.diy super({ - priority: 5, question: to.question, mappings: [ {k: new Tag(key, "yes"), txt: to.yes}, diff --git a/Customizations/Questions/bike/ShopName.ts b/Customizations/Questions/bike/ShopName.ts index f270268..dbf98d9 100644 --- a/Customizations/Questions/bike/ShopName.ts +++ b/Customizations/Questions/bike/ShopName.ts @@ -6,7 +6,6 @@ export default class ShopPump extends TagRenderingOptions { constructor() { const to = Translations.t.cyclofix.shop.qName super({ - priority: 5, question: to.question, freeform: { key: "name", diff --git a/Customizations/Questions/bike/ShopPump.ts b/Customizations/Questions/bike/ShopPump.ts index 6ed14da..b9f139c 100644 --- a/Customizations/Questions/bike/ShopPump.ts +++ b/Customizations/Questions/bike/ShopPump.ts @@ -8,7 +8,6 @@ export default class ShopPump extends TagRenderingOptions { const key = 'service:bicycle:pump' const to = Translations.t.cyclofix.shop.pump super({ - priority: 5, question: to.question, mappings: [ {k: new Tag(key, "yes"), txt: to.yes}, diff --git a/Customizations/Questions/bike/ShopRental.ts b/Customizations/Questions/bike/ShopRental.ts index eac2677..f2aafca 100644 --- a/Customizations/Questions/bike/ShopRental.ts +++ b/Customizations/Questions/bike/ShopRental.ts @@ -8,7 +8,6 @@ export default class ShopRental extends TagRenderingOptions { const key = 'service:bicycle:rental' const to = Translations.t.cyclofix.shop.rental super({ - priority: 5, question: to.question, mappings: [ {k: new Tag(key, "yes"), txt: to.yes}, diff --git a/Customizations/Questions/bike/ShopRepair.ts b/Customizations/Questions/bike/ShopRepair.ts index 2a1a375..cf7225a 100644 --- a/Customizations/Questions/bike/ShopRepair.ts +++ b/Customizations/Questions/bike/ShopRepair.ts @@ -8,7 +8,6 @@ export default class ShopRepair extends TagRenderingOptions { const key = 'service:bicycle:repair' const to = Translations.t.cyclofix.shop.repair super({ - priority: 5, question: to.question, mappings: [ {k: new Tag(key, "yes"), txt: to.yes}, diff --git a/Customizations/Questions/bike/ShopRetail.ts b/Customizations/Questions/bike/ShopRetail.ts index 3ad3ea3..bf4fd89 100644 --- a/Customizations/Questions/bike/ShopRetail.ts +++ b/Customizations/Questions/bike/ShopRetail.ts @@ -8,7 +8,6 @@ export default class ShopRetail extends TagRenderingOptions { const key = 'service:bicycle:retail' const to = Translations.t.cyclofix.shop.retail super({ - priority: 5, question: to.question, mappings: [ {k: new Tag(key, "yes"), txt: to.yes}, diff --git a/Customizations/Questions/bike/ShopSecondHand.ts b/Customizations/Questions/bike/ShopSecondHand.ts index b95da49..956e167 100644 --- a/Customizations/Questions/bike/ShopSecondHand.ts +++ b/Customizations/Questions/bike/ShopSecondHand.ts @@ -8,7 +8,6 @@ export default class ShopPump extends TagRenderingOptions { const key = 'service:bicycle:second_hand' const to = Translations.t.cyclofix.shop.secondHand super({ - priority: 5, question: to.question, mappings: [ {k: new Tag(key, "yes"), txt: to.yes}, diff --git a/UI/UIElement.ts b/UI/UIElement.ts index f67e209..11316be 100644 --- a/UI/UIElement.ts +++ b/UI/UIElement.ts @@ -1,4 +1,5 @@ import {UIEventSource} from "./UIEventSource"; +import {TagDependantUIElement} from "../Customizations/UIElementConstructor"; export abstract class UIElement { diff --git a/UI/i18n/Translations.ts b/UI/i18n/Translations.ts index a13e316..ca7bbfe 100644 --- a/UI/i18n/Translations.ts +++ b/UI/i18n/Translations.ts @@ -461,7 +461,19 @@ export default class Translations { }), noNameCategory: new T({ nl: "{category} zonder naam" - }) + }), + questions: { + phoneNumberOf: new T({ + en: "What is the phone number of {category}?", + nl: "Wat is het telefoonnummer van {category}?" + + }), + phoneNumberIs: new T({ + en: "The phone number of this {category} is {phone}", + nl: "Het telefoonnummer van {category} is {phone}" + }) + + } } }