/usr/share/maas/web/static/js/angular/directives/accordion.js is in maas-region-api 2.4.0~beta2-6865-gec43e47e6-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | /* Copyright 2015 Canonical Ltd. This software is licensed under the
* GNU Affero General Public License version 3 (see the file LICENSE).
*
* Accordion directive.
*
* Provides an accordion effect to an element with maas-accordion class and
* all child elements with maas-accordion-tab. Only one accordion tab is open
* at a time, selecting another accordion will set "active" on that
* accordion tab.
*/
angular.module('MAAS').directive('maasAccordion', function() {
return {
restrict: "C",
link: function(scope, element, attrs) {
// Called when accordion tabs are clicked. Removes active on
// all other tabs except to the tab that was clicked.
var clickHandler = function(evt) {
var tab = evt.data.tab;
angular.element(tab).toggleClass("is-selected");
};
// Listen for the click event on all tabs in the accordion.
var tabs = element.find(".maas-accordion-tab");
angular.forEach(tabs, function(tab) {
tab = angular.element(tab);
tab.on("click", {
tab: tab
}, clickHandler);
});
// Remove the handlers when the scope is destroyed.
scope.$on("$destroy", function() {
angular.forEach(tabs, function(tab) {
angular.element(tab).off("click", clickHandler);
});
});
}
};
});
|