2015-05-19 17:13:09 +02:00
|
|
|
import React from 'react';
|
2015-05-20 11:32:56 +02:00
|
|
|
import AltContainer from 'alt/AltContainer';
|
2015-05-19 17:13:09 +02:00
|
|
|
|
|
|
|
import PieceListStore from '../stores/piece_list_store';
|
|
|
|
import PieceListActions from '../actions/piece_list_actions';
|
2015-05-20 15:22:29 +02:00
|
|
|
|
2015-05-21 15:14:05 +02:00
|
|
|
import Table from './ascribe_table/table';
|
|
|
|
import TableItemImg from './ascribe_table/table_item_img';
|
|
|
|
import TableItemText from './ascribe_table/table_item_text';
|
2015-05-19 17:13:09 +02:00
|
|
|
|
2015-05-21 16:02:42 +02:00
|
|
|
import TableColumnModel from '../models/table_column_model';
|
|
|
|
|
2015-05-21 17:54:27 +02:00
|
|
|
import Pagination from './pagination'
|
2015-05-19 17:13:09 +02:00
|
|
|
|
2015-05-20 16:44:45 +02:00
|
|
|
|
2015-05-19 17:16:01 +02:00
|
|
|
let PieceList = React.createClass({
|
2015-05-20 11:32:56 +02:00
|
|
|
|
2015-05-21 17:54:27 +02:00
|
|
|
// FIXME: this might be useless
|
2015-05-21 12:12:25 +02:00
|
|
|
getInitialState() {
|
|
|
|
return PieceListStore.getState();
|
|
|
|
},
|
|
|
|
|
2015-05-19 17:13:09 +02:00
|
|
|
componentDidMount() {
|
2015-05-21 17:54:27 +02:00
|
|
|
let page = this.props.query.page || this.state.page;
|
|
|
|
PieceListActions.fetchList(page, this.state.pageSize, this.state.search,
|
|
|
|
this.state.orderBy, this.state.orderAsc);
|
2015-05-19 17:13:09 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
render() {
|
2015-05-21 16:02:42 +02:00
|
|
|
let columnList = [
|
|
|
|
new TableColumnModel('thumbnail', '', TableItemImg, 2, false),
|
|
|
|
new TableColumnModel('artist_name', 'Artist', TableItemText, 4, true),
|
|
|
|
new TableColumnModel('title', 'Title', TableItemText, 4, true)
|
|
|
|
];
|
2015-05-20 19:19:57 +02:00
|
|
|
|
2015-05-19 17:13:09 +02:00
|
|
|
return (
|
2015-05-20 19:19:57 +02:00
|
|
|
<AltContainer store={PieceListStore} actions={PieceListActions}>
|
2015-05-21 16:02:42 +02:00
|
|
|
<Table columnList={columnList} />
|
2015-05-21 17:54:27 +02:00
|
|
|
<Pagination currentPage={this.props.query.page} />
|
2015-05-20 11:32:56 +02:00
|
|
|
</AltContainer>
|
2015-05-19 17:13:09 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default PieceList;
|