2015-06-05 11:06:36 +02:00
|
|
|
'use strict';
|
|
|
|
|
2015-05-29 16:28:05 +02:00
|
|
|
import React from 'react';
|
2015-07-01 15:28:48 +02:00
|
|
|
import Router from 'react-router';
|
|
|
|
|
|
|
|
import requests from '../../utils/requests';
|
2015-05-29 16:28:05 +02:00
|
|
|
|
2015-06-02 14:25:26 +02:00
|
|
|
import { getLangText } from '../../utils/lang_utils';
|
2015-06-01 11:51:03 +02:00
|
|
|
|
2015-05-29 16:28:05 +02:00
|
|
|
let AccordionListItem = React.createClass({
|
2015-07-01 15:28:48 +02:00
|
|
|
mixins: [Router.Navigation],
|
|
|
|
|
2015-05-29 16:28:05 +02:00
|
|
|
propTypes: {
|
|
|
|
className: React.PropTypes.string,
|
2015-06-05 11:06:36 +02:00
|
|
|
content: React.PropTypes.object,
|
|
|
|
children: React.PropTypes.object
|
2015-05-29 16:28:05 +02:00
|
|
|
},
|
2015-07-01 15:28:48 +02:00
|
|
|
handleClick(event){
|
|
|
|
requests.get('piece_first_edition_id', {'piece_id': this.props.content.id})
|
|
|
|
.then((res) => this.transitionTo('edition', {editionId: res.bitcoin_id}));
|
2015-05-29 16:28:05 +02:00
|
|
|
|
2015-07-01 15:28:48 +02:00
|
|
|
console.log(event.target);
|
|
|
|
},
|
2015-05-29 16:28:05 +02:00
|
|
|
render() {
|
|
|
|
return (
|
2015-06-01 11:51:03 +02:00
|
|
|
<div className="row">
|
|
|
|
<div className={this.props.className}>
|
|
|
|
<div className="wrapper">
|
2015-07-01 13:54:58 +02:00
|
|
|
<div className="col-xs-4 col-sm-3 col-md-2 col-lg-2 clear-paddings">
|
2015-07-01 15:28:48 +02:00
|
|
|
<div className="thumbnail-wrapper" onClick={this.handleClick}>
|
2015-07-01 13:54:58 +02:00
|
|
|
<img src={this.props.content.thumbnail} />
|
|
|
|
</div>
|
2015-06-01 11:51:03 +02:00
|
|
|
</div>
|
2015-07-01 13:54:58 +02:00
|
|
|
<div className="col-xs-8 col-sm-9 col-md-9 col-lg-9 col-md-offset-1 col-lg-offset-1 accordion-list-item-header">
|
2015-07-01 15:28:48 +02:00
|
|
|
<h1 onClick={this.handleClick}>{this.props.content.title}</h1>
|
2015-06-02 14:25:26 +02:00
|
|
|
<h3>{getLangText('by %s', this.props.content.artist_name)}</h3>
|
2015-07-01 13:54:58 +02:00
|
|
|
<div>
|
|
|
|
<span>{this.props.content.date_created.split('-')[0]}</span>
|
|
|
|
<a href={this.props.content.license_type.url} target="_blank" className="pull-right">
|
|
|
|
{this.props.content.license_type.code} license
|
|
|
|
</a>
|
|
|
|
</div>
|
2015-06-01 11:51:03 +02:00
|
|
|
</div>
|
|
|
|
<span style={{'clear': 'both'}}></span>
|
2015-05-29 16:28:05 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2015-06-01 11:51:03 +02:00
|
|
|
{this.props.children}
|
|
|
|
</div>
|
2015-05-29 16:28:05 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default AccordionListItem;
|