mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 19:10:07 -03:30
Merge pull request #2653 from jlmitch5/clickToCloseSearch
get click to close working for search bars
This commit is contained in:
commit
51a798d47d
@ -5,6 +5,15 @@
|
||||
min-height: 45px;
|
||||
}
|
||||
|
||||
.TagSearch-clickToClose {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1040;
|
||||
}
|
||||
|
||||
.TagSearch-bar {
|
||||
display: flex;
|
||||
padding: 0;
|
||||
|
||||
@ -17,6 +17,15 @@ export default ['$scope', 'Refresh', 'tagSearchService',
|
||||
$scope.toggleTypeDropdown = function() {
|
||||
if ($scope.searchTypes.length > 1) {
|
||||
$scope.showTypeDropdown = !$scope.showTypeDropdown;
|
||||
if ($scope.showTypeDropdown) {
|
||||
$("body").append("<div class='TagSearch-clickToClose'></div>");
|
||||
$(".TagSearch-clickToClose").on("click", function() {
|
||||
$scope.$apply(function() {
|
||||
$scope.showTypeDropdown = false;
|
||||
});
|
||||
$(".TagSearch-clickToClose").remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -24,6 +33,7 @@ export default ['$scope', 'Refresh', 'tagSearchService',
|
||||
$scope.setSearchType = function($event, type) {
|
||||
$scope.currentSearchType = type;
|
||||
$scope.showTypeDropdown = false;
|
||||
$(".TagSearch-clickToClose").remove();
|
||||
$event.stopPropagation();
|
||||
};
|
||||
|
||||
@ -33,7 +43,16 @@ export default ['$scope', 'Refresh', 'tagSearchService',
|
||||
$scope
|
||||
.showCurrentSearchDropdown = !$scope
|
||||
.showCurrentSearchDropdown;
|
||||
};
|
||||
if ($scope.showCurrentSearchDropdown) {
|
||||
$("body").append("<div class='TagSearch-clickToClose'></div>");
|
||||
$(".TagSearch-clickToClose").on("click", function() {
|
||||
$scope.$apply(function() {
|
||||
$scope.showCurrentSearchDropdown = false;
|
||||
});
|
||||
$(".TagSearch-clickToClose").remove();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.updateSearch = function(tags) {
|
||||
var iterator = $scope.iterator;
|
||||
@ -106,5 +125,6 @@ export default ['$scope', 'Refresh', 'tagSearchService',
|
||||
$scope.newSearchTag = null;
|
||||
$scope.showTypeDropdown = false;
|
||||
$scope.showCurrentSearchDropdown = false;
|
||||
$(".TagSearch-clickToClose").remove();
|
||||
};
|
||||
}];
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
</span>
|
||||
<i class="TagSearch-selectDownIcon fa fa-angle-down"
|
||||
ng-hide="searchTypes.length === 1"></i>
|
||||
<div aw-click-off="showTypeDropdown" class="TagSearch-dropdownContainer
|
||||
<div class="TagSearch-dropdownContainer
|
||||
TagSearch-dropdownContainer--searchTypes"
|
||||
ng-show="showTypeDropdown">
|
||||
<div class="TagSearch-dropdownItem"
|
||||
@ -43,8 +43,7 @@
|
||||
<i class="TagSearch-selectDownIcon
|
||||
fa fa-angle-down">
|
||||
</i>
|
||||
<div aw-click-off="showCurrentSearchDropdown"
|
||||
class="TagSearch-dropdownContainer
|
||||
<div class="TagSearch-dropdownContainer
|
||||
TagSearch-dropdownContainer--typeOptions"
|
||||
ng-show="showCurrentSearchDropdown &&
|
||||
currentSearchType.type === 'select'">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user