diff --git a/js/actions/edition_list_actions.js b/js/actions/edition_list_actions.js index e36ae1b0..c54bc6fd 100644 --- a/js/actions/edition_list_actions.js +++ b/js/actions/edition_list_actions.js @@ -10,6 +10,7 @@ class EditionListActions { 'updateEditionList', 'selectEdition', 'clearAllEditionSelections', + 'closeAllEditionLists', 'toggleEditionList' ); } diff --git a/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js b/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js index ea5d9d94..ed717c57 100644 --- a/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js +++ b/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js @@ -59,8 +59,13 @@ let AccordionListItemTableEditions = React.createClass({ }, toggleTable() { - // This is triggered everytime show all editions is clicked, which is wrong - EditionListActions.fetchEditionList(this.props.parentId); + let isEditionListOpen = this.state.isEditionListOpenForPieceId[this.props.parentId] ? this.state.isEditionListOpenForPieceId[this.props.parentId].show : false; + if(isEditionListOpen) { + EditionListActions.toggleEditionList(this.props.parentId); + } else { + EditionListActions.toggleEditionList(this.props.parentId); + EditionListActions.fetchEditionList(this.props.parentId); + } }, changeEditionListOrder(orderBy, orderAsc) { @@ -84,8 +89,8 @@ let AccordionListItemTableEditions = React.createClass({ orderAsc = this.state.editionList[this.props.parentId].orderAsc; } - if(this.props.parentId in this.state.editionOpenList) { - show = this.state.editionOpenList[this.props.parentId].show; + if(this.props.parentId in this.state.isEditionListOpenForPieceId) { + show = this.state.isEditionListOpenForPieceId[this.props.parentId].show; } let transition = new TransitionModel('edition', 'editionId', 'bitcoin_id'); diff --git a/js/components/ascribe_buttons/delete_button.js b/js/components/ascribe_buttons/delete_button.js index e52ff119..1b2a7748 100644 --- a/js/components/ascribe_buttons/delete_button.js +++ b/js/components/ascribe_buttons/delete_button.js @@ -23,12 +23,13 @@ let DeleteButton = React.createClass({ mixins: [Router.Navigation], - showNotification(response){ + showNotification(response) { this.props.editions .forEach((edition) => { EditionListActions.fetchEditionList(edition.parent); }); EditionListActions.clearAllEditionSelections(); + EditionListActions.closeAllEditionLists(); this.transitionTo('pieces'); let notification = new GlobalNotificationModel(response.notification, 'success'); GlobalNotificationActions.appendGlobalNotification(notification); diff --git a/js/components/ascribe_forms/form_loan.js b/js/components/ascribe_forms/form_loan.js index 2623c8bb..ae4ca49e 100644 --- a/js/components/ascribe_forms/form_loan.js +++ b/js/components/ascribe_forms/form_loan.js @@ -52,7 +52,7 @@ let LoanForm = React.createClass({ loaneeHasContract: true }); } - else{ + else { this.resetLoanContract(); } }) @@ -63,10 +63,11 @@ let LoanForm = React.createClass({ }, resetLoanContract(){ - this.setState({contract_key: null, - contract_url: null, - loaneeHasContract: false - }); + this.setState({ + contract_key: null, + contract_url: null, + loaneeHasContract: false + }); }, renderForm() { diff --git a/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js b/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js index d3e7f127..c50c09fd 100644 --- a/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js +++ b/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js @@ -65,6 +65,7 @@ let PieceListBulkModal = React.createClass({ clearAllSelections() { EditionListActions.clearAllEditionSelections(); + EditionListActions.closeAllEditionLists(); }, handleSuccess() { diff --git a/js/components/header.js b/js/components/header.js index 140aeead..2ad26657 100644 --- a/js/components/header.js +++ b/js/components/header.js @@ -38,7 +38,7 @@ let Header = React.createClass({ return (