1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 09:35:10 +01:00
onion/js/components/edition.js

91 lines
3.5 KiB
JavaScript
Raw Normal View History

import React from 'react';
2015-05-27 17:34:15 +02:00
import ResourceViewer from './ascribe_media/resource_viewer';
2015-05-27 09:34:49 +02:00
2015-06-01 13:02:53 +02:00
import LoanModalButton from './ascribe_modal/modal_loan';
import ConsignModalButton from './ascribe_modal/modal_consign';
2015-05-29 16:53:30 +02:00
import UnConsignModalButton from './ascribe_modal/modal_unconsign';
import UnConsignRequestModalButton from './ascribe_modal/modal_unconsign_request';
import TransferModalButton from './ascribe_modal/modal_transfer';
2015-05-27 09:34:49 +02:00
import ShareModalButton from './ascribe_modal/modal_share';
2015-05-26 10:41:41 +02:00
/**
2015-05-26 10:52:20 +02:00
* This is the component that implements display-specific functionality
2015-05-26 10:41:41 +02:00
*/
2015-05-26 13:48:46 +02:00
let Edition = React.createClass({
2015-05-26 13:33:35 +02:00
render() {
2015-05-27 17:34:15 +02:00
let thumbnail = this.props.edition.thumbnail;
let mimetype = this.props.edition.digital_work.mime;
2015-05-26 13:33:35 +02:00
return (
<div>
<div className="col-md-7">
2015-05-27 17:34:15 +02:00
<ResourceViewer thumbnail={thumbnail}
mimetype={mimetype}
/>
2015-05-26 13:33:35 +02:00
</div>
<div className="col-md-5">
2015-05-26 14:58:11 +02:00
<EditionHeader edition={this.props.edition}/>
2015-05-27 09:34:49 +02:00
<EditionDetails edition={this.props.edition} currentUser={ this.props.currentUser }/>
2015-05-26 13:33:35 +02:00
</div>
2015-05-26 16:46:02 +02:00
2015-05-26 13:33:35 +02:00
</div>
);
}
});
2015-05-26 13:48:46 +02:00
let EditionHeader = React.createClass({
2015-05-26 13:33:35 +02:00
render() {
2015-05-26 15:31:28 +02:00
var title_html = <div className="ascribe-detail-title">{this.props.edition.title}</div>;
2015-05-26 13:33:35 +02:00
return (
<div className="ascribe-detail-header">
2015-05-26 15:31:28 +02:00
<EditionDetailProperty label="title" value={title_html} />
<EditionDetailProperty label="by" value={this.props.edition.artist_name} />
<EditionDetailProperty label="date" value={ this.props.edition.date_created.slice(0,4) } />
2015-05-26 13:33:35 +02:00
<hr/>
</div>
);
}
});
2015-05-26 13:48:46 +02:00
let EditionDetails = React.createClass({
2015-05-26 13:33:35 +02:00
render() {
return (
<div className="ascribe-detail-header">
2015-05-26 15:31:28 +02:00
<EditionDetailProperty label="edition"
value={this.props.edition.edition_number + " of " + this.props.edition.num_editions} />
<EditionDetailProperty label="id" value={ this.props.edition.bitcoin_id } />
<EditionDetailProperty label="owner" value={ this.props.edition.owner } />
2015-05-27 15:53:26 +02:00
<br/>
2015-06-01 13:02:53 +02:00
<LoanModalButton edition={ this.props.edition } currentUser={ this.props.currentUser }/>
<ConsignModalButton edition={ this.props.edition } currentUser={ this.props.currentUser }/>
2015-05-29 16:53:30 +02:00
<UnConsignModalButton edition={ this.props.edition } currentUser={ this.props.currentUser }/>
<UnConsignRequestModalButton edition={ this.props.edition } currentUser={ this.props.currentUser }/>
<TransferModalButton edition={ this.props.edition } currentUser={ this.props.currentUser }/>
2015-05-27 09:34:49 +02:00
<ShareModalButton edition={ this.props.edition } currentUser={ this.props.currentUser }/>
2015-05-26 15:31:28 +02:00
<hr/>
</div>
);
2015-05-27 09:34:49 +02:00
2015-05-26 15:31:28 +02:00
}
});
let EditionDetailProperty = React.createClass({
render() {
return (
<div className="row ascribe-detail-property">
<div className="row-same-height">
<div className="col-xs-2 col-xs-height col-bottom">
<div>{ this.props.label }:</div>
2015-05-26 13:33:35 +02:00
</div>
2015-05-26 15:31:28 +02:00
<div className="col-xs-10 col-xs-height col-bottom">
<div>{ this.props.value }</div>
2015-05-26 13:33:35 +02:00
</div>
</div>
</div>
);
}
});
2015-05-26 16:46:02 +02:00
2015-05-27 09:34:49 +02:00
export default Edition;