1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-03 10:25:08 +01:00

Change ColumnModel's displayName to displayElement

This commit is contained in:
Brett Sun 2015-12-18 15:29:20 +01:00
parent b7d731f8f3
commit 6f7a69fb93
4 changed files with 20 additions and 18 deletions

View File

@ -130,7 +130,7 @@ let AccordionListItemTableEditions = React.createClass({
'selected': item.selected 'selected': item.selected
}; };
}, },
displayName: ( displayElement: (
<AccordionListItemTableSelectAllEditionsCheckbox <AccordionListItemTableSelectAllEditionsCheckbox
onChange={this.toggleAllItems} onChange={this.toggleAllItems}
numOfSelectedEditions={selectedEditionsCount} numOfSelectedEditions={selectedEditionsCount}
@ -147,7 +147,7 @@ let AccordionListItemTableEditions = React.createClass({
}; };
}, },
columnName: 'edition_number', columnName: 'edition_number',
displayName: getLangText('Edition'), displayElement: getLangText('Edition'),
displayType: TableItemText, displayType: TableItemText,
rowWidth: 1 rowWidth: 1
}), }),
@ -159,7 +159,7 @@ let AccordionListItemTableEditions = React.createClass({
}; };
}, },
columnName: 'bitcoin_id', columnName: 'bitcoin_id',
displayName: getLangText('ID'), displayElement: getLangText('ID'),
displayType: TableItemText, displayType: TableItemText,
rowWidth: 5, rowWidth: 5,
className: 'hidden-xs visible-sm visible-md visible-lg' className: 'hidden-xs visible-sm visible-md visible-lg'
@ -173,9 +173,9 @@ let AccordionListItemTableEditions = React.createClass({
}; };
}, },
columnName: 'acl', columnName: 'acl',
displayName: getLangText('Actions'), displayElement: getLangText('Actions'),
displayType: TableItemAclFiltered, displayType: TableItemAclFiltered,
rowWidth: 4, rowWidth: 4
}) })
]; ];

View File

@ -2,10 +2,10 @@
export class ColumnModel { export class ColumnModel {
// ToDo: Add validation for all passed-in parameters // ToDo: Add validation for all passed-in parameters
constructor({ transformFn, columnName = '', displayName, displayType, rowWidth, canBeOrdered, transition, className = '' }) { constructor({ transformFn, columnName = '', displayElement, displayType, rowWidth, canBeOrdered, transition, className = '' }) {
this.transformFn = transformFn; this.transformFn = transformFn;
this.columnName = columnName; this.columnName = columnName;
this.displayName = displayName; this.displayElement = displayElement;
this.displayType = displayType; this.displayType = displayType;
this.rowWidth = rowWidth; this.rowWidth = rowWidth;
this.canBeOrdered = canBeOrdered; this.canBeOrdered = canBeOrdered;

View File

@ -1,5 +1,5 @@
'use strict';
'use strict';
import React from 'react'; import React from 'react';
import TableHeaderItem from './table_header_item'; import TableHeaderItem from './table_header_item';
@ -29,7 +29,7 @@ let TableHeader = React.createClass({
<TableHeaderItem <TableHeaderItem
className={column.className} className={column.className}
key={i} key={i}
displayName={column.displayName} displayElement={column.displayElement}
columnName={columnName} columnName={columnName}
canBeOrdered={canBeOrdered} canBeOrdered={canBeOrdered}
orderAsc={this.props.orderAsc} orderAsc={this.props.orderAsc}

View File

@ -7,7 +7,7 @@ import TableHeaderItemCarret from './table_header_item_carret';
let TableHeaderItem = React.createClass({ let TableHeaderItem = React.createClass({
propTypes: { propTypes: {
displayName: React.PropTypes.oneOfType([ displayElement: React.PropTypes.oneOfType([
React.PropTypes.string, React.PropTypes.string,
React.PropTypes.element React.PropTypes.element
]).isRequired, ]).isRequired,
@ -24,29 +24,31 @@ let TableHeaderItem = React.createClass({
}, },
render() { render() {
if(this.props.canBeOrdered && this.props.changeOrder && this.props.orderAsc != null && this.props.orderBy) { const { canBeOrdered, changeOrder, className, columnName, displayElement, orderAsc, orderBy } = this.props;
if(this.props.columnName === this.props.orderBy) {
if (canBeOrdered && changeOrder && orderAsc != null && orderBy) {
if (columnName === orderBy) {
return ( return (
<th <th
className={'ascribe-table-header-column ' + this.props.className} className={'ascribe-table-header-column ' + className}
onClick={this.changeOrder}> onClick={this.changeOrder}>
<span>{this.props.displayName} <TableHeaderItemCarret orderAsc={this.props.orderAsc} /></span> <span>{displayElement} <TableHeaderItemCarret orderAsc={orderAsc} /></span>
</th> </th>
); );
} else { } else {
return ( return (
<th <th
className={'ascribe-table-header-column ' + this.props.className} className={'ascribe-table-header-column ' + className}
onClick={this.changeOrder}> onClick={this.changeOrder}>
<span>{this.props.displayName}</span> <span>{displayElement}</span>
</th> </th>
); );
} }
} else { } else {
return ( return (
<th className={'ascribe-table-header-column ' + this.props.className}> <th className={'ascribe-table-header-column ' + className}>
<span> <span>
{this.props.displayName} {displayElement}
</span> </span>
</th> </th>
); );