From 82c1b58303a646d5ea35e056ab04dfcf7b69c16b Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sat, 18 Apr 2015 15:23:20 +0200 Subject: [PATCH 1/4] move filter --- angular_app/js/app.js | 14 -------------- angular_app/js/filters.js | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/angular_app/js/app.js b/angular_app/js/app.js index 09e8a7d..a1d2d2f 100644 --- a/angular_app/js/app.js +++ b/angular_app/js/app.js @@ -35,20 +35,6 @@ eventManApp.run(['$rootScope', '$state', '$stateParams', ); -/* Filter that handles splitted words. */ -eventManApp.filter('splittedFilter', ['$filter', - function($filter) { - return function(inputArray, searchText) { - var wordArray = searchText ? searchText.toLowerCase().split(/\s+/) : []; - for (var x=0; x < wordArray.length; x++) { - inputArray = $filter('filter')(inputArray, wordArray[x]); - } - return inputArray; - }; - }] -); - - /* Directive that can be used to make an input field react to the press of Enter. */ eventManApp.directive('ngEnter', function () { return function (scope, element, attrs) { diff --git a/angular_app/js/filters.js b/angular_app/js/filters.js index bf5a483..be956c1 100644 --- a/angular_app/js/filters.js +++ b/angular_app/js/filters.js @@ -50,3 +50,17 @@ eventManApp.filter('personRegistered', ['$filter', }] ); + +/* Filter that handles splitted words. */ +eventManApp.filter('splittedFilter', ['$filter', + function($filter) { + return function(inputArray, searchText) { + var wordArray = searchText ? searchText.toLowerCase().split(/\s+/) : []; + for (var x=0; x < wordArray.length; x++) { + inputArray = $filter('filter')(inputArray, wordArray[x]); + } + return inputArray; + }; + }] +); + From d986d9467f8e3f21219e2ce08ddf9b2957fc0da0 Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sat, 18 Apr 2015 15:26:04 +0200 Subject: [PATCH 2/4] file for directives --- angular_app/index.html | 1 + angular_app/js/app.js | 15 --------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/angular_app/index.html b/angular_app/index.html index 9e31fc2..5656384 100644 --- a/angular_app/index.html +++ b/angular_app/index.html @@ -16,6 +16,7 @@ + diff --git a/angular_app/js/app.js b/angular_app/js/app.js index a1d2d2f..199e9c5 100644 --- a/angular_app/js/app.js +++ b/angular_app/js/app.js @@ -35,21 +35,6 @@ eventManApp.run(['$rootScope', '$state', '$stateParams', ); -/* Directive that can be used to make an input field react to the press of Enter. */ -eventManApp.directive('ngEnter', function () { - return function (scope, element, attrs) { - element.bind("keydown keypress", function (event) { - if(event.which === 13) { - scope.$apply(function (){ - scope.$eval(attrs.ngEnter); - }); - event.preventDefault(); - } - }); - }; -}); - - /* Configure the states. */ eventManApp.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { From 37d7a32eba06729b981674b5370d4f5824e6a0b4 Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sat, 18 Apr 2015 15:49:28 +0200 Subject: [PATCH 3/4] focus on query field --- angular_app/event-info.html | 2 +- angular_app/events-list.html | 2 +- angular_app/person-info.html | 2 +- angular_app/persons-list.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/angular_app/event-info.html b/angular_app/event-info.html index 6ed60bd..1adb57a 100644 --- a/angular_app/event-info.html +++ b/angular_app/event-info.html @@ -32,7 +32,7 @@
- +
diff --git a/angular_app/events-list.html b/angular_app/events-list.html index c287e88..6bfd509 100644 --- a/angular_app/events-list.html +++ b/angular_app/events-list.html @@ -12,7 +12,7 @@
- +
diff --git a/angular_app/person-info.html b/angular_app/person-info.html index f833c9f..83a7b64 100644 --- a/angular_app/person-info.html +++ b/angular_app/person-info.html @@ -12,7 +12,7 @@
- +
diff --git a/angular_app/persons-list.html b/angular_app/persons-list.html index b6e404e..35d4eed 100644 --- a/angular_app/persons-list.html +++ b/angular_app/persons-list.html @@ -16,7 +16,7 @@
- +
From 8faa198008ea86926c03efd082091bf3d0717e9e Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sat, 18 Apr 2015 15:50:27 +0200 Subject: [PATCH 4/4] directives file --- angular_app/js/directives.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 angular_app/js/directives.js diff --git a/angular_app/js/directives.js b/angular_app/js/directives.js new file mode 100644 index 0000000..401329c --- /dev/null +++ b/angular_app/js/directives.js @@ -0,0 +1,27 @@ +'use strict'; + +/* Directives for DOM manipulation and interaction. */ + +/* Directive that can be used to make an input field react to the press of Enter. */ +eventManApp.directive('eventmanPressEnter', function () { + return function (scope, element, attrs) { + element.bind("keydown keypress", function (event) { + if(event.which === 13) { + scope.$apply(function (){ + scope.$eval(attrs.ngEnter); + }); + event.preventDefault(); + } + }); + }; +}); + +eventManApp.directive('eventmanFocus', function () { + function link(scope, element, attrs) { + element[0].focus(); + }; + return { + link: link + }; +}); +