forked from MapComplete/MapComplete
Improve documentation
This commit is contained in:
parent
c4712f6cc1
commit
c610cfc6e8
3 changed files with 17 additions and 10 deletions
|
@ -14,6 +14,9 @@ export class FixedUiElement extends BaseUIElement {
|
||||||
|
|
||||||
AsMarkdown(): string {
|
AsMarkdown(): string {
|
||||||
if (this.HasClass("code")) {
|
if (this.HasClass("code")) {
|
||||||
|
if (this.content.indexOf("\n") > 0 || this.HasClass("block")) {
|
||||||
|
return "\n```\n" + this.content + "\n```\n"
|
||||||
|
}
|
||||||
return "`" + this.content + "`"
|
return "`" + this.content + "`"
|
||||||
}
|
}
|
||||||
if (this.HasClass("font-bold")) {
|
if (this.HasClass("font-bold")) {
|
||||||
|
|
|
@ -644,7 +644,7 @@ export class ImportPointButton extends AbstractImportButton {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "maproulette_id",
|
name: "maproulette_id",
|
||||||
doc: "If given, the maproulette challenge will be marked as fixed",
|
doc: "The property name of the maproulette_id - this is probably `mr_taskId`. If given, the maproulette challenge will be marked as fixed. Only use this if part of a maproulette-layer.",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
{ showRemovedTags: false }
|
{ showRemovedTags: false }
|
||||||
|
|
|
@ -30,7 +30,6 @@ import WikipediaBox from "./Wikipedia/WikipediaBox"
|
||||||
import Wikidata, { WikidataResponse } from "../Logic/Web/Wikidata"
|
import Wikidata, { WikidataResponse } from "../Logic/Web/Wikidata"
|
||||||
import { Translation } from "./i18n/Translation"
|
import { Translation } from "./i18n/Translation"
|
||||||
import Translations from "./i18n/Translations"
|
import Translations from "./i18n/Translations"
|
||||||
import MangroveReviews from "../Logic/Web/MangroveReviews"
|
|
||||||
import ReviewForm from "./Reviews/ReviewForm"
|
import ReviewForm from "./Reviews/ReviewForm"
|
||||||
import ReviewElement from "./Reviews/ReviewElement"
|
import ReviewElement from "./Reviews/ReviewElement"
|
||||||
import OpeningHoursVisualization from "./OpeningHours/OpeningHoursVisualization"
|
import OpeningHoursVisualization from "./OpeningHours/OpeningHoursVisualization"
|
||||||
|
@ -480,6 +479,10 @@ export default class SpecialVisualizations {
|
||||||
args: [],
|
args: [],
|
||||||
constr(state, tagSource, argument, guistate) {
|
constr(state, tagSource, argument, guistate) {
|
||||||
let parentId = tagSource.data.mr_challengeId
|
let parentId = tagSource.data.mr_challengeId
|
||||||
|
if (parentId === undefined) {
|
||||||
|
console.warn("Element ", tagSource.data.id, " has no mr_challengeId")
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
let challenge = Stores.FromPromise(
|
let challenge = Stores.FromPromise(
|
||||||
Utils.downloadJsonCached(
|
Utils.downloadJsonCached(
|
||||||
`https://maproulette.org/api/v2/challenge/${parentId}`,
|
`https://maproulette.org/api/v2/challenge/${parentId}`,
|
||||||
|
@ -512,7 +515,7 @@ export default class SpecialVisualizations {
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
docs: "Show details of a MapRoulette task",
|
docs: "Fetches the metadata of MapRoulette campaign that this task is part of and shows those details (namely `title`, `description` and `instruction`).\n\nThis reads the property `mr_challengeId` to detect the parent campaign.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
funcName: "statistics",
|
funcName: "statistics",
|
||||||
|
@ -725,13 +728,6 @@ export default class SpecialVisualizations {
|
||||||
render: {
|
render: {
|
||||||
special: {
|
special: {
|
||||||
type: "some_special_visualisation",
|
type: "some_special_visualisation",
|
||||||
before: {
|
|
||||||
en: "Some text to prefix before the special element (e.g. a title)",
|
|
||||||
nl: "Een tekst om voor het element te zetten (bv. een titel)",
|
|
||||||
},
|
|
||||||
after: {
|
|
||||||
en: "Some text to put after the element, e.g. a footer",
|
|
||||||
},
|
|
||||||
argname: "some_arg",
|
argname: "some_arg",
|
||||||
message: {
|
message: {
|
||||||
en: "some other really long message",
|
en: "some other really long message",
|
||||||
|
@ -739,12 +735,20 @@ export default class SpecialVisualizations {
|
||||||
},
|
},
|
||||||
other_arg_name: "more args",
|
other_arg_name: "more args",
|
||||||
},
|
},
|
||||||
|
before: {
|
||||||
|
en: "Some text to prefix before the special element (e.g. a title)",
|
||||||
|
nl: "Een tekst om voor het element te zetten (bv. een titel)",
|
||||||
|
},
|
||||||
|
after: {
|
||||||
|
en: "Some text to put after the element, e.g. a footer",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
" "
|
" "
|
||||||
)
|
)
|
||||||
).SetClass("code"),
|
).SetClass("code"),
|
||||||
|
'In other words: use `{ "before": ..., "after": ..., "special": {"type": ..., "argname": ...argvalue...}`. The args are in the `special` block; an argvalue can be a string, a translation or another value. (Refer to class `RewriteSpecial` in case of problems)',
|
||||||
]).SetClass("flex flex-col"),
|
]).SetClass("flex flex-col"),
|
||||||
...helpTexts,
|
...helpTexts,
|
||||||
]).SetClass("flex flex-col")
|
]).SetClass("flex flex-col")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue