Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve filter buttons activation #3654

Merged
merged 1 commit into from
Mar 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/directives/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@ ngeo.FilterController = class {
}


/**
* @return {boolean} True if at least one rule is currently defined.
* @export
*/
hasARule() {
return [].concat(this.customRules, this.directedRules).length > 0;
}


/**
* Loop in all directed and custom rules. Apply the rules that have a proper
* value inside the data source, in the `filterRules` property.
Expand Down
8 changes: 4 additions & 4 deletions src/directives/partials/filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,17 @@
<a
class="btn btn-link"
type="button"
ng-click="!filterCtrl.aRuleIsActive && filterCtrl.apply()"
ng-disabled="filterCtrl.aRuleIsActive">
ng-click="filterCtrl.apply()"
ng-disabled="filterCtrl.hasARule() === false || filterCtrl.datasource.visible === false">
<span class="fa fa-check"></span>
<span translate>Apply filter</span>
</a>

<a
class="btn btn-link"
type="button"
ng-click="!filterCtrl.aRuleIsActive && filterCtrl.getData()"
ng-disabled="filterCtrl.aRuleIsActive">
ng-click="filterCtrl.getData()"
ng-disabled="filterCtrl.hasARule() === false || filterCtrl.datasource.visible === false">
<span class="fa fa-chevron-right"></span>
<span translate>Get data</span>
</a>