From bfb40bb19ecaa780a1861a8d7f9fc4e6eab42b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Wed, 8 Jul 2015 17:35:30 +0200 Subject: [PATCH] made edition table row selectable --- .../accordion_list_item_table.js | 11 +++++++---- .../accordion_list_item_table_editions.js | 3 ++- js/components/ascribe_table/table_item.js | 4 +++- js/components/ascribe_table/table_item_checkbox.js | 7 +------ js/components/ascribe_table/table_item_selectable.js | 2 +- js/components/ascribe_table/table_item_wrapper.js | 5 +++-- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/js/components/ascribe_accordion_list/accordion_list_item_table.js b/js/components/ascribe_accordion_list/accordion_list_item_table.js index ac4e6591..9f92c006 100644 --- a/js/components/ascribe_accordion_list/accordion_list_item_table.js +++ b/js/components/ascribe_accordion_list/accordion_list_item_table.js @@ -3,7 +3,7 @@ import React from 'react'; import Table from '../ascribe_table/table'; -import TableItem from '../ascribe_table/table_item'; +import TableItemSelectable from '../ascribe_table/table_item_selectable'; import { ColumnModel } from '../ascribe_table/models/table_models'; @@ -16,7 +16,8 @@ let AccordionListItemTable = React.createClass({ show: React.PropTypes.bool, changeOrder: React.PropTypes.func, orderBy: React.PropTypes.string, - orderAsc: React.PropTypes.bool + orderAsc: React.PropTypes.bool, + selectItem: React.PropTypes.func }, render() { @@ -32,9 +33,11 @@ let AccordionListItemTable = React.createClass({ orderAsc={this.props.orderAsc}> {this.props.itemList.map((item, i) => { return ( - + key={i} + selectItem={this.props.selectItem} + parentId={this.props.parentId}/> ); })} 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 index 1f83d218..76b1aad1 100644 --- a/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js +++ b/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js @@ -202,7 +202,8 @@ let AccordionListItemTableEditions = React.createClass({ show={show} orderBy={orderBy} orderAsc={orderAsc} - changeOrder={this.changeEditionListOrder} /> + changeOrder={this.changeEditionListOrder} + selectItem={this.selectItem}/> diff --git a/js/components/ascribe_table/table_item_checkbox.js b/js/components/ascribe_table/table_item_checkbox.js index cb368369..9ade00f4 100644 --- a/js/components/ascribe_table/table_item_checkbox.js +++ b/js/components/ascribe_table/table_item_checkbox.js @@ -7,18 +7,13 @@ let TableItemCheckbox = React.createClass({ propTypes: { editionId: React.PropTypes.number, pieceId: React.PropTypes.number, - selectItem: React.PropTypes.func, selected: React.PropTypes.bool }, - selectItem() { - this.props.selectItem(this.props.pieceId, this.props.editionId); - }, - render() { return ( - + ); } diff --git a/js/components/ascribe_table/table_item_selectable.js b/js/components/ascribe_table/table_item_selectable.js index cc53c5f0..36144181 100644 --- a/js/components/ascribe_table/table_item_selectable.js +++ b/js/components/ascribe_table/table_item_selectable.js @@ -19,7 +19,7 @@ let TableItemSelectable = React.createClass({ }, selectItem() { - this.props.selectItem(this.props.parentId, this.props.columnContent.edition_number); + this.props.selectItem(this.props.parentId, this.props.columnContent.id); }, render() { diff --git a/js/components/ascribe_table/table_item_wrapper.js b/js/components/ascribe_table/table_item_wrapper.js index 35299641..6eb7b3b4 100644 --- a/js/components/ascribe_table/table_item_wrapper.js +++ b/js/components/ascribe_table/table_item_wrapper.js @@ -11,14 +11,15 @@ let TableItemWrapper = React.createClass({ propTypes: { columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(ColumnModel)), columnContent: React.PropTypes.object, - columnWidth: React.PropTypes.number.isRequired + columnWidth: React.PropTypes.number.isRequired, + onClick: React.PropTypes.func }, mixins: [Router.Navigation], render() { return ( - + {this.props.columnList.map((column, i) => { let TypeElement = column.displayType;