mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 10:25:08 +01:00
Merge pull request #61 from ascribe/AD-1484-hide-PieceListToolbarFilterWidget-if-no-filters-applicable
Hide PieceListToolbarFilterWidget when no filters are applicable
This commit is contained in:
commit
1e83de0b90
@ -39,30 +39,6 @@ let PieceListToolbar = React.createClass({
|
||||
])
|
||||
},
|
||||
|
||||
getFilterWidget(){
|
||||
if (this.props.filterParams){
|
||||
return (
|
||||
<PieceListToolbarFilterWidget
|
||||
filterParams={this.props.filterParams}
|
||||
filterBy={this.props.filterBy}
|
||||
applyFilterBy={this.props.applyFilterBy} />
|
||||
);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
getOrderWidget(){
|
||||
if (this.props.orderParams){
|
||||
return (
|
||||
<PieceListToolbarOrderWidget
|
||||
orderParams={this.props.orderParams}
|
||||
orderBy={this.props.orderBy}
|
||||
applyOrderBy={this.props.applyOrderBy}/>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
render() {
|
||||
const { className, children, searchFor, searchQuery } = this.props;
|
||||
|
||||
@ -75,8 +51,14 @@ let PieceListToolbar = React.createClass({
|
||||
{children}
|
||||
</span>
|
||||
<span className="pull-right">
|
||||
{this.getOrderWidget()}
|
||||
{this.getFilterWidget()}
|
||||
<PieceListToolbarOrderWidget
|
||||
orderParams={this.props.orderParams}
|
||||
orderBy={this.props.orderBy}
|
||||
applyOrderBy={this.props.applyOrderBy}/>
|
||||
<PieceListToolbarFilterWidget
|
||||
filterParams={this.props.filterParams}
|
||||
filterBy={this.props.filterBy}
|
||||
applyFilterBy={this.props.applyFilterBy} />
|
||||
</span>
|
||||
<SearchBar
|
||||
className="pull-right search-bar ascribe-input-glyph"
|
||||
|
@ -66,7 +66,7 @@ let PieceListToolbarFilterWidget = React.createClass({
|
||||
|
||||
// We're hiding the star in that complicated matter so that,
|
||||
// the surrounding button is not resized up on appearance
|
||||
if(trueValuesOnly.length > 0) {
|
||||
if (trueValuesOnly.length) {
|
||||
return { visibility: 'visible'};
|
||||
} else {
|
||||
return { visibility: 'hidden' };
|
||||
@ -81,6 +81,7 @@ let PieceListToolbarFilterWidget = React.createClass({
|
||||
</span>
|
||||
);
|
||||
|
||||
if (this.props.filterParams && this.props.filterParams.length) {
|
||||
return (
|
||||
<DropdownButton
|
||||
pullRight={true}
|
||||
@ -137,6 +138,9 @@ let PieceListToolbarFilterWidget = React.createClass({
|
||||
})}
|
||||
</DropdownButton>
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -37,7 +37,7 @@ let PieceListToolbarOrderWidget = React.createClass({
|
||||
isOrderActive() {
|
||||
// We're hiding the star in that complicated matter so that,
|
||||
// the surrounding button is not resized up on appearance
|
||||
if(this.props.orderBy.length > 0) {
|
||||
if (this.props.orderBy && this.props.orderBy.length) {
|
||||
return { visibility: 'visible'};
|
||||
} else {
|
||||
return { visibility: 'hidden' };
|
||||
@ -51,8 +51,9 @@ let PieceListToolbarOrderWidget = React.createClass({
|
||||
<span style={this.isOrderActive()}>·</span>
|
||||
</span>
|
||||
);
|
||||
return (
|
||||
|
||||
if (this.props.orderParams && this.props.orderParams.length) {
|
||||
return (
|
||||
<DropdownButton
|
||||
pullRight={true}
|
||||
title={filterIcon}
|
||||
@ -82,6 +83,9 @@ let PieceListToolbarOrderWidget = React.createClass({
|
||||
})}
|
||||
</DropdownButton>
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user