forked from MapComplete/MapComplete
New dependency system for TagDependantUIElement
This commit is contained in:
parent
d7809b88bc
commit
a8314b39e6
6 changed files with 22 additions and 15 deletions
|
@ -41,12 +41,13 @@ export class FeatureInfoBox extends UIElement {
|
|||
this._userDetails = userDetails;
|
||||
this.ListenTo(userDetails);
|
||||
|
||||
const deps = {tags:this._tagsES , changes:this._changes}
|
||||
|
||||
this._infoboxes = [];
|
||||
elementsToShow = elementsToShow ?? []
|
||||
for (const tagRenderingOption of elementsToShow) {
|
||||
this._infoboxes.push(
|
||||
tagRenderingOption.construct(this._tagsES, this._changes));
|
||||
tagRenderingOption.construct(deps));
|
||||
}
|
||||
|
||||
title = title ?? new TagRenderingOptions(
|
||||
|
@ -55,9 +56,9 @@ export class FeatureInfoBox extends UIElement {
|
|||
}
|
||||
)
|
||||
|
||||
this._title = new TagRenderingOptions(title.options).construct(this._tagsES, this._changes);
|
||||
this._osmLink =new OsmLink().construct(this._tagsES, this._changes);
|
||||
this._wikipedialink = new WikipediaLink().construct(this._tagsES, this._changes);
|
||||
this._title = new TagRenderingOptions(title.options).construct(deps);
|
||||
this._osmLink =new OsmLink().construct(deps);
|
||||
this._wikipedialink = new WikipediaLink().construct(deps);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -28,8 +28,10 @@ class ImageCarouselWithUpload extends TagDependantUIElement {
|
|||
private _imageElement: ImageCarousel;
|
||||
private _pictureUploader: ImageUploadFlow;
|
||||
|
||||
constructor(tags: UIEventSource<any>, changes: Changes) {
|
||||
super(tags);
|
||||
constructor(dependencies: {tags: UIEventSource<any>, changes: Changes}) {
|
||||
super(dependencies.tags);
|
||||
const tags = dependencies.tags;
|
||||
const changes = dependencies.changes;
|
||||
this._imageElement = new ImageCarousel(tags, changes);
|
||||
const userDetails = changes.login.userDetails;
|
||||
const license = changes.login.GetPreference( "mapcomplete-pictures-license");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue