mirror of
https://github.com/ascribe/onion.git
synced 2024-12-31 09:07:48 +01:00
Use object to construct ColumnModel to improve readability
This commit is contained in:
parent
d6a9873bd0
commit
b7d731f8f3
@ -121,62 +121,62 @@ let AccordionListItemTableEditions = React.createClass({
|
||||
});
|
||||
|
||||
const columnList = [
|
||||
new ColumnModel(
|
||||
(item) => {
|
||||
new ColumnModel({
|
||||
transformFn: (item) => {
|
||||
return {
|
||||
'editionId': item.id,
|
||||
'pieceId': parentId,
|
||||
'selectItem': this.selectItem,
|
||||
'selected': item.selected
|
||||
}; },
|
||||
'',
|
||||
};
|
||||
},
|
||||
displayName: (
|
||||
<AccordionListItemTableSelectAllEditionsCheckbox
|
||||
onChange={this.toggleAllItems}
|
||||
numOfSelectedEditions={selectedEditionsCount}
|
||||
numOfAllEditions={allEditionsCount}/>,
|
||||
TableItemCheckbox,
|
||||
1,
|
||||
false
|
||||
),
|
||||
new ColumnModel(
|
||||
(item) => {
|
||||
numOfAllEditions={allEditionsCount}/>
|
||||
),
|
||||
displayType: TableItemCheckbox,
|
||||
rowWidth: 1
|
||||
}),
|
||||
new ColumnModel({
|
||||
transition,
|
||||
transformFn: (item) => {
|
||||
return {
|
||||
'content': item.edition_number + ' ' + getLangText('of') + ' ' + item.num_editions
|
||||
}; },
|
||||
'edition_number',
|
||||
getLangText('Edition'),
|
||||
TableItemText,
|
||||
1,
|
||||
false,
|
||||
transition
|
||||
),
|
||||
new ColumnModel(
|
||||
(item) => {
|
||||
};
|
||||
},
|
||||
columnName: 'edition_number',
|
||||
displayName: getLangText('Edition'),
|
||||
displayType: TableItemText,
|
||||
rowWidth: 1
|
||||
}),
|
||||
new ColumnModel({
|
||||
transition,
|
||||
transformFn: (item) => {
|
||||
return {
|
||||
'content': item.bitcoin_id
|
||||
}; },
|
||||
'bitcoin_id',
|
||||
getLangText('ID'),
|
||||
TableItemText,
|
||||
5,
|
||||
false,
|
||||
transition,
|
||||
'hidden-xs visible-sm visible-md visible-lg'
|
||||
),
|
||||
new ColumnModel(
|
||||
(item) => {
|
||||
let content = item.acl;
|
||||
};
|
||||
},
|
||||
columnName: 'bitcoin_id',
|
||||
displayName: getLangText('ID'),
|
||||
displayType: TableItemText,
|
||||
rowWidth: 5,
|
||||
className: 'hidden-xs visible-sm visible-md visible-lg'
|
||||
}),
|
||||
new ColumnModel({
|
||||
transition,
|
||||
transformFn: (item) => {
|
||||
return {
|
||||
'content': content,
|
||||
'content': item.acl,
|
||||
'notifications': item.notifications
|
||||
}; },
|
||||
'acl',
|
||||
getLangText('Actions'),
|
||||
TableItemAclFiltered,
|
||||
4,
|
||||
false,
|
||||
transition
|
||||
)
|
||||
};
|
||||
},
|
||||
columnName: 'acl',
|
||||
displayName: getLangText('Actions'),
|
||||
displayType: TableItemAclFiltered,
|
||||
rowWidth: 4,
|
||||
})
|
||||
];
|
||||
|
||||
if (show && editionsForPiece && editionsForPiece.length) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
export class ColumnModel {
|
||||
// ToDo: Add validation for all passed-in parameters
|
||||
constructor(transformFn, columnName, displayName, displayType, rowWidth, canBeOrdered, transition, className) {
|
||||
constructor({ transformFn, columnName = '', displayName, displayType, rowWidth, canBeOrdered, transition, className = '' }) {
|
||||
this.transformFn = transformFn;
|
||||
this.columnName = columnName;
|
||||
this.displayName = displayName;
|
||||
@ -10,7 +10,7 @@ export class ColumnModel {
|
||||
this.rowWidth = rowWidth;
|
||||
this.canBeOrdered = canBeOrdered;
|
||||
this.transition = transition;
|
||||
this.className = className ? className : '';
|
||||
this.className = className;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user