Minor code style improvements.

This commit is contained in:
CJ Cenizal 2017-02-06 11:36:17 -08:00
parent 6eeeab6833
commit 438f5c4468
3 changed files with 14 additions and 14 deletions

View file

@ -64,6 +64,11 @@ export function DashboardListingController(
this.pager = pagerFactory.create(this.items.length, 20, 1);
$scope.$watch(() => this.filter, () => {
deselectAll();
fetchObjects();
});
/**
* Boolean that keeps track of whether hits are sorted ascending (true)
* or descending (false) by title
@ -141,9 +146,4 @@ export function DashboardListingController(
this.getUrlForItem = function getUrlForItem(item) {
return `#/dashboard/${item.id}`;
};
$scope.$watch(() => this.filter, () => {
deselectAll();
fetchObjects();
});
}

View file

@ -65,6 +65,11 @@ export function VisualizeListingController(
this.pager = pagerFactory.create(this.items.length, 20, 1);
$scope.$watch(() => this.filter, () => {
deselectAll();
fetchObjects();
});
/**
* Remember sort direction per property.
*/
@ -81,11 +86,11 @@ export function VisualizeListingController(
}];
this.getSortProperty = function getSortProperty() {
return _.find(this.sortProperties, property => property.isSelected);
return this.sortProperties.find(property => property.isSelected);
};
this.getSortPropertyByName = function getSortPropertyByName(name) {
return _.find(this.sortProperties, property => property.name === name);
return this.sortProperties.find(property => property.name === name);
};
this.isAscending = function isAscending() {
@ -125,7 +130,7 @@ export function VisualizeListingController(
};
this.isItemChecked = function isItemChecked(item) {
return selectedItems.indexOf(item) !== -1;
return selectedItems.includes(item);
};
this.areAllItemsChecked = function areAllItemsChecked() {
@ -171,9 +176,4 @@ export function VisualizeListingController(
this.getUrlForItem = function getUrlForItem(item) {
return `#/visualize/edit/${item.id}`;
};
$scope.$watch(() => this.filter, () => {
deselectAll();
fetchObjects();
});
}

View file

@ -39,7 +39,7 @@ module.directive('breadCrumbs', function ($location) {
if ($scope.omitPages) {
$scope.breadcrumbs = $scope.breadcrumbs.filter(breadcrumb =>
$scope.omitPages.indexOf(breadcrumb.toLowerCase()) === -1
!$scope.omitPages.includes(breadcrumb.toLowerCase())
);
}