1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-11 13:33:46 +01:00

add boilerplate code for creating an edition

This commit is contained in:
Tim Daubenschütz 2015-07-09 17:56:27 +02:00
parent 5f459aa139
commit 2e8e86c62f
2 changed files with 13 additions and 5 deletions

View File

@ -81,13 +81,12 @@ let AccordionListItem = React.createClass({
</Link> </Link>
<h3>{getLangText('by %s', this.props.content.artist_name)}</h3> <h3>{getLangText('by %s', this.props.content.artist_name)}</h3>
<div> <div>
<span>{this.props.content.date_created.split('-')[0]}</span> <span>{this.props.content.date_created.split('-')[0]}, </span>
<AccordionListItemEditionWidget <AccordionListItemEditionWidget
piece={this.props.content}/> piece={this.props.content}/>
{/* <a href={this.props.content.license_type.url} target="_blank" className="pull-right"> {/* <a href={this.props.content.license_type.url} target="_blank" className="pull-right">
{getLangText('%s license', this.props.content.license_type.code)} {getLangText('%s license', this.props.content.license_type.code)}
</a> */} </a> */}
</div> </div>
</div> </div>
<span style={{'clear': 'both'}}></span> <span style={{'clear': 'both'}}></span>
@ -96,6 +95,7 @@ let AccordionListItem = React.createClass({
</div> </div>
</div> </div>
</div> </div>
{/* this.props.children is AccordionListItemTableEditions */}
{this.props.children} {this.props.children}
</div> </div>
); );

View File

@ -73,14 +73,22 @@ let AccordionListItemEditionWidget = React.createClass({
let piece = this.props.piece; let piece = this.props.piece;
let numEditions = piece.num_editions; let numEditions = piece.num_editions;
if(numEditions === 1) { if(numEditions === 0) {
return (
<span
onClick={this.toggleTable}
className="ascribe-accordion-list-item-edition-widget">
Create editions
</span>
);
} else if(numEditions === 1) {
let editionMapping = piece && piece.firstEdition ? piece.firstEdition.edition_number + '/' + piece.num_editions : ''; let editionMapping = piece && piece.firstEdition ? piece.firstEdition.edition_number + '/' + piece.num_editions : '';
return ( return (
<span <span
onClick={this.toggleTable} onClick={this.toggleTable}
className="ascribe-accordion-list-item-edition-widget"> className="ascribe-accordion-list-item-edition-widget">
{', ' + editionMapping + ' ' + getLangText('Edition')} {this.getGlyphicon()} {editionMapping + ' ' + getLangText('Edition')} {this.getGlyphicon()}
</span> </span>
); );
} else { } else {
@ -88,7 +96,7 @@ let AccordionListItemEditionWidget = React.createClass({
<span <span
onClick={this.toggleTable} onClick={this.toggleTable}
className="ascribe-accordion-list-item-edition-widget"> className="ascribe-accordion-list-item-edition-widget">
{', ' + numEditions + ' ' + getLangText('Editions')} {this.getGlyphicon()} {numEditions + ' ' + getLangText('Editions')} {this.getGlyphicon()}
</span> </span>
); );
} }