forked from MapComplete/MapComplete
		
	Fix bbox bug, add ids to filters, add filter state to the URL
This commit is contained in:
		
							parent
							
								
									38037014b0
								
							
						
					
					
						commit
						0a9e7c0b36
					
				
					 23 changed files with 248 additions and 59 deletions
				
			
		|  | @ -5,7 +5,8 @@ import Translations from "../../UI/i18n/Translations"; | |||
| import {TagUtils} from "../../Logic/Tags/TagUtils"; | ||||
| 
 | ||||
| export default class FilterConfig { | ||||
|     readonly options: { | ||||
|     public readonly id: string | ||||
|     public readonly options: { | ||||
|         question: Translation; | ||||
|         osmTags: TagsFilter; | ||||
|     }[]; | ||||
|  | @ -14,11 +15,18 @@ export default class FilterConfig { | |||
|         if (json.options === undefined) { | ||||
|             throw `A filter without options was given at ${context}` | ||||
|         } | ||||
|         if (json.id === undefined) { | ||||
|             throw `A filter without id was found at ${context}` | ||||
|         } | ||||
|         if(json.id.match(/^[a-zA-Z0-9_-]*$/) === null){ | ||||
|             throw `A filter with invalid id was found at ${context}. Ids should only contain letters, numbers or - _` | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         if (json.options.map === undefined) { | ||||
|             throw `A filter was given where the options aren't a list at ${context}` | ||||
|         } | ||||
| 
 | ||||
|         this.id = json.id; | ||||
|         this.options = json.options.map((option, i) => { | ||||
|             const question = Translations.T( | ||||
|                 option.question, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue