1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Remove unnecessary div in PieceListToolbarOrderWidget

Also renames some variables in PieceListToolbarFilterWidget for
readability
This commit is contained in:
Brett Sun 2016-01-11 11:49:27 +01:00
parent 455232049d
commit 0e67784e93
2 changed files with 24 additions and 23 deletions

View File

@ -95,7 +95,9 @@ let PieceListToolbarFilterWidget = React.createClass({
<li style={{'textAlign': 'center'}}> <li style={{'textAlign': 'center'}}>
<em>{label}:</em> <em>{label}:</em>
</li> </li>
{items.map((param, j) => { {items.map((paramItem) => {
let itemLabel;
let param;
// As can be seen in the PropTypes, a param can either // As can be seen in the PropTypes, a param can either
// be a string or an object of the shape: // be a string or an object of the shape:
@ -106,22 +108,22 @@ let PieceListToolbarFilterWidget = React.createClass({
// } // }
// //
// This is why we need to distinguish between both here. // This is why we need to distinguish between both here.
if (typeof param !== 'string') { if (typeof paramItem !== 'string') {
label = param.label; param = paramItem.key;
param = param.key; itemLabel = paramItem.label;
} else { } else {
param = param; param = paramItem;
label = param.split('acl_')[1].replace(/_/g, ' '); itemLabel = paramItem.split('acl_')[1].replace(/_/g, ' ');
} }
return ( return (
<li <li
key={j} key={itemLabel}
onClick={this.filterBy(param)} onClick={this.filterBy(param)}
className="filter-widget-item"> className="filter-widget-item">
<div className="checkbox-line"> <div className="checkbox-line">
<span> <span>
{getLangText(label)} {getLangText(itemLabel)}
</span> </span>
<input <input
readOnly readOnly

View File

@ -63,21 +63,20 @@ let PieceListToolbarOrderWidget = React.createClass({
</li> </li>
{this.props.orderParams.map((param) => { {this.props.orderParams.map((param) => {
return ( return (
<div key={param}> <li
<li key={param}
onClick={this.orderBy(param)} onClick={this.orderBy(param)}
className="filter-widget-item"> className="filter-widget-item">
<div className="checkbox-line"> <div className="checkbox-line">
<span> <span>
{getLangText(param.replace('_', ' '))} {getLangText(param.replace('_', ' '))}
</span> </span>
<input <input
readOnly readOnly
type="radio" type="radio"
checked={param.indexOf(this.props.orderBy) > -1} /> checked={param.indexOf(this.props.orderBy) > -1} />
</div> </div>
</li> </li>
</div>
); );
})} })}
</DropdownButton> </DropdownButton>