-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d1b64a5
commit 7e18fcd
Showing
8 changed files
with
63 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
angular.module('BE.docs.controller.faq', []) | ||
.controller('faq_controller', [ | ||
'$scope', | ||
function($scope) { | ||
'$timeout', | ||
function ($scope, $timeout) { | ||
// faq-data must be a script JSON element templated into the page | ||
const faqScript = document.getElementById('faq-data') | ||
if (faqScript == undefined) { | ||
console.error('Failed to find FAQ data with id faq-data. Ensure it is inserted before the controller is used.') | ||
const faqScript = angular.element('#faq-data')[0]; | ||
if (!faqScript) { | ||
console.error('Failed to find FAQ data with id faq-data. Ensure it is inserted before the controller is used.'); | ||
} | ||
|
||
$scope.faqData = JSON.parse(faqScript.textContent) | ||
// Autofocus on the input | ||
angular.element('.faq-search-input')[0].focus(); | ||
|
||
$scope.updateFilter = (search) => { | ||
if (search == "") { | ||
$('.collapse.faq-category-content').collapse('hide') | ||
// $scope.faqData = JSON.parse(faqScript[0].textContent); | ||
$scope.faqData = JSON.parse(faqScript.textContent); | ||
|
||
$scope.updateFilter = search => { | ||
if (!search) { | ||
angular.element('.collapse.faq-category-content').collapse('hide'); | ||
} else { | ||
$('.collapse.faq-category-content').collapse('show') | ||
// Timeout to allow ng-if to evaluate first | ||
$timeout(function () { | ||
angular.element('.collapse.faq-category-content').collapse('show'); | ||
}, 0); | ||
} | ||
} | ||
}]) | ||
}; | ||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters