forked from MapComplete/MapComplete
More css tweaks and bug fixes
This commit is contained in:
parent
fd350bb095
commit
eb4dda1ba2
29 changed files with 294 additions and 107303 deletions
|
@ -1,14 +1,15 @@
|
|||
import {UIElement} from "../UIElement";
|
||||
import Locale from "../i18n/Locale";
|
||||
import Translations from "../i18n/Translations";
|
||||
|
||||
export class Button extends UIElement {
|
||||
private _text: UIElement;
|
||||
private _onclick: () => void;
|
||||
private _clss: string;
|
||||
|
||||
constructor(text: UIElement, onclick: (() => void), clss: string = "") {
|
||||
constructor(text: string | UIElement, onclick: (() => void), clss: string = "") {
|
||||
super(Locale.language);
|
||||
this._text = text;
|
||||
this._text = Translations.W(text);
|
||||
this._onclick = onclick;
|
||||
if (clss !== "") {
|
||||
|
||||
|
|
|
@ -16,21 +16,22 @@ export class FullScreenMessageBoxHandler {
|
|||
this.listenTo(uielement);
|
||||
this.update();
|
||||
|
||||
window.onhashchange = function () {
|
||||
if (location.hash === "") {
|
||||
// No more element: back to the map!
|
||||
uielement.setData(undefined);
|
||||
onClear();
|
||||
if (window !== undefined) {
|
||||
window.onhashchange = function () {
|
||||
if (location.hash === "") {
|
||||
// No more element: back to the map!
|
||||
uielement.setData(undefined);
|
||||
onClear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Translations.t.general.returnToTheMap
|
||||
.onClick(() => {
|
||||
console.log("Clicked 'return to the map'")
|
||||
uielement.setData(undefined);
|
||||
onClear();
|
||||
})
|
||||
.AttachTo("to-the-map-h2");
|
||||
.AttachTo("to-the-map");
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ export class ImageUploadFlow extends UIElement {
|
|||
},
|
||||
function(failReason) {
|
||||
|
||||
}
|
||||
},0
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ export class DropDown<T> extends InputElement<T> {
|
|||
}
|
||||
|
||||
return "<form>" +
|
||||
"<label for='dropdown-" + this.id + "'>" + this._label.Render() + "</label>" +
|
||||
"<label for='dropdown-" + this.id + "'>" + this._label.Render() + " </label>" +
|
||||
"<select name='dropdown-" + this.id + "' id='dropdown-" + this.id + "'>" +
|
||||
options +
|
||||
"</select>" +
|
||||
|
|
|
@ -37,6 +37,9 @@ export abstract class UIElement {
|
|||
}
|
||||
|
||||
Update(): void {
|
||||
if(document === undefined){
|
||||
return ; // Running from console
|
||||
}
|
||||
let element = document.getElementById(this.id);
|
||||
if (element === undefined || element === null) {
|
||||
// The element is not painted
|
||||
|
|
|
@ -1,7 +1,20 @@
|
|||
import {UIEventSource} from "../UIEventSource";
|
||||
import {LocalStorageSource} from "../../Logic/LocalStorageSource";
|
||||
import {DropDown} from "../Input/DropDown";
|
||||
import {Layout} from "../../Customizations/Layout";
|
||||
import {UIElement} from "../UIElement";
|
||||
|
||||
|
||||
export default class Locale {
|
||||
public static language: UIEventSource<string> = LocalStorageSource.Get('language', "en");
|
||||
|
||||
public static CreateLanguagePicker(layoutToUse: Layout, label: string | UIElement = "") {
|
||||
|
||||
return new DropDown(label, layoutToUse.supportedLanguages.map(lang => {
|
||||
return {value: lang, shown: lang}
|
||||
}
|
||||
), Locale.language);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -420,7 +420,11 @@ export default class Translations {
|
|||
en: "The data is still loading. Please wait a bit before you add a new point",
|
||||
nl: "De data wordt nog geladen. Nog even geduld en dan kan je een punt toevoegen."
|
||||
})
|
||||
}
|
||||
},
|
||||
pickLanguage: new T({
|
||||
en: "Choose a language",
|
||||
nl: "Kies je taal"
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue