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:
parent
b7d731f8f3
commit
6f7a69fb93
@ -130,7 +130,7 @@ let AccordionListItemTableEditions = React.createClass({
|
||||
'selected': item.selected
|
||||
};
|
||||
},
|
||||
displayName: (
|
||||
displayElement: (
|
||||
<AccordionListItemTableSelectAllEditionsCheckbox
|
||||
onChange={this.toggleAllItems}
|
||||
numOfSelectedEditions={selectedEditionsCount}
|
||||
@ -147,7 +147,7 @@ let AccordionListItemTableEditions = React.createClass({
|
||||
};
|
||||
},
|
||||
columnName: 'edition_number',
|
||||
displayName: getLangText('Edition'),
|
||||
displayElement: getLangText('Edition'),
|
||||
displayType: TableItemText,
|
||||
rowWidth: 1
|
||||
}),
|
||||
@ -159,7 +159,7 @@ let AccordionListItemTableEditions = React.createClass({
|
||||
};
|
||||
},
|
||||
columnName: 'bitcoin_id',
|
||||
displayName: getLangText('ID'),
|
||||
displayElement: getLangText('ID'),
|
||||
displayType: TableItemText,
|
||||
rowWidth: 5,
|
||||
className: 'hidden-xs visible-sm visible-md visible-lg'
|
||||
@ -173,9 +173,9 @@ let AccordionListItemTableEditions = React.createClass({
|
||||
};
|
||||
},
|
||||
columnName: 'acl',
|
||||
displayName: getLangText('Actions'),
|
||||
displayElement: getLangText('Actions'),
|
||||
displayType: TableItemAclFiltered,
|
||||
rowWidth: 4,
|
||||
rowWidth: 4
|
||||
})
|
||||
];
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
export class ColumnModel {
|
||||
// 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.columnName = columnName;
|
||||
this.displayName = displayName;
|
||||
this.displayElement = displayElement;
|
||||
this.displayType = displayType;
|
||||
this.rowWidth = rowWidth;
|
||||
this.canBeOrdered = canBeOrdered;
|
||||
|
@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
'use strict';
|
||||
import React from 'react';
|
||||
|
||||
import TableHeaderItem from './table_header_item';
|
||||
@ -29,7 +29,7 @@ let TableHeader = React.createClass({
|
||||
<TableHeaderItem
|
||||
className={column.className}
|
||||
key={i}
|
||||
displayName={column.displayName}
|
||||
displayElement={column.displayElement}
|
||||
columnName={columnName}
|
||||
canBeOrdered={canBeOrdered}
|
||||
orderAsc={this.props.orderAsc}
|
||||
|
@ -7,7 +7,7 @@ import TableHeaderItemCarret from './table_header_item_carret';
|
||||
let TableHeaderItem = React.createClass({
|
||||
|
||||
propTypes: {
|
||||
displayName: React.PropTypes.oneOfType([
|
||||
displayElement: React.PropTypes.oneOfType([
|
||||
React.PropTypes.string,
|
||||
React.PropTypes.element
|
||||
]).isRequired,
|
||||
@ -24,29 +24,31 @@ let TableHeaderItem = React.createClass({
|
||||
},
|
||||
|
||||
render() {
|
||||
if(this.props.canBeOrdered && this.props.changeOrder && this.props.orderAsc != null && this.props.orderBy) {
|
||||
if(this.props.columnName === this.props.orderBy) {
|
||||
const { canBeOrdered, changeOrder, className, columnName, displayElement, orderAsc, orderBy } = this.props;
|
||||
|
||||
if (canBeOrdered && changeOrder && orderAsc != null && orderBy) {
|
||||
if (columnName === orderBy) {
|
||||
return (
|
||||
<th
|
||||
className={'ascribe-table-header-column ' + this.props.className}
|
||||
className={'ascribe-table-header-column ' + className}
|
||||
onClick={this.changeOrder}>
|
||||
<span>{this.props.displayName} <TableHeaderItemCarret orderAsc={this.props.orderAsc} /></span>
|
||||
<span>{displayElement} <TableHeaderItemCarret orderAsc={orderAsc} /></span>
|
||||
</th>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<th
|
||||
className={'ascribe-table-header-column ' + this.props.className}
|
||||
className={'ascribe-table-header-column ' + className}
|
||||
onClick={this.changeOrder}>
|
||||
<span>{this.props.displayName}</span>
|
||||
<span>{displayElement}</span>
|
||||
</th>
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return (
|
||||
<th className={'ascribe-table-header-column ' + this.props.className}>
|
||||
<th className={'ascribe-table-header-column ' + className}>
|
||||
<span>
|
||||
{this.props.displayName}
|
||||
{displayElement}
|
||||
</span>
|
||||
</th>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user