mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Fix formatting and use destructuring
This commit is contained in:
parent
989fd8ea5c
commit
7d91832d74
@ -82,6 +82,10 @@ let AccordionListItemTableEditions = React.createClass({
|
||||
editionList.orderBy, editionList.orderAsc, editionList.filterBy);
|
||||
},
|
||||
render() {
|
||||
const { className, parentId } = this.props;
|
||||
const { editionList, isEditionListOpenForPieceId, showMoreLoading } = this.state;
|
||||
const editionsForPiece = editionList[parentId];
|
||||
|
||||
let selectedEditionsCount = 0;
|
||||
let allEditionsCount = 0;
|
||||
let orderBy;
|
||||
@ -89,9 +93,6 @@ let AccordionListItemTableEditions = React.createClass({
|
||||
let show = false;
|
||||
let showExpandOption = false;
|
||||
|
||||
let editionsForPiece = this.state.editionList[this.props.parentId];
|
||||
let loadingSpinner = <AscribeSpinner size="sm" color="dark-blue" />;
|
||||
|
||||
// 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.
|
||||
@ -102,8 +103,8 @@ let AccordionListItemTableEditions = React.createClass({
|
||||
orderAsc = editionsForPiece.orderAsc;
|
||||
}
|
||||
|
||||
if(this.props.parentId in this.state.isEditionListOpenForPieceId) {
|
||||
show = this.state.isEditionListOpenForPieceId[this.props.parentId].show;
|
||||
if (parentId in isEditionListOpenForPieceId) {
|
||||
show = isEditionListOpenForPieceId[parentId].show;
|
||||
}
|
||||
|
||||
// if the number of editions in the array is equal to the maximum number of editions,
|
||||
@ -114,12 +115,12 @@ let AccordionListItemTableEditions = React.createClass({
|
||||
|
||||
let transition = new TransitionModel('editions', 'editionId', 'bitcoin_id', (e) => e.stopPropagation() );
|
||||
|
||||
let columnList = [
|
||||
const columnList = [
|
||||
new ColumnModel(
|
||||
(item) => {
|
||||
return {
|
||||
'editionId': item.id,
|
||||
'pieceId': this.props.parentId,
|
||||
'pieceId': parentId,
|
||||
'selectItem': this.selectItem,
|
||||
'selected': item.selected
|
||||
}; },
|
||||
@ -173,11 +174,11 @@ let AccordionListItemTableEditions = React.createClass({
|
||||
)
|
||||
];
|
||||
|
||||
if(show && editionsForPiece && editionsForPiece.length > 0) {
|
||||
if (show && editionsForPiece && editionsForPiece.length) {
|
||||
return (
|
||||
<div className={this.props.className}>
|
||||
<div className={className}>
|
||||
<AccordionListItemTable
|
||||
parentId={this.props.parentId}
|
||||
parentId={parentId}
|
||||
itemList={editionsForPiece}
|
||||
columnList={columnList}
|
||||
show={show}
|
||||
@ -188,7 +189,14 @@ let AccordionListItemTableEditions = React.createClass({
|
||||
<AccordionListItemTableToggle
|
||||
className="ascribe-accordion-list-table-toggle"
|
||||
onClick={this.loadFurtherEditions}
|
||||
message={show && showExpandOption ? <span>{this.state.showMoreLoading ? loadingSpinner : <span className="glyphicon glyphicon-option-horizontal" aria-hidden="true" style={{top: 3}} />} Show me more</span> : null} />
|
||||
message={show && showExpandOption ? (
|
||||
<span>
|
||||
{showMoreLoading ? <AscribeSpinner size="sm" color="dark-blue" />
|
||||
: <span className="glyphicon glyphicon-option-horizontal" aria-hidden="true" style={{top: 3}} />}
|
||||
{getLangText('Show me more')}
|
||||
</span>
|
||||
) : null
|
||||
} />
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user