-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: show all submissions of a solution
- Loading branch information
Showing
12 changed files
with
210 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 43 additions & 36 deletions
79
...omponents/ReferenceSolutions/ReferenceSolutionEvaluations/ReferenceSolutionEvaluations.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,55 @@ | ||
import React, { Component } from 'react'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { defineMessages, intlShape, injectIntl } from 'react-intl'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import { Link } from 'react-router'; | ||
|
||
import Box from '../../widgets/Box'; | ||
import EvaluationTable from '../EvaluationTable'; | ||
import withLinks from '../../../hoc/withLinks'; | ||
|
||
const messages = defineMessages({ | ||
title: { | ||
id: 'app.referenceSolutionEvaluation.title', | ||
defaultMessage: 'Evaluations of reference solution' | ||
} | ||
}); | ||
|
||
class ReferenceSolutionEvaluations extends Component { | ||
render() { | ||
const { | ||
evaluations, | ||
referenceSolutionId, | ||
exerciseId, | ||
intl: { formatMessage } | ||
} = this.props; | ||
|
||
return ( | ||
<Box | ||
title={formatMessage(messages.title)} | ||
noPadding={true} | ||
collapsable={true} | ||
isOpen={true} | ||
> | ||
<EvaluationTable | ||
evaluations={evaluations} | ||
referenceSolutionId={referenceSolutionId} | ||
exerciseId={exerciseId} | ||
/> | ||
</Box> | ||
); | ||
} | ||
} | ||
const ReferenceSolutionEvaluations = ({ | ||
evaluations, | ||
referenceSolutionId, | ||
exerciseId, | ||
links: { REFERENCE_SOLUTION_EVALUATION_URI_FACTORY } | ||
}) => | ||
<Box | ||
title={ | ||
<FormattedMessage | ||
id="app.referenceSolutionEvaluation.title" | ||
defaultMessage="Evaluations of reference solution" | ||
/> | ||
} | ||
noPadding={true} | ||
collapsable={true} | ||
isOpen={true} | ||
> | ||
<EvaluationTable | ||
evaluations={evaluations} | ||
renderButtons={id => | ||
<td className="text-right"> | ||
<Link | ||
to={REFERENCE_SOLUTION_EVALUATION_URI_FACTORY( | ||
exerciseId, | ||
referenceSolutionId, | ||
id | ||
)} | ||
className="btn btn-flat btn-default btn-xs" | ||
> | ||
<FormattedMessage | ||
id="app.evaluationTable.showDetails" | ||
defaultMessage="Show details" | ||
/> | ||
</Link> | ||
</td>} | ||
/> | ||
</Box>; | ||
|
||
ReferenceSolutionEvaluations.propTypes = { | ||
evaluations: PropTypes.array.isRequired, | ||
referenceSolutionId: PropTypes.string.isRequired, | ||
exerciseId: PropTypes.string.isRequired, | ||
intl: intlShape.isRequired | ||
links: PropTypes.object | ||
}; | ||
|
||
export default injectIntl(ReferenceSolutionEvaluations); | ||
export default withLinks(ReferenceSolutionEvaluations); |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/components/Submissions/SubmissionEvaluations/SubmissionEvaluations.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import Button from '../../widgets/FlatButton'; | ||
|
||
import Box from '../../widgets/Box'; | ||
import EvaluationTable from '../../ReferenceSolutions/EvaluationTable'; | ||
import withLinks from '../../../hoc/withLinks'; | ||
|
||
const SubmissionEvaluations = ({ | ||
evaluations, | ||
submissionId, | ||
assignmentId, | ||
activeSubmissionId, | ||
onSelect, | ||
links: { REFERENCE_SOLUTION_EVALUATION_URI_FACTORY } | ||
}) => | ||
<Box | ||
title={ | ||
<FormattedMessage | ||
id="app.submissionEvaluation.title" | ||
defaultMessage="Other submissions of this solution" | ||
/> | ||
} | ||
noPadding={true} | ||
collapsable={true} | ||
isOpen={true} | ||
> | ||
<EvaluationTable | ||
evaluations={evaluations} | ||
renderButtons={id => | ||
<td className="text-right"> | ||
{id === activeSubmissionId | ||
? <Button bsStyle="success" bsSize="xs" disabled> | ||
<FormattedMessage | ||
id="app.submissionEvaluation.active" | ||
defaultMessage="Active" | ||
/> | ||
</Button> | ||
: <Button | ||
bsStyle="primary" | ||
bsSize="xs" | ||
onClick={() => onSelect(id)} | ||
> | ||
<FormattedMessage | ||
id="app.submissionEvaluation.select" | ||
defaultMessage="Select" | ||
/> | ||
</Button>} | ||
</td>} | ||
/> | ||
</Box>; | ||
|
||
SubmissionEvaluations.propTypes = { | ||
evaluations: PropTypes.array.isRequired, | ||
submissionId: PropTypes.string.isRequired, | ||
assignmentId: PropTypes.string.isRequired, | ||
activeSubmissionId: PropTypes.string.isRequired, | ||
onSelect: PropTypes.func.isRequired, | ||
links: PropTypes.object | ||
}; | ||
|
||
export default withLinks(SubmissionEvaluations); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default from './SubmissionEvaluations'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.