mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
add labels for filter params
This commit is contained in:
parent
fc0bccbff3
commit
fb10d9329b
@ -45,7 +45,10 @@ let PieceListToolbar = React.createClass({
|
||||
</span>
|
||||
<span className="pull-right">
|
||||
<PieceListToolbarFilterWidget
|
||||
filterParams={['acl_transfer', 'acl_consign']} />
|
||||
filterParams={['acl_transfer', 'acl_consign', {
|
||||
key: 'acl_editions',
|
||||
label: 'create editions'
|
||||
}]} />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -12,7 +12,14 @@ import { getLangText } from '../../utils/lang_utils.js';
|
||||
|
||||
let PieceListToolbarFilterWidgetFilter = React.createClass({
|
||||
propTypes: {
|
||||
filterParams: React.PropTypes.arrayOf(React.PropTypes.string).isRequired
|
||||
// An array of either strings (which represent acl enums) or objects of the form
|
||||
//
|
||||
// {
|
||||
// key: <acl enum>,
|
||||
// label: <a human readable string>
|
||||
// }
|
||||
//
|
||||
filterParams: React.PropTypes.arrayOf(React.PropTypes.any).isRequired
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
@ -94,14 +101,24 @@ let PieceListToolbarFilterWidgetFilter = React.createClass({
|
||||
<em>{getLangText('Show works that')}:</em>
|
||||
</li>
|
||||
{this.props.filterParams.map((param, i) => {
|
||||
let name = param.split('_')[1];
|
||||
let label;
|
||||
|
||||
if(typeof param !== 'string') {
|
||||
label = param.label;
|
||||
param = param.key;
|
||||
} else {
|
||||
param = param;
|
||||
label = param.split('_')[1];
|
||||
}
|
||||
|
||||
return (
|
||||
<MenuItem
|
||||
key={i}
|
||||
onClick={this.filterBy(param)}
|
||||
style={{'textAlign': 'center'}}>
|
||||
<div className="checkbox-line">
|
||||
<span onClick={this.filterBy(param)}>
|
||||
{getLangText('I can') + ' ' + getLangText(name)}
|
||||
<span>
|
||||
{getLangText('I can') + ' ' + getLangText(label)}
|
||||
<input
|
||||
readOnly
|
||||
type="checkbox"
|
||||
|
Loading…
Reference in New Issue
Block a user