forked from MapComplete/MapComplete
Add QR-code to all popups, add direction indicator to popup and visual feedback, make reviews accessible to screenreaders (both to read them and to make them)
This commit is contained in:
parent
5567869bb4
commit
bfd818cb38
33 changed files with 415 additions and 98 deletions
|
|
@ -16,15 +16,22 @@ export default class NatValidator extends IntValidator {
|
|||
return str.indexOf(".") < 0 && !isNaN(Number(str)) && Number(str) >= 0
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* const validator = new NatValidator()
|
||||
* validator.getFeedback(-4).textFor("en") // => "This number should be positive"
|
||||
*/
|
||||
getFeedback(s: string): Translation {
|
||||
console.log("Getting feedback for", s)
|
||||
const n = Number(s)
|
||||
if (!isNaN(n) && n < 0) {
|
||||
return Translations.t.validation.nat.mustBePositive
|
||||
}
|
||||
const spr = super.getFeedback(s)
|
||||
if (spr !== undefined) {
|
||||
return spr
|
||||
}
|
||||
const n = Number(s)
|
||||
if (n < 0) {
|
||||
return Translations.t.validation.nat.mustBePositive
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue