Skip to content

Commit

Permalink
Merge pull request #142 from calblueprint/julian/click-out
Browse files Browse the repository at this point in the history
Click out of submission modal if it errors
  • Loading branch information
didvi authored May 11, 2020
2 parents 36b9074 + 42e548f commit e719caf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 11 additions & 0 deletions app/javascript/components/ActionItemCreationPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,18 @@ class ActionItemCreationPage extends React.Component {
this.handleOpenModal = this.handleOpenModal.bind(this);
this.editActionItem = this.editActionItem.bind(this);
this.reloadPage = this.reloadPage.bind(this);
this.handleExitSubmitModal = this.handleExitSubmitModal.bind(this);
}

reloadPage() {
window.location.href = '/assignments';
}

// Only passed to LoadModal if submissionStatus == 'error'
handleExitSubmitModal() {
this.setState({ submissionStatus: null });
}

checkActionItemsEqual(actionItem1, actionItem2) {
return (
actionItem1.title === actionItem2.title &&
Expand Down Expand Up @@ -589,6 +595,11 @@ class ActionItemCreationPage extends React.Component {
? this.reloadPage
: this.handleSubmit
}
handleClose={
this.state.submissionStatus === 'error'
? this.handleExitSubmitModal
: null
}
/>
<Snackbar
open={this.state.submitFailed}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class ActionItemSearchParticipants extends React.Component {
ActionItemSearchParticipants.propTypes = {
classes: PropTypes.object.isRequired,
participants: PropTypes.array.isRequired,
statuses: PropTypes.array.isRequired,
statuses: PropTypes.object.isRequired,
selectedParticipants: PropTypes.array.isRequired,
addUser: PropTypes.func.isRequired,
removeUser: PropTypes.func.isRequired,
Expand Down
4 changes: 3 additions & 1 deletion app/javascript/components/LoadModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '@material-ui/core';
import styles from './styles';

function LoadModal({ classes, open, status, handleClick }) {
function LoadModal({ classes, open, status, handleClick, handleClose }) {
const getText = () => {
let titleText;
let buttonText;
Expand Down Expand Up @@ -58,6 +58,7 @@ function LoadModal({ classes, open, status, handleClick }) {
open={open}
fullWidth
classes={{ paper: classes.modalStyle }}
onClose={handleClose}
onExited={() =>
// Avoid blurring document.body on IE9 since it blurs the entire window
document.activeElement !== document.body
Expand Down Expand Up @@ -112,5 +113,6 @@ LoadModal.propTypes = {
status: PropTypes.string,
open: PropTypes.bool.isRequired,
handleClick: PropTypes.func.isRequired,
handleClose: PropTypes.func,
};
export default withStyles(styles)(LoadModal);

0 comments on commit e719caf

Please sign in to comment.