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

hide query more menu if empty #209

Merged
merged 1 commit into from
Aug 18, 2017
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
4 changes: 2 additions & 2 deletions client/app/pages/queries/query.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h3>
<a ng-if="dataSource.options.doc_url != '' && dataSource.options.doc_url" ng-href={{dataSource.options.doc_url}}>{{dataSource.type_name}} documentation</a>
<span ng-if="dataSource.options.doc_url == '' || !dataSource.options.doc_url">{{ dataSource.type_name }} documentation</span>
<get-data-source-version id='data-source-version'></get-data-source-version>

<div class="pull-right">
<button class="btn btn-s btn-default" ng-click="togglePublished()" ng-if="query.is_draft && query.id != undefined && (isQueryOwner || currentUser.hasPermission('admin'))">
<span class="fa fa-paper-plane"></span> Publish
Expand All @@ -118,7 +118,7 @@ <h3>
<span class="fa fa-floppy-o"> </span> Save<span
ng-show="isDirty">&#42;</span>
</button>
<div class="btn-group" role="group" uib-dropdown>
<div class="btn-group" ng-show="moreMenuIsPopulated()" id="query-more-menu" role="group" uib-dropdown>
<button class="btn btn-default btn-sm dropdown-toggle" uib-dropdown-toggle>
<span class="zmdi zmdi-more"></span>
</button>
Expand Down
11 changes: 11 additions & 0 deletions client/app/pages/queries/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,17 @@ function QueryViewCtrl($scope, Events, $route, $routeParams, $location, $window,
},
});
};

$scope.moreMenuIsPopulated = () => {
const menuParent = document.getElementById('query-more-menu');

if (menuParent) {
if (menuParent.querySelectorAll('.dropdown-menu li').length) {
return true;
}
}
return false;
};
}

export default function (ngModule) {
Expand Down