-
-
-
-
-
{this.props.content.title}
-
by {this.props.content.artist_name}
+
+
+
+
+
+
+
+
{this.props.content.title}
+ by {this.props.content.artist_name}
+
+
-
+ {this.props.children}
+
);
}
});
diff --git a/js/components/ascribe_accordion_list/accordion_list_item_table.js b/js/components/ascribe_accordion_list/accordion_list_item_table.js
new file mode 100644
index 00000000..7d545bd2
--- /dev/null
+++ b/js/components/ascribe_accordion_list/accordion_list_item_table.js
@@ -0,0 +1,78 @@
+import React from 'react';
+
+import Table from '../ascribe_table/table';
+import TableItemSelectable from '../ascribe_table/table_item_selectable';
+
+import TableColumnContentModel from '../../models/table_column_content_model';
+
+let AccordionListItemTable = React.createClass({
+ getInitialState() {
+ return {
+ 'show': false
+ };
+ },
+
+ propTypes: {
+ className: React.PropTypes.string,
+ parentId: React.PropTypes.number,
+ fetchData: React.PropTypes.func,
+ itemList: React.PropTypes.array,
+ columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnContentModel))
+ },
+
+ toggleTable() {
+ this.props.fetchData();
+ this.setState({
+ 'show': !this.state.show
+ });
+ },
+
+ render() {
+ if(this.props.itemList && this.state.show) {
+ return (
+
+
+ {this.props.itemList.map((item, i) => {
+ return (
+
+
+ );
+ })}
+
+
+
+ );
+ } else {
+ return (
+
+ );
+ }
+ }
+});
+
+let AccordionListItemTableToggle = React.createClass({
+ propTypes: {
+ className: React.PropTypes.string,
+ onClick: React.PropTypes.func
+ },
+
+ render() {
+ return (
+
Show all X Editions
+ );
+ }
+});
+
+export default AccordionListItemTable;
\ No newline at end of file
diff --git a/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js b/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js
new file mode 100644
index 00000000..c68fa739
--- /dev/null
+++ b/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js
@@ -0,0 +1,61 @@
+import React from 'react';
+
+import EditionListStore from '../../stores/edition_list_store';
+import EditionListActions from '../../actions/edition_list_actions';
+
+import AccordionListItemTable from './accordion_list_item_table';
+
+import TableColumnContentModel from '../../models/table_column_content_model';
+
+import TableItemImg from '../ascribe_table/table_item_img';
+import TableItemText from '../ascribe_table/table_item_text';
+import TableItemAcl from '../ascribe_table/table_item_acl';
+
+let AccordionListItemTableEditions = React.createClass({
+
+ propTypes: {
+ className: React.PropTypes.string,
+ parentId: React.PropTypes.number
+ },
+
+ getInitialState() {
+ return EditionListStore.getState();
+ },
+
+ onChange(state) {
+ this.setState(state);
+ },
+
+ componentDidMount() {
+ EditionListStore.listen(this.onChange);
+ },
+
+ componentDidUnmount() {
+ EditionListStore.unlisten(this.onChange);
+ },
+
+ getEditionList() {
+ EditionListActions.fetchEditionList(this.props.parentId);
+ },
+
+ render() {
+
+ let columnList = [
+ new TableColumnContentModel('edition_number', 'Nr', TableItemText, 1, false),
+ new TableColumnContentModel('bitcoin_id', 'Bitcoin Address', TableItemText, 4, false),
+ new TableColumnContentModel('acl', 'Actions', TableItemAcl, 6, false)
+ ];
+
+ return (
+
+
+ );
+ }
+});
+
+export default AccordionListItemTableEditions;
\ No newline at end of file
diff --git a/js/components/ascribe_accordion_list/table_header.js b/js/components/ascribe_accordion_list/table_header.js
deleted file mode 100644
index 8176ad31..00000000
--- a/js/components/ascribe_accordion_list/table_header.js
+++ /dev/null
@@ -1,50 +0,0 @@
-import React from 'react';
-
-import TableColumnMixin from '../../mixins/table_column_mixin';
-import GeneralUtils from '../../utils/general_utils';
-import TableHeaderItem from './table_header_item';
-
-import TableColumnContentModel from '../../models/table_column_content_model';
-
-
-let TableHeader = React.createClass({
- mixins: [TableColumnMixin],
- propTypes: {
- columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnContentModel)),
- itemList: React.PropTypes.array.isRequired,
- changeOrder: React.PropTypes.func,
- orderAsc: React.PropTypes.bool,
- orderBy: React.PropTypes.string
- },
-
- render() {
- return (
-
-
- {this.props.columnList.map((val, i) => {
-
- let columnClasses = this.calcColumnClasses(this.props.columnList, i, 12);
- let columnName = this.props.columnList[i].columnName;
- let canBeOrdered = this.props.columnList[i].canBeOrdered;
-
- return (
-
-
- );
- })}
-
-
- );
-
- }
-});
-
-export default TableHeader;
diff --git a/js/components/ascribe_accordion_list/table_header_item.js b/js/components/ascribe_accordion_list/table_header_item.js
deleted file mode 100644
index dce2261e..00000000
--- a/js/components/ascribe_accordion_list/table_header_item.js
+++ /dev/null
@@ -1,52 +0,0 @@
-import React from 'react';
-
-import TableHeaderItemCarret from './table_header_item_carret';
-
-let TableHeaderItem = React.createClass({
-
- propTypes: {
- columnClasses: React.PropTypes.string.isRequired,
- displayName: React.PropTypes.string.isRequired,
- columnName: React.PropTypes.string.isRequired,
- canBeOrdered: React.PropTypes.bool,
- changeOrder: React.PropTypes.func,
- orderAsc: React.PropTypes.bool,
- orderBy: React.PropTypes.string
- },
-
- changeOrder() {
- this.props.changeOrder(this.props.columnName, !this.props.orderAsc);
- },
-
- render() {
- if(this.props.canBeOrdered && this.props.changeOrder && this.props.orderAsc != null && this.props.orderBy) {
- if(this.props.columnName === this.props.orderBy) {
- return (
-
-
{this.props.displayName}
-
- );
- } else {
- return (
-
- {this.props.displayName}
-
- );
- }
- } else {
- return (
-
-
- {this.props.displayName}
-
-
- );
- }
- }
-});
-
-export default TableHeaderItem;
diff --git a/js/components/ascribe_accordion_list/table_header_item_carret.js b/js/components/ascribe_accordion_list/table_header_item_carret.js
deleted file mode 100644
index 628ead11..00000000
--- a/js/components/ascribe_accordion_list/table_header_item_carret.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import React from 'react';
-
-let TableHeaderItemCarret = React.createClass({
- propTypes: {
- orderAsc: React.PropTypes.bool.isRequired
- },
-
- render() {
- let carretDirection = 'glyphicon-triangle-';
-
- if(this.props.orderAsc) {
- carretDirection += 'bottom';
- } else {
- carretDirection += 'top';
- }
-
- return (
-
-
- );
- }
-});
-
-export default TableHeaderItemCarret;
\ No newline at end of file
diff --git a/js/components/ascribe_accordion_list/table_item_acl.js b/js/components/ascribe_accordion_list/table_item_acl.js
deleted file mode 100644
index 87e14761..00000000
--- a/js/components/ascribe_accordion_list/table_item_acl.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import React from 'react';
-
-
-let TableItemAcl = React.createClass({
- propTypes: {
- content: React.PropTypes.array.isRequired
- },
-
- render() {
- return (
-
- {this.props.content.join('/')}
-
- );
- }
-});
-
-export default TableItemAcl;
diff --git a/js/components/ascribe_accordion_list/table_item_img.js b/js/components/ascribe_accordion_list/table_item_img.js
deleted file mode 100644
index c082e85a..00000000
--- a/js/components/ascribe_accordion_list/table_item_img.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import React from 'react';
-
-/**
- * This could be enhanced further by specifying an optional description for example
- */
-let TableItemImg = React.createClass({
- propTypes: {
- content: React.PropTypes.string.isRequired,
- },
-
- render() {
- return (
-
-
-
- );
- }
-});
-
-export default TableItemImg;
\ No newline at end of file
diff --git a/js/components/ascribe_accordion_list/table_item_selectable.js b/js/components/ascribe_accordion_list/table_item_selectable.js
deleted file mode 100644
index d0c15c4f..00000000
--- a/js/components/ascribe_accordion_list/table_item_selectable.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import React from 'react';
-import classNames from 'classnames';
-
-import TableColumnContentModel from '../../models/table_column_content_model';
-
-import TableItem from './table_item';
-
-// This component is implemented as recommended here: http://stackoverflow.com/a/25723635/1263876
-let TableItemSelectable = React.createClass({
-
- propTypes: {
- columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnContentModel)),
- columnContent: React.PropTypes.object,
- parentId: React.PropTypes.number,
- className: React.PropTypes.string
- },
-
- selectItem() {
- this.props.selectItem(this.props.parentId, this.props.columnContent.edition_number);
- },
-
- render() {
- let tableItemClasses = classNames({
- 'ascribe-table-item-selected': this.props.columnContent.selected
- });
-
- return (
-
-
- );
- }
-});
-
-export default TableItemSelectable;
diff --git a/js/components/ascribe_accordion_list/table_item_subtable.js b/js/components/ascribe_accordion_list/table_item_subtable.js
deleted file mode 100644
index dcd3da0f..00000000
--- a/js/components/ascribe_accordion_list/table_item_subtable.js
+++ /dev/null
@@ -1,110 +0,0 @@
-import React from 'react';
-
-import TableColumnContentModel from '../../models/table_column_content_model';
-
-import EditionListStore from '../../stores/edition_list_store';
-import EditionListActions from '../../actions/edition_list_actions';
-
-
-import Table from './table';
-import TableItemWrapper from './table_item_wrapper';
-import TableItemText from './table_item_text';
-import TableItemAcl from './table_item_acl';
-import TableItemSelectable from './table_item_selectable';
-import TableItemSubtableButton from './table_item_subtable_button';
-
-
-let TableItemSubtable = React.createClass({
- propTypes: {
- columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnContentModel)),
- columnContent: React.PropTypes.object
- },
-
- getInitialState() {
- return {
- 'open': false
- };
- },
-
- onChange(state) {
- this.setState(state);
- },
-
- componentDidMount() {
- EditionListStore.listen(this.onChange);
- },
-
- loadEditionList() {
- if(this.state.open) {
- this.setState({
- 'open': false
- });
- } else {
-
- EditionListActions.fetchEditionList(this.props.columnContent.id);
- this.setState({
- 'open': true,
- 'editionList': EditionListStore.getState()
- });
- }
- },
-
- selectItem(parentId, itemId) {
- EditionListActions.selectEdition({
- 'pieceId': parentId,
- 'editionId': itemId
- });
- },
-
- render() {
-
- let renderEditionListTable = () => {
-
- let columnList = [
- new TableColumnContentModel('edition_number', 'Number', TableItemText, 2, false),
- new TableColumnContentModel('user_registered', 'User', TableItemText, 4, true),
- new TableColumnContentModel('acl', 'Actions', TableItemAcl, 4, true)
- ];
-
- if(this.state.open && this.state.editionList[this.props.columnContent.id] && this.state.editionList[this.props.columnContent.id].length) {
- return (
-
-
-
- {this.state.editionList[this.props.columnContent.id].map((edition, i) => {
- return (
-
-
- );
- })}
-
-
-
- );
- }
- };
-
- return (
-
-
- {renderEditionListTable()}
-
- );
- }
-});
-
-export default TableItemSubtable;
diff --git a/js/components/ascribe_accordion_list/table_item_subtable_button.js b/js/components/ascribe_accordion_list/table_item_subtable_button.js
deleted file mode 100644
index 8c5431d8..00000000
--- a/js/components/ascribe_accordion_list/table_item_subtable_button.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import React from 'react';
-
-let TableItemSubtableButton = React.createClass({
-
- propTypes: {
- content: React.PropTypes.string.isRequired,
- onClick: React.PropTypes.func.isRequired
- },
-
- render() {
- return (
-
-
-
- );
- }
-});
-
-export default TableItemSubtableButton;
\ No newline at end of file
diff --git a/js/components/ascribe_accordion_list/table_item_text.js b/js/components/ascribe_accordion_list/table_item_text.js
deleted file mode 100644
index 0e90a2d5..00000000
--- a/js/components/ascribe_accordion_list/table_item_text.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import React from 'react';
-
-
-let TableItemText = React.createClass({
- propTypes: {
- content: React.PropTypes.oneOfType([
- React.PropTypes.string,
- React.PropTypes.number
- ])
- },
-
- render() {
- return (
-
- {this.props.content}
-
- );
- }
-});
-
-export default TableItemText;
diff --git a/js/components/ascribe_accordion_list/table_item_wrapper.js b/js/components/ascribe_accordion_list/table_item_wrapper.js
deleted file mode 100644
index 2f9f4c7e..00000000
--- a/js/components/ascribe_accordion_list/table_item_wrapper.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import React from 'react';
-
-import TableColumnContentModel from '../../models/table_column_content_model';
-import TableColumnMixin from '../../mixins/table_column_mixin';
-
-let TableItemWrapper = React.createClass({
- mixins: [TableColumnMixin],
- propTypes: {
- columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnContentModel)),
- columnContent: React.PropTypes.object,
- columnWidth: React.PropTypes.number.isRequired
- },
-
- render() {
- return (
-
- {this.props.columnList.map((column, i) => {
-
- let TypeElement = column.displayType;
- let columnClass = this.calcColumnClasses(this.props.columnList, i, this.props.columnWidth);
-
- return (
-
-
-
- );
-
- })}
-
- );
- }
-});
-
-export default TableItemWrapper;
\ No newline at end of file
diff --git a/js/components/ascribe_table/table.js b/js/components/ascribe_table/table.js
index 06af7b89..50f5f8d9 100644
--- a/js/components/ascribe_table/table.js
+++ b/js/components/ascribe_table/table.js
@@ -24,24 +24,20 @@ let Table = React.createClass({
},
render() {
- if(this.props.itemList && this.props.itemList.length > 0) {
- return (
-
-
+ return (
+
+
+
{this.renderChildren()}
- );
- } else {
- return (
-
Loading
- );
- }
+
+ );
}
});
diff --git a/js/components/ascribe_table/table_item.js b/js/components/ascribe_table/table_item.js
index 6f2a3388..dffb7fa9 100644
--- a/js/components/ascribe_table/table_item.js
+++ b/js/components/ascribe_table/table_item.js
@@ -16,8 +16,7 @@ let TableItem = React.createClass({
render() {
return (
-
-
- );
+ if(this.props.onClick) {
+ return (
+
+
+ );
+ } else {
+ return (
+
+
+ );
+ }
+
}
});
diff --git a/js/components/piece_list.js b/js/components/piece_list.js
index 899c3306..96c1acc6 100644
--- a/js/components/piece_list.js
+++ b/js/components/piece_list.js
@@ -6,6 +6,7 @@ import PieceListActions from '../actions/piece_list_actions';
import AccordionList from './ascribe_accordion_list/accordion_list';
import AccordionListItem from './ascribe_accordion_list/accordion_list_item';
+import AccordionListItemTableEditions from './ascribe_accordion_list/accordion_list_item_table_editions';
import Pagination from './ascribe_pagination/pagination';
@@ -48,9 +49,9 @@ let PieceList = React.createClass({
let totalPages = Math.ceil(this.state.pieceListCount / this.state.pageSize)
return (
-
+
+ key={i}>
+
+
);
})}
diff --git a/sass/ascribe-accordion_list.scss b/sass/ascribe-accordion_list.scss
index ee1a55f5..43b77fa9 100644
--- a/sass/ascribe-accordion_list.scss
+++ b/sass/ascribe-accordion_list.scss
@@ -5,22 +5,20 @@ $ascribe-accordion-list-font: 'Source Sans Pro';
background-color: rgba(0,0,0,0.004);
border: 1px solid black;
height: $ascribe-accordion-list-item-height;
- margin-bottom: 3em;
padding-left:0;
padding-right:0;
overflow:hidden;
- border-top-left-radius: 2px;
- border-top-right-radius: 2px;
border-left: 0.1em solid #E0E0E0;
border-right: 0.1em solid #E0E0E0;
border-top: 0.1em solid #E0E0E0;
border-radius: 5px;
- border-bottom: 0.25em solid #E0E0E0;
+ border-bottom: 0.2em solid #E0E0E0;
.wrapper {
width:100%;
+ height:100%;
// ToDo: Include media queries for thumbnail
.thumbnail-wrapper {
float:left;
@@ -48,4 +46,33 @@ $ascribe-accordion-list-font: 'Source Sans Pro';
}
}
}
+}
+
+.ascribe-accordion-list-item-table {
+ text-align: center;
+ margin-bottom: 3em;
+ background-color: rgba(0,0,0,0.004);
+
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+ border-bottom: 0.15em solid #E0E0E0;
+ border-left: 0.1em solid #E0E0E0;
+ border-right: 0.1em solid #E0E0E0;
+}
+
+span.ascribe-accordion-list-table-toggle {
+ ::selection { background: transparent; }
+ ::-moz-selection { background: transparent; }
+ &:hover {
+ color: $ascribe-color-dark;
+ cursor:pointer;
+ }
+}
+
+.ascribe-accordion-list-table-list {
+ margin-bottom: .5em;
+ th, td {
+ font-size:.85em;
+ text-align: center;
+ }
}
\ No newline at end of file
diff --git a/sass/ascribe-variables.scss b/sass/ascribe-variables.scss
index 8b636994..27697f1e 100644
--- a/sass/ascribe-variables.scss
+++ b/sass/ascribe-variables.scss
@@ -1 +1,2 @@
-$ascribe-color: rgba(2, 182, 163, 0.5);
\ No newline at end of file
+$ascribe-color: rgba(2, 182, 163, 0.5);
+$ascribe-color-dark: rgba(2, 182, 163, 0.8);
\ No newline at end of file
diff --git a/sass/main.scss b/sass/main.scss
index a7f3111c..6cc6af95 100644
--- a/sass/main.scss
+++ b/sass/main.scss
@@ -28,8 +28,7 @@
}
.ascribe-table-header-row {
- border-bottom: 2px solid rgba(2, 182, 163, 0.5);
- border-top: 2px solid rgba(2, 182, 163, 0.5);
+ border-bottom: 2px solid #E0E0E0;
padding: 0;
}
@@ -44,8 +43,8 @@
vertical-align: middle;
font-family: 'Source Sans Pro';
font-weight: 600;
- color: rgba(2, 182, 163, 1);
- font-size: 1.4em;
+ color: #424242;
+ font-size: 1.2em;
}
.ascribe-table-header-column > span > .glyphicon {
@@ -63,7 +62,7 @@
.ascribe-table-item-column {
display: table;
font-family: 'Source Sans Pro';
- font-size: 1.2em;
+ font-size: .8em;
height:3em;
}