Skip to content

Commit

Permalink
Merge pull request #4719 from camptocamp/only-enable-filter-tool-if-a…
Browse files Browse the repository at this point in the history
…ny-filterable-layers-are-set

Only enable the filter tool in the toolbar if at least on layer has b…
  • Loading branch information
ochriste authored Mar 7, 2019
2 parents aa80300 + ca95dba commit 5e46354
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contribs/gmf/apps/desktop/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
data-toggle="tooltip" data-placement="left" data-original-title="{{'Draw and Measure'|translate}}">
<span class="fa fa-paint-brush"></span>
</button>
<button ngeo-btn class="btn btn-default" ng-model="mainCtrl.filterSelectorActive"
<button ngeo-btn class="btn btn-default" ng-if="mainCtrl.filterSelectorEnabled" ng-model="mainCtrl.filterSelectorActive"
data-toggle="tooltip" data-placement="left" data-original-title="{{'Filter'|translate}}">
<span class="fa fa-filter"></span>
</button>
Expand Down
16 changes: 15 additions & 1 deletion contribs/gmf/src/controllers/AbstractAppController.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,18 @@ const exports = function(config, $scope, $injector) {
const user = evt.detail.user;
const roleId = (user.username !== null) ? user.role_id : undefined;

const functionalities = this.gmfUser.functionalities;

// Enable filter tool in toolbar
if (functionalities &&
'filterable_layers' in functionalities &&
functionalities['filterable_layers'].length > 0) {
this.filterSelectorEnabled = true;
}

// Open filter panel if 'open_panel' is set in functionalities and
// has 'layer_filter' as first value
this.gmfThemes_.getThemesObject().then((themes) => {
const functionalities = this.gmfUser.functionalities;
if (functionalities &&
functionalities.open_panel &&
functionalities.open_panel[0] === 'layer_filter') {
Expand Down Expand Up @@ -276,6 +284,12 @@ const exports = function(config, $scope, $injector) {
stroke: queryStroke
});

/**
* @type {boolean}
* @export
*/
this.filterSelectorEnabled = false;

/**
* @type {boolean}
* @export
Expand Down

0 comments on commit 5e46354

Please sign in to comment.