diff --git a/js/actions/edition_list_actions.js b/js/actions/edition_list_actions.js index a94001bf..f04b63c8 100644 --- a/js/actions/edition_list_actions.js +++ b/js/actions/edition_list_actions.js @@ -32,12 +32,13 @@ class EditionListActions { .fetch(pieceId, page, pageSize, orderBy, orderAsc) .then((res) => { this.actions.updateEditionList({ - 'editionListOfPiece': res.editions, pieceId, page, pageSize, orderBy, - orderAsc + orderAsc, + 'editionListOfPiece': res.editions, + 'count': res.count }); resolve(res); }) 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 af27d01f..4a5dd399 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 @@ -82,21 +82,30 @@ let AccordionListItemTableEditions = React.createClass({ let orderBy; let orderAsc; let show; + let showExpandOption = false; + + let editionsForPiece = this.state.editionList[this.props.parentId]; // here we need to check if all editions of a specific // piece are already defined. Otherwise .length will throw an error and we'll not // be notified about it. - if(this.state.editionList[this.props.parentId]) { + if(editionsForPiece) { selectedEditionsCount = this.filterSelectedEditions().length; - allEditionsCount = this.state.editionList[this.props.parentId].length; - orderBy = this.state.editionList[this.props.parentId].orderBy; - orderAsc = this.state.editionList[this.props.parentId].orderAsc; + allEditionsCount = editionsForPiece.length; + orderBy = editionsForPiece.orderBy; + orderAsc = editionsForPiece.orderAsc; } if(this.props.parentId in this.state.isEditionListOpenForPieceId) { show = this.state.isEditionListOpenForPieceId[this.props.parentId].show; } + // if the number of editions in the array is equal to the maximum number of editions, + // then the "Show me more" dialog should be hidden from the user's view + if(editionsForPiece && editionsForPiece.count > editionsForPiece.length) { + showExpandOption = true; + } + let transition = new TransitionModel('edition', 'editionId', 'bitcoin_id'); let columnList = [ @@ -165,7 +174,7 @@ let AccordionListItemTableEditions = React.createClass({ Show me more

: ''} /> + message={show && showExpandOption ?

Show me more

: ''} />