1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +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'}}>
<em>{label}:</em>
</li>
{items.map((param, j) => {
{items.map((paramItem) => {
let itemLabel;
let param;
// As can be seen in the PropTypes, a param can either
// 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.
if (typeof param !== 'string') {
label = param.label;
param = param.key;
if (typeof paramItem !== 'string') {
param = paramItem.key;
itemLabel = paramItem.label;
} else {
param = param;
label = param.split('acl_')[1].replace(/_/g, ' ');
param = paramItem;
itemLabel = paramItem.split('acl_')[1].replace(/_/g, ' ');
}
return (
<li
key={j}
key={itemLabel}
onClick={this.filterBy(param)}
className="filter-widget-item">
<div className="checkbox-line">
<span>
{getLangText(label)}
{getLangText(itemLabel)}
</span>
<input
readOnly

View File

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