1- import AsEditableChallenge
2- from '../../../../../../interactions/Challenge/AsEditableChallenge'
3- import messages from '../Messages'
1+ import AsEditableChallenge from "../../../../../../interactions/Challenge/AsEditableChallenge" ;
2+ import messages from "../Messages" ;
43
5- const STEP_ID = "OSMCommit"
4+ const STEP_ID = "OSMCommit" ;
65
76/**
87 * Generates a JSON Schema describing OSM commit fields of Edit Challenge
@@ -17,9 +16,15 @@ const STEP_ID = "OSMCommit"
1716 *
1817 * @author [Neil Rotstan](https://github.com/nrotstan)
1918 */
20- export const jsSchema = ( intl , user , challengeData , extraErrors , options = { } ) => {
19+ export const jsSchema = (
20+ intl ,
21+ user ,
22+ challengeData ,
23+ extraErrors ,
24+ options = { }
25+ ) => {
2126 const schemaFields = {
22- " $schema" : "http://json-schema.org/draft-07/schema#" ,
27+ $schema : "http://json-schema.org/draft-07/schema#" ,
2328 type : "object" ,
2429 properties : {
2530 checkinComment : {
@@ -30,8 +35,12 @@ export const jsSchema = (intl, user, challengeData, extraErrors, options={}) =>
3035 title : intl . formatMessage ( messages . checkinSourceLabel ) ,
3136 type : "string" ,
3237 } ,
38+ changesetUrl : {
39+ type : "boolean" ,
40+ default : false ,
41+ } ,
3342 } ,
34- }
43+ } ;
3544
3645 // For new challenges, offer option to toggle #maproulette tag on commit comment.
3746 // The hashtag will be injected into the comment when the challenge is created, so
@@ -42,14 +51,16 @@ export const jsSchema = (intl, user, challengeData, extraErrors, options={}) =>
4251 title : " " , // blank title
4352 type : "boolean" ,
4453 enum : [ true , false ] ,
45- enumNames : [ intl . formatMessage ( messages . includeCheckinHashtagTrueLabel ) ,
46- intl . formatMessage ( messages . includeCheckinHashtagFalseLabel ) ] ,
54+ enumNames : [
55+ intl . formatMessage ( messages . includeCheckinHashtagTrueLabel ) ,
56+ intl . formatMessage ( messages . includeCheckinHashtagFalseLabel ) ,
57+ ] ,
4758 default : true ,
48- }
59+ } ;
4960 }
5061
51- return schemaFields
52- }
62+ return schemaFields ;
63+ } ;
5364
5465/**
5566 * uiSchema configuration to assist react-jsonschema-form in determining
@@ -61,20 +72,38 @@ export const jsSchema = (intl, user, challengeData, extraErrors, options={}) =>
6172 * > the form configuration will help the RJSFFormFieldAdapter generate the
6273 * > proper markup
6374 */
64- export const uiSchema = ( intl , user , challengeData , extraErrors , options = { } ) => {
65- const isCollapsed = options . longForm && ( options . collapsedGroups || [ ] ) . indexOf ( STEP_ID ) !== - 1
66- const toggleCollapsed = options . longForm && options . toggleCollapsed ? ( ) => options . toggleCollapsed ( STEP_ID ) : undefined
75+ export const uiSchema = (
76+ intl ,
77+ user ,
78+ challengeData ,
79+ extraErrors ,
80+ options = { }
81+ ) => {
82+ const isCollapsed =
83+ options . longForm && ( options . collapsedGroups || [ ] ) . indexOf ( STEP_ID ) !== - 1 ;
84+ const toggleCollapsed =
85+ options . longForm && options . toggleCollapsed
86+ ? ( ) => options . toggleCollapsed ( STEP_ID )
87+ : undefined ;
88+
89+ const changesetUrl =
90+ process . env . REACT_APP_CHANGESET_URL === "enabled" ? "changesetUrl" : null ;
6791
6892 const uiSchemaFields = {
6993 "ui:order" : [
70- "checkinComment" , "includeCheckinHashtag" , "checkinSource" ,
94+ "checkinComment" ,
95+ "includeCheckinHashtag" ,
96+ "checkinSource" ,
97+ changesetUrl ,
7198 ] ,
7299 checkinComment : {
73100 "ui:emptyValue" : "" ,
74101 "ui:help" : intl . formatMessage ( messages . checkinCommentDescription ) ,
75102 "ui:collapsed" : isCollapsed ,
76103 "ui:toggleCollapsed" : toggleCollapsed ,
77- "ui:groupHeader" : options . longForm ? intl . formatMessage ( messages . osmCommitStepHeader ) : undefined ,
104+ "ui:groupHeader" : options . longForm
105+ ? intl . formatMessage ( messages . osmCommitStepHeader )
106+ : undefined ,
78107 } ,
79108 checkinSource : {
80109 "ui:help" : intl . formatMessage ( messages . checkinSourceDescription ) ,
@@ -85,7 +114,13 @@ export const uiSchema = (intl, user, challengeData, extraErrors, options={}) =>
85114 "ui:help" : intl . formatMessage ( messages . includeCheckinHashtagDescription ) ,
86115 "ui:collapsed" : isCollapsed ,
87116 } ,
88- }
117+ changesetUrl : {
118+ "ui:title" : "Changeset URL" ,
119+ "ui:widget" : "radio" ,
120+ "ui:help" : intl . formatMessage ( messages . changesetUrlDescription ) ,
121+ "ui:collapsed" : isCollapsed ,
122+ } ,
123+ } ;
89124
90- return uiSchemaFields
91- }
125+ return uiSchemaFields ;
126+ } ;
0 commit comments