From ad833a53dc8c9035b1ab2a1bec9dce1745eb271d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Tue, 7 Jul 2015 09:22:46 +0200 Subject: [PATCH 1/2] fix loading feedback for piece list --- js/actions/piece_list_actions.js | 3 ++- js/components/ascribe_accordion_list/accordion_list.js | 7 ++++--- js/components/piece_list.js | 1 + js/stores/piece_list_store.js | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/js/actions/piece_list_actions.js b/js/actions/piece_list_actions.js index 2d5f6447..eb9a5403 100644 --- a/js/actions/piece_list_actions.js +++ b/js/actions/piece_list_actions.js @@ -28,7 +28,8 @@ class PieceListActions { 'pieceListCount': res.count }); resolve(); - }); + }) + .catch((err) => reject(err)); }); } fetchPieceRequestActions() { diff --git a/js/components/ascribe_accordion_list/accordion_list.js b/js/components/ascribe_accordion_list/accordion_list.js index 454e6dbc..597581db 100644 --- a/js/components/ascribe_accordion_list/accordion_list.js +++ b/js/components/ascribe_accordion_list/accordion_list.js @@ -6,7 +6,8 @@ let AccordionList = React.createClass({ propTypes: { className: React.PropTypes.string, children: React.PropTypes.arrayOf(React.PropTypes.element).isRequired, - loadingElement: React.PropTypes.element + loadingElement: React.PropTypes.element, + count: React.PropTypes.number }, render() { @@ -16,10 +17,10 @@ let AccordionList = React.createClass({ {this.props.children} ); - } else if(this.props.itemList.length === 0) { + } else if(this.props.count === 0) { return (
-

You don't have any works yet...

+

We could not find any works related to you...

To register one, click here!

); diff --git a/js/components/piece_list.js b/js/components/piece_list.js index 08ac9bab..f0b5a41c 100644 --- a/js/components/piece_list.js +++ b/js/components/piece_list.js @@ -76,6 +76,7 @@ let PieceList = React.createClass({ className="ascribe-accordion-list" changeOrder={this.accordionChangeOrder} itemList={this.state.pieceList} + count={this.state.pieceListCount} orderBy={this.state.orderBy} orderAsc={this.state.orderAsc} search={this.state.search} diff --git a/js/stores/piece_list_store.js b/js/stores/piece_list_store.js index 4e536c26..e18dbc31 100644 --- a/js/stores/piece_list_store.js +++ b/js/stores/piece_list_store.js @@ -19,7 +19,7 @@ class PieceListStore { * the number of items the resource actually - without pagination - provides. */ this.pieceList = []; - this.pieceListCount = 0; + this.pieceListCount = -1; this.page = 1; this.pageSize = 10; this.search = ''; From ae9e2e6a287ea3c800e1c5639c099a5f181bf744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Tue, 7 Jul 2015 09:31:56 +0200 Subject: [PATCH 2/2] if user has piece with one edition, do not display show editions --- js/components/piece_list.js | 17 ++++++++++++----- sass/ascribe_accordion_list.scss | 5 ++++- sass/ascribe_piece_list_toolbar.scss | 3 --- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/js/components/piece_list.js b/js/components/piece_list.js index f0b5a41c..1cf1f649 100644 --- a/js/components/piece_list.js +++ b/js/components/piece_list.js @@ -83,15 +83,22 @@ let PieceList = React.createClass({ page={this.state.page} pageSize={this.state.pageSize} loadingElement={loadingElement}> - {this.state.pieceList.map((item, i) => { + {this.state.pieceList.map((piece, i) => { + + let editionsTableForPiece; + + if(piece.num_editions !== 1) { + editionsTableForPiece = ; + } + return ( - + {editionsTableForPiece} ); })} diff --git a/sass/ascribe_accordion_list.scss b/sass/ascribe_accordion_list.scss index ffeaf3e3..8b4d0ac9 100644 --- a/sass/ascribe_accordion_list.scss +++ b/sass/ascribe_accordion_list.scss @@ -8,6 +8,10 @@ $ascribe-accordion-list-font: 'Source Sans Pro'; padding-left:0; padding-right:0; + margin-top: 3em; + &::first-child { + margin-top:0; + } overflow:hidden; @@ -67,7 +71,6 @@ $ascribe-accordion-list-font: 'Source Sans Pro'; .ascribe-accordion-list-item-table { font-size: .9em; text-align: center; - margin-bottom: 3em; background-color: white; //border-bottom-left-radius: 1px; diff --git a/sass/ascribe_piece_list_toolbar.scss b/sass/ascribe_piece_list_toolbar.scss index 73c0bc94..e69de29b 100644 --- a/sass/ascribe_piece_list_toolbar.scss +++ b/sass/ascribe_piece_list_toolbar.scss @@ -1,3 +0,0 @@ -.ascribe-piece-list-toolbar { - margin-bottom: 1.5em; -} \ No newline at end of file