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

Replace instances of angular.element() #7951

Merged
merged 16 commits into from
Apr 14, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

var events = [];

scope.clickBackdrop = function(event) {
if(scope.disableEventsOnClick === true) {
scope.clickBackdrop = function (event) {
if (scope.disableEventsOnClick === true) {
event.preventDefault();
event.stopPropagation();
}
Expand All @@ -22,16 +22,16 @@

}

function setHighlight () {
function setHighlight() {

scope.loading = true;

$timeout(function () {

// The element to highlight
var highlightElement = angular.element(scope.highlightElement);
var highlightElement = $(scope.highlightElement);

if(highlightElement && highlightElement.length > 0) {
if (highlightElement && highlightElement.length > 0) {

var offset = highlightElement.offset();
var width = highlightElement.outerWidth();
Expand All @@ -48,22 +48,22 @@
var rectRight = el.find(".umb-backdrop__rect--right");
var rectBottom = el.find(".umb-backdrop__rect--bottom");
var rectLeft = el.find(".umb-backdrop__rect--left");

// Add the css
scope.rectTopCss = { "height": topDistance, "left": leftDistance + "px", opacity: scope.backdropOpacity };
scope.rectRightCss = { "left": leftAndWidth + "px", "top": topDistance + "px", "height": height, opacity: scope.backdropOpacity };
scope.rectBottomCss = { "height": "100%", "top": topAndHeight + "px", "left": leftDistance + "px", opacity: scope.backdropOpacity };
scope.rectLeftCss = { "width": leftDistance, opacity: scope.backdropOpacity };

// Prevent interaction in the highlighted area
if(scope.highlightPreventClick) {
if (scope.highlightPreventClick) {
var preventClickElement = el.find(".umb-backdrop__highlight-prevent-click");
preventClickElement.css({ "width": width, "height": height, "left": offset.left, "top": offset.top });
}

}

scope.loading = false;
scope.loading = false;

});

Expand All @@ -74,8 +74,8 @@
}

events.push(scope.$watch("highlightElement", function (newValue, oldValue) {
if(!newValue) {return;}
if(newValue === oldValue) {return;}
if (!newValue) { return; }
if (newValue === oldValue) { return; }
setHighlight();
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
onClose: "&"
}
};

function umbSearchController($timeout, backdropService, searchService, focusService) {

var vm = this;
Expand All @@ -25,7 +25,7 @@
vm.handleKeyDown = handleKeyDown;
vm.closeSearch = closeSearch;
vm.focusSearch = focusSearch;

//we need to capture the focus before this element is initialized.
vm.focusBeforeOpening = focusService.getLastKnownFocus();

Expand Down Expand Up @@ -66,8 +66,8 @@
*/
function focusSearch() {
vm.searchHasFocus = false;
$timeout(function(){
vm.searchHasFocus = true;
$timeout(function () {
vm.searchHasFocus = true;
});
}

Expand All @@ -76,14 +76,14 @@
* @param {object} event
*/
function handleKeyDown(event) {

// esc
if(event.keyCode === 27) {
if (event.keyCode === 27) {
event.stopPropagation();
event.preventDefault();

closeSearch();
return;
return;
}

// up/down (navigate search results)
Expand Down Expand Up @@ -132,7 +132,7 @@
}

$timeout(function () {
var resultElementLink = angular.element(".umb-search-item[active-result='true'] .umb-search-result__link");
var resultElementLink = $(".umb-search-item[active-result='true'] .umb-search-result__link");
resultElementLink[0].focus();
});
}
Expand All @@ -142,10 +142,10 @@
* Used to proxy a callback
*/
function closeSearch() {
if(vm.focusBeforeOpening) {
if (vm.focusBeforeOpening) {
vm.focusBeforeOpening.focus();
}
if(vm.onClose) {
if (vm.onClose) {
vm.onClose();
}
}
Expand All @@ -155,9 +155,9 @@
* @param {string} searchQuery
*/
function search(searchQuery) {
if(searchQuery.length > 0) {
var search = {"term": searchQuery};
searchService.searchAll(search).then(function(result){
if (searchQuery.length > 0) {
var search = { "term": searchQuery };
searchService.searchAll(search).then(function (result) {
//result is a dictionary of group Title and it's results
var filtered = {};
_.each(result, function (value, key) {
Expand Down
Loading