Skip to content

Commit

Permalink
stubbed out cursor and enter key press directives for the list pickers
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendy committed May 26, 2014
1 parent 3ab6feb commit 1e4853c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ angular
return $scope.isSelectable(option) && ($scope.selectedOptions.length < $scope.model.config.listPicker.maxItems || $scope.model.config.listPicker.maxItems <= 0);
};

$scope.cursorUp = function () {
// TODO: move highlight / active of next selectable
};

$scope.cursorDown = function () {
// TODO: move highlight / active of previous selectable
};

$scope.enterKey = function () {
// TODO: select highlighted
}

// picking an item from 'selectable' for 'selected'
$scope.selectOption = function (option) {
if ($scope.isValidSelection(option)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,20 @@ angular
}
}
});

angular
.module("umbraco.directives")
.directive('nuEnterKey', function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {

element.bind('keydown keypress', function (event) {
if (event.which === 13) {
scope.$apply(attrs.nuCursorDown);
event.preventDefault();
}
});
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
<input type="text"
placeholder="filter"
ng-model="filter"
ng-trim="false" />
ng-trim="false"
nu-cursor-up="cursorUp()"
nu-cursor-down="cursorDown()"
nu-enter-key="enterKey()" />
</div>

<ng-include src="'App_Plugins/nuComponents/DataTypes/Shared/ListPicker/ListPickerPartial.html'" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
autocomplete="off"
ng-model="typeahead"
nu-cursor-up="cursorUp()"
nu-cursor-down="cursorDown()" />
nu-cursor-down="cursorDown()"
nu-enter-key="enterKey()" />
<!--nu-blur="clear()" />-->
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@ angular
.controller("nuComponents.DataTypes.Shared.TypeaheadListPicker.TypeaheadListPickerEditorController",
['$scope',
function ($scope) {

$scope.cursorUp = function () {
// move highlight / active of selectable to next
};

$scope.cursorDown = function () {
// move highlight / active of selectable to previous
};


//$scope.clear = function () {
// $scope.typeahead = null;
// $scope.selectableOptions = null;
Expand All @@ -36,7 +28,7 @@ angular

}
else {
$scope.selectableOptions = null;
$scope.selectableOptions = [];
}

});
Expand Down

0 comments on commit 1e4853c

Please sign in to comment.