1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-11 05:29:06 +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>
<h3>{getLangText('by %s', this.props.content.artist_name)}</h3>
<div>
<span>{this.props.content.date_created.split('-')[0]}</span>
<span>{this.props.content.date_created.split('-')[0]}, </span>
<AccordionListItemEditionWidget
piece={this.props.content}/>
{/* <a href={this.props.content.license_type.url} target="_blank" className="pull-right">
{getLangText('%s license', this.props.content.license_type.code)}
</a> */}
</div>
</div>
<span style={{'clear': 'both'}}></span>
@ -96,6 +95,7 @@ let AccordionListItem = React.createClass({
</div>
</div>
</div>
{/* this.props.children is AccordionListItemTableEditions */}
{this.props.children}
</div>
);

View File

@ -73,14 +73,22 @@ let AccordionListItemEditionWidget = React.createClass({
let piece = this.props.piece;
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 : '';
return (
<span
onClick={this.toggleTable}
className="ascribe-accordion-list-item-edition-widget">
{', ' + editionMapping + ' ' + getLangText('Edition')} {this.getGlyphicon()}
{editionMapping + ' ' + getLangText('Edition')} {this.getGlyphicon()}
</span>
);
} else {
@ -88,7 +96,7 @@ let AccordionListItemEditionWidget = React.createClass({
<span
onClick={this.toggleTable}
className="ascribe-accordion-list-item-edition-widget">
{', ' + numEditions + ' ' + getLangText('Editions')} {this.getGlyphicon()}
{numEditions + ' ' + getLangText('Editions')} {this.getGlyphicon()}
</span>
);
}