
This patch adds eslint, a permissively licensed (as opposed to jshint or jslint) javascript style linter. It also enables the use of 'npm run lint', which may be used in OpenStack's gate to cause build failures when improperly formed javascript is committed. Existing javascript was updated to pass linting rules. Note that most of these changes were formatting and file length concerns. The noted stylistic change that we should probably discuss is the use of singlequote vs. doublequote. Single is the pep8 standard used in python, and thus enforcing that seems to make the most sense. Change-Id: I52768fe6e7ee1f76f0d67f44273fdc48b159489a
21 lines
709 B
JavaScript
21 lines
709 B
JavaScript
/* Refstack Header Controller */
|
|
|
|
var refstackApp = angular.module('refstackApp');
|
|
refstackApp.controller('headerController',
|
|
['$scope', '$location', function ($scope, $location) {
|
|
'use strict';
|
|
|
|
$scope.navbarCollapsed = true;
|
|
$scope.isActive = function (viewLocation) {
|
|
var path = $location.path().substr(0, viewLocation.length);
|
|
if (path === viewLocation) {
|
|
// Make sure "/" only matches when viewLocation is "/".
|
|
if (!($location.path().substr(0).length > 1 &&
|
|
viewLocation.length === 1 )) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
}]);
|