Skip to content

Commit bbe22c3

Browse files
committed
Misc minor appearance adjustments, labels, callouts, translations, ...
1 parent a7129e8 commit bbe22c3

File tree

8 files changed

+75
-41
lines changed

8 files changed

+75
-41
lines changed

src/components/Assignments/Assignment/AssignmentsTable/AssignmentsTable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class AssignmentsTable extends Component {
6161

6262
return (
6363
<>
64-
<Table hover className="mb-1">
64+
<Table hover className="mb-0">
6565
{assignmentsPreprocessed.length > 0 && (
6666
<thead>
6767
<tr>

src/components/Assignments/ShadowAssignment/ShadowAssignmentsTable/ShadowAssignmentsTable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const ShadowAssignmentsTable = ({
1717
isAdmin = false,
1818
intl: { locale },
1919
}) => (
20-
<Table hover={shadowAssignments.size > 0}>
20+
<Table hover={shadowAssignments.size > 0} className="mb-0">
2121
{shadowAssignments.size > 0 && (
2222
<thead>
2323
<tr>

src/components/Groups/ResultsTable/ResultsTable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ class ResultsTable extends Component {
479479
<div className="text-center">
480480
<Button
481481
variant="primary"
482-
className={styles.downloadButton}
482+
className="my-3"
483483
onClick={() =>
484484
downloadString(
485485
`${groupName}.csv`,

src/components/Groups/ResultsTable/ResultsTable.less

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@
4444
text-align: left;
4545
}
4646

47-
.downloadButton {
48-
margin-top: 20px;
49-
margin-left: 10px;
50-
margin-bottom: 10px;
51-
}
52-
5347
td.pointsCell {
5448
position: relative;
5549
}

src/components/helpers/LocalizedTexts/LocalizedTexts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ const LocalizedTexts = ({ locales = [], noLocalesMessage = null }) => {
103103
LocalizedTexts.propTypes = {
104104
locales: PropTypes.arrayOf(
105105
PropTypes.shape({
106-
locale: PropTypes.string.isRequried,
107-
text: PropTypes.string.isRequried,
106+
locale: PropTypes.string.isRequired,
107+
text: PropTypes.string.isRequired,
108108
})
109109
),
110110
noLocalesMessage: PropTypes.any,

src/locales/cs.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@
653653
"app.exercise.detach": "Odpojit",
654654
"app.exercise.detailTitle": "Popis úlohy",
655655
"app.exercise.difficulty": "Obtížnost",
656+
"app.exercise.exerciseReadyToAssign": "Úloha je připravená k zadání do skupiny. Můžete tak učinit přímo na stránce úloh vybrané skupiny, nebo můžete použiít formulář pro hromadné zadání do více skupin na stránce Zadané úlohy.",
656657
"app.exercise.forked": "Duplikováno z",
657658
"app.exercise.groups": "Domovské skupiny",
658659
"app.exercise.isBroken": "Konfigurace úlohy není kompletní a je třeba ji doplnit.",
@@ -1365,6 +1366,8 @@
13651366
"app.resubmitSolution.resubmitNondebug": "Resubmit (normální mód)",
13661367
"app.resultsArchiveInfoBox.description": "Detailní logy a výpisy",
13671368
"app.resultsArchiveInfoBox.title": "Archiv s výsledky",
1369+
"app.resultsTable.cancelOnlyShowMe": "Zobrazit všechny studenty ve skupině",
1370+
"app.resultsTable.onlyShowMe": "Skrýt všechny kromě mě",
13681371
"app.resultsTable.total": "Celkem",
13691372
"app.reviewedSolution.revoke": "Zrušit revizi",
13701373
"app.reviewedSolution.set": "Revidovat",
@@ -1533,7 +1536,6 @@
15331536
"app.solution.allSolutions": "všechna řešení",
15341537
"app.solution.anotherAcceptedWarning": "Jiné řešení již bylo označeno jako akceptované. Body tohoto řešení nejsou bráný v potaz.",
15351538
"app.solution.anotherBestWarning": "Jiné řešení je považováno za nejlepší (tzn. má více bodů nebo má stejně bodů a bylo odevzdáno později).",
1536-
"app.solution.dotnetResubmitTemporaryDisabled": "Ladicí resubmit je dočasně zablokován",
15371539
"app.solution.editNoteModalTitle": "Upravit poznámku řešení",
15381540
"app.solution.emptyNote": "prázdná",
15391541
"app.solution.environment": "Použitý jazyk:",

src/locales/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@
653653
"app.exercise.detach": "Detach",
654654
"app.exercise.detailTitle": "Exercise description",
655655
"app.exercise.difficulty": "Difficulty",
656+
"app.exercise.exerciseReadyToAssign": "The exercise is ready to be assigned. You may do this directly on the assignments page of selected group, or assign it simultaneously to multiple groups using form on Assignments page.",
656657
"app.exercise.forked": "Forked from",
657658
"app.exercise.groups": "Groups of Residence",
658659
"app.exercise.isBroken": "Exercise configuration is incomplete and needs fixing.",
@@ -1365,6 +1366,8 @@
13651366
"app.resubmitSolution.resubmitNondebug": "Resubmit (normal mode)",
13661367
"app.resultsArchiveInfoBox.description": "Detailed logs and dumps",
13671368
"app.resultsArchiveInfoBox.title": "Results archive",
1369+
"app.resultsTable.cancelOnlyShowMe": "Show all students in the group",
1370+
"app.resultsTable.onlyShowMe": "Hide everyone except for myself",
13681371
"app.resultsTable.total": "Total",
13691372
"app.reviewedSolution.revoke": "Revoke Review",
13701373
"app.reviewedSolution.set": "Review",
@@ -1533,7 +1536,6 @@
15331536
"app.solution.allSolutions": "all solutions",
15341537
"app.solution.anotherAcceptedWarning": "Another solution has been marked as accepted. Points of this solution are not taken into account.",
15351538
"app.solution.anotherBestWarning": "Another solution is considered as the best (i.e., it has gained more points or it has the same points but it was submitted later).",
1536-
"app.solution.dotnetResubmitTemporaryDisabled": "Debug Resubmit Temporary Disabled",
15371539
"app.solution.editNoteModalTitle": "Edit Solution Note",
15381540
"app.solution.emptyNote": "empty",
15391541
"app.solution.environment": "Used language:",

src/pages/Exercise/Exercise.js

Lines changed: 64 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { connect } from 'react-redux';
55
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
66
import { Row, Col } from 'react-bootstrap';
77
import { Link } from 'react-router-dom';
8+
import { withRouter } from 'react-router';
89

910
import Button, { TheButtonGroup } from '../../components/widgets/TheButton';
1011
import Page from '../../components/layout/Page';
@@ -16,10 +17,11 @@ import ResourceRenderer from '../../components/helpers/ResourceRenderer';
1617
import ReferenceSolutionsTable from '../../components/Exercises/ReferenceSolutionsTable';
1718
import SubmitSolutionContainer from '../../containers/SubmitSolutionContainer';
1819
import Box from '../../components/widgets/Box';
19-
import { ExerciseIcon, DetailIcon, DeleteIcon } from '../../components/icons';
20+
import { ExerciseIcon, DetailIcon, DeleteIcon, SendIcon, LinkIcon } from '../../components/icons';
2021
import Confirm from '../../components/forms/Confirm';
21-
import ExerciseCallouts, { exerciseCalloutsAreVisible } from '../../components/Exercises/ExerciseCallouts';
22+
import ExerciseCallouts from '../../components/Exercises/ExerciseCallouts';
2223
import ForkExerciseForm from '../../components/forms/ForkExerciseForm';
24+
import Callout from '../../components/widgets/Callout';
2325

2426
import { isSubmitting } from '../../redux/selectors/submission';
2527
import {
@@ -95,6 +97,17 @@ class Exercise extends Component {
9597
this.setState({ forkId: Math.random().toString() });
9698
};
9799

100+
createReferenceSolution = () => {
101+
const { userId, initCreateReferenceSolution, history, location } = this.props;
102+
103+
const scrollPosition = window.scrollY;
104+
window.location.hash = '';
105+
history.replace(location.pathname + location.search);
106+
window.setTimeout(() => window.scrollTo(0, scrollPosition), 0);
107+
108+
initCreateReferenceSolution(userId);
109+
};
110+
98111
render() {
99112
const {
100113
userId,
@@ -104,7 +117,6 @@ class Exercise extends Component {
104117
submitting,
105118
referenceSolutions,
106119
intl: { formatMessage, locale },
107-
initCreateReferenceSolution,
108120
deleteReferenceSolution,
109121
groups,
110122
groupsAccessor,
@@ -114,7 +126,7 @@ class Exercise extends Component {
114126
detachingGroupId,
115127
attachExerciseToGroup,
116128
detachExerciseFromGroup,
117-
links: { EXERCISE_REFERENCE_SOLUTION_URI_FACTORY },
129+
links: { EXERCISE_REFERENCE_SOLUTION_URI_FACTORY, EXERCISE_ASSIGNMENTS_URI_FACTORY },
118130
} = this.props;
119131

120132
const { forkId } = this.state;
@@ -134,29 +146,25 @@ class Exercise extends Component {
134146
canViewAssignments={hasPermissions(exercise, 'viewAssignments')}
135147
/>
136148

137-
{exerciseCalloutsAreVisible(exercise) && (
138-
<Row>
139-
<Col sm={12}>
140-
<ExerciseCallouts {...exercise} />
141-
</Col>
142-
</Row>
143-
)}
149+
<Row>
150+
<Col sm={12}>
151+
<ExerciseCallouts {...exercise} />
144152

145-
{hasPermissions(exercise, 'fork') && (
146-
<Row>
147-
<Col sm={12} className="em-margin-bottom">
148-
<ForkExerciseForm
149-
exerciseId={exercise.id}
150-
groups={groups}
151-
forkId={forkId}
152-
onSubmit={formData => forkExercise(forkId, formData)}
153-
resetId={this.reset}
154-
groupsAccessor={groupsAccessor}
155-
initialValues={FORK_EXERCISE_FORM_INITIAL_VALUES}
156-
/>
157-
</Col>
158-
</Row>
159-
)}
153+
{!exercise.isLocked && !exercise.isBroken && exercise.hasReferenceSolutions && (
154+
<Callout variant="success" icon={<SendIcon />} className="text-muted">
155+
<p>
156+
<FormattedMessage
157+
id="app.exercise.exerciseReadyToAssign"
158+
defaultMessage="The exercise is ready to be assigned. You may do this directly on the assignments page of selected group, or assign it simultaneously to multiple groups using form on Assignments page."
159+
/>
160+
<Link to={EXERCISE_ASSIGNMENTS_URI_FACTORY(exercise.id)}>
161+
<LinkIcon gapLeft className="text-muted" />
162+
</Link>
163+
</p>
164+
</Callout>
165+
)}
166+
</Col>
167+
</Row>
160168

161169
<Row>
162170
<Col xl={6}>
@@ -186,7 +194,7 @@ class Exercise extends Component {
186194
<div className="text-center">
187195
<Button
188196
variant={exercise.isBroken ? 'secondary' : 'success'}
189-
onClick={() => initCreateReferenceSolution(userId)}
197+
onClick={this.createReferenceSolution}
190198
disabled={exercise.isBroken}>
191199
{exercise.isBroken ? (
192200
<FormattedMessage
@@ -267,6 +275,25 @@ class Exercise extends Component {
267275
</ResourceRenderer>
268276
</Col>
269277
</Row>
278+
279+
{hasPermissions(exercise, 'fork') && (
280+
<>
281+
<hr />
282+
<Row>
283+
<Col sm={12}>
284+
<ForkExerciseForm
285+
exerciseId={exercise.id}
286+
groups={groups}
287+
forkId={forkId}
288+
onSubmit={formData => forkExercise(forkId, formData)}
289+
resetId={this.reset}
290+
groupsAccessor={groupsAccessor}
291+
initialValues={FORK_EXERCISE_FORM_INITIAL_VALUES}
292+
/>
293+
</Col>
294+
</Row>
295+
</>
296+
)}
270297
</div>
271298
)}
272299
</Page>
@@ -299,6 +326,15 @@ Exercise.propTypes = {
299326
forkExercise: PropTypes.func.isRequired,
300327
attachExerciseToGroup: PropTypes.func.isRequired,
301328
detachExerciseFromGroup: PropTypes.func.isRequired,
329+
history: PropTypes.shape({
330+
push: PropTypes.func.isRequired,
331+
replace: PropTypes.func.isRequired,
332+
}),
333+
location: PropTypes.shape({
334+
pathname: PropTypes.string.isRequired,
335+
search: PropTypes.string.isRequired,
336+
hash: PropTypes.string.isRequired,
337+
}).isRequired,
302338
};
303339

304340
export default withLinks(
@@ -342,5 +378,5 @@ export default withLinks(
342378
attachExerciseToGroup: groupId => dispatch(attachExerciseToGroup(exerciseId, groupId)),
343379
detachExerciseFromGroup: groupId => dispatch(detachExerciseFromGroup(exerciseId, groupId)),
344380
})
345-
)(injectIntl(Exercise))
381+
)(injectIntl(withRouter(Exercise)))
346382
);

0 commit comments

Comments
 (0)