Skip to content

Commit

Permalink
Merge branch 'simple_exercise_form' of github.com:ReCodEx/web-app int…
Browse files Browse the repository at this point in the history
…o simple_exercise_form
  • Loading branch information
SemaiCZE committed Dec 7, 2017
2 parents b1b4ab0 + 50cf7dd commit c4c0fc1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 212 deletions.
20 changes: 20 additions & 0 deletions src/components/forms/EditTestsForm/EditTestsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ import { Alert } from 'react-bootstrap';
import EditTestsTest from './EditTestsTest';
import { CheckboxField } from '../Fields';
import SubmitButton from '../SubmitButton';
import Button from '../../widgets/FlatButton';
import { RefreshIcon } from '../../icons';

class EditTestsForm extends Component {
render() {
const {
dirty,
submitting,
handleSubmit,
reset,
hasFailed = false,
hasSucceeded = false,
invalid,
Expand Down Expand Up @@ -50,6 +53,22 @@ class EditTestsForm extends Component {
/>

<div className="text-center">
{dirty &&
<span>
<Button
type="reset"
onClick={reset}
bsStyle={'danger'}
className="btn-flat"
>
<RefreshIcon /> &nbsp;
<FormattedMessage
id="app.editTestsForm.reset"
defaultMessage="Reset"
/>
</Button>{' '}
</span>}

<SubmitButton
id="editTests"
invalid={invalid}
Expand Down Expand Up @@ -88,6 +107,7 @@ class EditTestsForm extends Component {
EditTestsForm.propTypes = {
values: PropTypes.array,
handleSubmit: PropTypes.func.isRequired,
reset: PropTypes.func.isRequired,
dirty: PropTypes.bool,
submitting: PropTypes.bool,
hasFailed: PropTypes.bool,
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/EditTestsForm/EditTestsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const EditTestsTest = ({ fields, isUniform, testValues }) => {
<div style={{ textAlign: 'right' }}>
<Button
onClick={() =>
fields.push({ name: `Test ${fields.length}`, weight: 100 })}
fields.push({ name: 'Test ' + (fields.length + 1), weight: '100' })}
bsStyle={'primary'}
className="btn-flat"
>
Expand Down
Loading

0 comments on commit c4c0fc1

Please sign in to comment.