initial import for Open Source 🎉

This commit is contained in:
Jimmy Zelinskie 2019-11-12 11:09:47 -05:00
parent 1898c361f3
commit 9c0dd3b722
2048 changed files with 218743 additions and 0 deletions

View file

@ -0,0 +1,35 @@
/**
* An element which displays a dropdown for selecting multiple elements.
*/
angular.module('quay').directive('multiselectDropdown', function ($compile) {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/multiselect-dropdown.html',
transclude: true,
replace: false,
restrict: 'C',
scope: {
'items': '=items',
'selectedItems': '=selectedItems',
'itemName': '@itemName',
'itemChecked': '&itemChecked'
},
controller: function($scope, $element) {
$scope.isChecked = function(checked, item) {
return checked.indexOf(item) >= 0;
};
$scope.toggleItem = function(item) {
var isChecked = $scope.isChecked($scope.selectedItems, item);
if (!isChecked) {
$scope.selectedItems.push(item);
} else {
var index = $scope.selectedItems.indexOf(item);
$scope.selectedItems.splice(index, 1);
}
$scope.itemChecked({'item': item, 'checked': !isChecked});
};
}
};
return directiveDefinitionObject;
});