Skip to content

Commit

Permalink
Merge pull request #3654 from camptocamp/improve_filter
Browse files Browse the repository at this point in the history
Improve filter buttons activation
  • Loading branch information
ger-benjamin authored Mar 15, 2018
2 parents fe024b9 + 3af8ebe commit 82482c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
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>

0 comments on commit 82482c7

Please sign in to comment.