|
1 | 1 | import React from 'react'; |
2 | 2 | import PropTypes from 'prop-types'; |
| 3 | +import { Row, Col } from 'react-bootstrap'; |
3 | 4 | import { reduxForm, Field, FieldArray, touch } from 'redux-form'; |
4 | 5 | import { injectIntl, FormattedMessage, defineMessages } from 'react-intl'; |
5 | 6 | import { lruMemoize } from 'reselect'; |
@@ -98,121 +99,140 @@ const EditExerciseForm = ({ |
98 | 99 | previewPreprocessor={previewPreprocessor(localizedTextsLinks)} |
99 | 100 | /> |
100 | 101 |
|
101 | | - <Field |
102 | | - name="difficulty" |
103 | | - component={SelectField} |
104 | | - options={difficultyOptions(formatMessage)} |
105 | | - addEmptyOption={true} |
106 | | - label={<FormattedMessage id="app.editExerciseForm.difficulty" defaultMessage="Difficulty" />} |
107 | | - /> |
| 102 | + <Row className="align-items-end"> |
| 103 | + <Col sm={12} md={6}> |
| 104 | + <NumericTextField |
| 105 | + name="solutionFilesLimit" |
| 106 | + validateMin={1} |
| 107 | + validateMax={100} |
| 108 | + maxLength={3} |
| 109 | + nullable |
| 110 | + label={ |
| 111 | + <span> |
| 112 | + <FormattedMessage id="app.editExerciseForm.solutionFilesLimit" defaultMessage="Solution files limit:" /> |
| 113 | + <Explanation id="solutionFilesLimitExplanation"> |
| 114 | + <FormattedMessage |
| 115 | + id="app.exercise.solutionFilesLimitExplanation" |
| 116 | + defaultMessage="Maximal number of files submitted in a solution. The users are not allowed to submit solutions that exceed this limit. If empty, no limit is applied." |
| 117 | + /> |
| 118 | + <hr /> |
| 119 | + <strong> |
| 120 | + <FormattedMessage |
| 121 | + id="app.exercise.defaultValueForAssignment" |
| 122 | + defaultMessage="This is a default (recommended) value for assignments, but each assignment of this exercise may set it individually. Modifications of this value are not synchronized with already created assignments." |
| 123 | + /> |
| 124 | + </strong> |
| 125 | + </Explanation> |
| 126 | + </span> |
| 127 | + } |
| 128 | + /> |
| 129 | + </Col> |
108 | 130 |
|
109 | | - <NumericTextField |
110 | | - name="solutionFilesLimit" |
111 | | - validateMin={1} |
112 | | - validateMax={100} |
113 | | - maxLength={3} |
114 | | - nullable |
115 | | - label={ |
116 | | - <span> |
117 | | - <FormattedMessage id="app.editExerciseForm.solutionFilesLimit" defaultMessage="Solution files limit:" /> |
118 | | - <Explanation id="solutionFilesLimitExplanation"> |
119 | | - <FormattedMessage |
120 | | - id="app.exercise.solutionFilesLimitExplanation" |
121 | | - defaultMessage="Maximal number of files submitted in a solution. The users are not allowed to submit solutions that exceed this limit. If empty, no limit is applied." |
122 | | - /> |
123 | | - <hr /> |
124 | | - <strong> |
| 131 | + <Col sm={12} md={6}> |
| 132 | + <NumericTextField |
| 133 | + name="solutionSizeLimit" |
| 134 | + validateMin={1} |
| 135 | + validateMax={128 * 1024} |
| 136 | + maxLength={6} |
| 137 | + nullable |
| 138 | + label={ |
| 139 | + <span> |
125 | 140 | <FormattedMessage |
126 | | - id="app.exercise.defaultValueForAssignment" |
127 | | - defaultMessage="This is a default (recommended) value for assignments, but each assignment of this exercise may set it individually. Modifications of this value are not synchronized with already created assignments." |
| 141 | + id="app.editExerciseForm.solutionSizeLimit" |
| 142 | + defaultMessage="Solution total size [KiB] limit:" |
128 | 143 | /> |
129 | | - </strong> |
130 | | - </Explanation> |
131 | | - </span> |
132 | | - } |
133 | | - /> |
| 144 | + <Explanation id="solutionSizeLimitExplanation"> |
| 145 | + <FormattedMessage |
| 146 | + id="app.exercise.solutionSizeLimitExplanation" |
| 147 | + defaultMessage="Maximal total size of all files submitted in a solution. The users are not allowed to submit solutions that exceed this limit. If empty, no limit is applied." |
| 148 | + /> |
| 149 | + <hr /> |
| 150 | + <strong> |
| 151 | + <FormattedMessage |
| 152 | + id="app.exercise.defaultValueForAssignment" |
| 153 | + defaultMessage="This is a default (recommended) value for assignments, but each assignment of this exercise may set it individually. Modifications of this value are not synchronized with already created assignments." |
| 154 | + /> |
| 155 | + </strong> |
| 156 | + </Explanation> |
| 157 | + </span> |
| 158 | + } |
| 159 | + /> |
| 160 | + </Col> |
134 | 161 |
|
135 | | - <NumericTextField |
136 | | - name="solutionSizeLimit" |
137 | | - validateMin={1} |
138 | | - validateMax={128 * 1024} |
139 | | - maxLength={6} |
140 | | - nullable |
141 | | - label={ |
142 | | - <span> |
143 | | - <FormattedMessage |
144 | | - id="app.editExerciseForm.solutionSizeLimit" |
145 | | - defaultMessage="Solution total size [KiB] limit:" |
146 | | - /> |
147 | | - <Explanation id="solutionSizeLimitExplanation"> |
148 | | - <FormattedMessage |
149 | | - id="app.exercise.solutionSizeLimitExplanation" |
150 | | - defaultMessage="Maximal total size of all files submitted in a solution. The users are not allowed to submit solutions that exceed this limit. If empty, no limit is applied." |
151 | | - /> |
152 | | - <hr /> |
153 | | - <strong> |
154 | | - <FormattedMessage |
155 | | - id="app.exercise.defaultValueForAssignment" |
156 | | - defaultMessage="This is a default (recommended) value for assignments, but each assignment of this exercise may set it individually. Modifications of this value are not synchronized with already created assignments." |
157 | | - /> |
158 | | - </strong> |
159 | | - </Explanation> |
160 | | - </span> |
161 | | - } |
162 | | - /> |
| 162 | + <Col sm={12} md={6}> |
| 163 | + <Field |
| 164 | + name="difficulty" |
| 165 | + component={SelectField} |
| 166 | + options={difficultyOptions(formatMessage)} |
| 167 | + addEmptyOption={true} |
| 168 | + label={ |
| 169 | + <> |
| 170 | + <FormattedMessage id="app.editExerciseForm.difficulty" defaultMessage="Difficulty" />: |
| 171 | + </> |
| 172 | + } |
| 173 | + /> |
| 174 | + </Col> |
163 | 175 |
|
164 | | - <Field |
165 | | - name="mergeJudgeLogs" |
166 | | - component={CheckboxField} |
167 | | - onOff |
168 | | - label={ |
169 | | - <span> |
170 | | - <FormattedMessage id="app.editExerciseForm.mergeJudgeLogs" defaultMessage="Merge judge logs in one" /> |
171 | | - <Explanation id="mergeJudgeLogsExplanation"> |
172 | | - <FormattedMessage |
173 | | - id="app.exercise.mergeJudgeLogsExplanation" |
174 | | - defaultMessage="The merge flag indicates whether primary (stdout) and secondary (stderr) judge logs are are concatenated in one log (which should be default for built-in judges). If the logs are separated, the visibility of each part may be controlled individually in assignments. That might be helpful if you need to pass two separate logs from a custom judge (e.g., one is for students and one is for supervisors)." |
175 | | - /> |
176 | | - </Explanation> |
177 | | - </span> |
178 | | - } |
179 | | - /> |
| 176 | + <Col sm={12} md={6}> |
| 177 | + <Field |
| 178 | + name="mergeJudgeLogs" |
| 179 | + component={CheckboxField} |
| 180 | + onOff |
| 181 | + label={ |
| 182 | + <span> |
| 183 | + <FormattedMessage id="app.editExerciseForm.mergeJudgeLogs" defaultMessage="Merge judge logs" /> |
| 184 | + <Explanation id="mergeJudgeLogsExplanation"> |
| 185 | + <FormattedMessage |
| 186 | + id="app.exercise.mergeJudgeLogsExplanation" |
| 187 | + defaultMessage="The merge flag indicates whether primary (stdout) and secondary (stderr) judge logs are are concatenated in one log (which should be default for built-in judges). If the logs are separated, the visibility of each part may be controlled individually in assignments. That might be helpful if you need to pass two separate logs from a custom judge (e.g., one is for students and one is for supervisors)." |
| 188 | + /> |
| 189 | + </Explanation> |
| 190 | + </span> |
| 191 | + } |
| 192 | + /> |
| 193 | + </Col> |
| 194 | + </Row> |
180 | 195 |
|
181 | 196 | <hr /> |
182 | 197 |
|
183 | | - <Field |
184 | | - name="isPublic" |
185 | | - component={CheckboxField} |
186 | | - onOff |
187 | | - label={ |
188 | | - <span> |
189 | | - <FormattedMessage id="app.editExerciseForm.isPublic" defaultMessage="Exercise is public" /> |
190 | | - <Explanation id="isPublicExplanation"> |
191 | | - <FormattedMessage |
192 | | - id="app.exercise.isPublicExplanation" |
193 | | - defaultMessage="Public exercise is visible to all supervisors in its home groups and respective nested groups. Private (not public) exercise is visible to the author only." |
194 | | - /> |
195 | | - </Explanation> |
196 | | - </span> |
197 | | - } |
198 | | - /> |
199 | | - |
200 | | - <Field |
201 | | - name="isLocked" |
202 | | - component={CheckboxField} |
203 | | - onOff |
204 | | - label={ |
205 | | - <span> |
206 | | - <FormattedMessage id="app.editExerciseForm.isLocked" defaultMessage="Exercise is locked" /> |
207 | | - <Explanation id="isLockedExplanation"> |
208 | | - <FormattedMessage |
209 | | - id="app.exercise.isLockedExplanation" |
210 | | - defaultMessage="Locked exercises cannot be assigned in groups. It is recommended to keep the assignment locked until it is properly tested by reference solutions, especially if it is also public." |
211 | | - /> |
212 | | - </Explanation> |
213 | | - </span> |
214 | | - } |
215 | | - /> |
| 198 | + <Row> |
| 199 | + <Col sm={12} md={6}> |
| 200 | + <Field |
| 201 | + name="isPublic" |
| 202 | + component={CheckboxField} |
| 203 | + onOff |
| 204 | + label={ |
| 205 | + <span> |
| 206 | + <FormattedMessage id="app.editExerciseForm.isPublic" defaultMessage="Exercise is public" /> |
| 207 | + <Explanation id="isPublicExplanation"> |
| 208 | + <FormattedMessage |
| 209 | + id="app.exercise.isPublicExplanation" |
| 210 | + defaultMessage="Public exercise is visible to all supervisors in its home groups and respective nested groups. Private (not public) exercise is visible to the author only." |
| 211 | + /> |
| 212 | + </Explanation> |
| 213 | + </span> |
| 214 | + } |
| 215 | + /> |
| 216 | + </Col> |
| 217 | + <Col sm={12} md={6}> |
| 218 | + <Field |
| 219 | + name="isLocked" |
| 220 | + component={CheckboxField} |
| 221 | + onOff |
| 222 | + label={ |
| 223 | + <span> |
| 224 | + <FormattedMessage id="app.editExerciseForm.isLocked" defaultMessage="Exercise is locked" /> |
| 225 | + <Explanation id="isLockedExplanation"> |
| 226 | + <FormattedMessage |
| 227 | + id="app.exercise.isLockedExplanation" |
| 228 | + defaultMessage="Locked exercises cannot be assigned in groups. It is recommended to keep the assignment locked until it is properly tested by reference solutions, especially if it is also public." |
| 229 | + /> |
| 230 | + </Explanation> |
| 231 | + </span> |
| 232 | + } |
| 233 | + /> |
| 234 | + </Col> |
| 235 | + </Row> |
216 | 236 |
|
217 | 237 | {error && dirty && <Callout variant="danger">{error}</Callout>} |
218 | 238 | </FormBox> |
|
0 commit comments