From bd3a70db66f41c66668d324068149599f241934e Mon Sep 17 00:00:00 2001 From: Tom Pratchios Date: Wed, 9 Dec 2015 09:08:16 -0500 Subject: [PATCH 1/6] This is everything but the service call, routing, and results controller integration. Unfortunately I wasn't able to get started on this until late last night, and had to get my youngest to daycare nice and early. --- README.md | 0 css/ie7.css | 1 + css/test.css | 8 ++++ index.html | 75 +++++++++++++++++---------------- js/TestMe.js | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++ js/app.js | 2 + js/results.js | 0 js/route.js | 0 js/service.js | 1 + pull_req.md | 10 +++++ results.html | 19 +++++---- 11 files changed, 186 insertions(+), 43 deletions(-) mode change 100644 => 100755 README.md create mode 100644 css/ie7.css create mode 100644 css/test.css mode change 100644 => 100755 index.html create mode 100644 js/TestMe.js mode change 100644 => 100755 js/app.js create mode 100644 js/results.js create mode 100644 js/route.js create mode 100644 js/service.js create mode 100644 pull_req.md mode change 100644 => 100755 results.html diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/css/ie7.css b/css/ie7.css new file mode 100644 index 0000000..6ec4c5a --- /dev/null +++ b/css/ie7.css @@ -0,0 +1 @@ +//no styles for IE7 use tan hack for the less than handful of styles which aren't compatible. Problem solved. \ No newline at end of file diff --git a/css/test.css b/css/test.css new file mode 100644 index 0000000..23c15db --- /dev/null +++ b/css/test.css @@ -0,0 +1,8 @@ + +body{background:#EFF;color:#122;} +h1 { color: #368; weight: bolder; margin: 20px; display: block; opacity: 80%; } +h1:hover { opacity:1; } +.well{border-radius:8px;background-color: #CDD;border-color:#356;} +.fail, .status{color:#c00;} +.ib{display:inline-block;*display:inline;} +.message{background-color:#fcc;padding:1em;border:1px solid #900;border-radius:8px;} \ No newline at end of file diff --git a/index.html b/index.html old mode 100644 new mode 100755 index 6f5c271..92a3864 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - + @@ -8,33 +8,32 @@ - + + - + + +
+

The User Interface Developer Test

-
+
  • This Page and results.html should be converted to AngularJS templates.
  • Add a select-all toggle for the checkbox list.
  • Select-all should be checked if all fields are checked, unchecked if all fields are unchecked and indeterminate if some are checked.
  • -
  • Sor the checkboxes by name +
  • Sort the checkboxes by name
  • When submitting the form, if only "Language" is checked, then an error should appear stating " Please choose more items! "
  • Successfully submitting the form takes us to results.html and shows what the user submitted.
  • Maybe the page can look a little better?
  • @@ -42,34 +41,38 @@

    The User Interface Developer Test

-
-
- Select All +
+ {{system.message.status}} +
+ +
+
-
- - - - - - + + + + + + + + +
+
+

+ {{checkedList}} +

+
+
- - - - + + \ No newline at end of file diff --git a/js/TestMe.js b/js/TestMe.js new file mode 100644 index 0000000..1e22d1b --- /dev/null +++ b/js/TestMe.js @@ -0,0 +1,113 @@ +function indexController($scope) { + + var flaggedID = 3; + $scope.errorMessages = [{ + "message": ""}, + { + "message": "Please make a selection!"}, + { + "message": "Please make a selection!"}, + { + "message": "The system is down!" + }]; + + $scope.checks = [{ + "id": 0, + "value": "1", + "label": "Abstract", + "checked": false}, + { + "id": 1, + "value": "2", + "label": "Publication", + "checked": false}, + { + "id": 2, + "value": "3", + "label": "Inventor", + "checked": false}, + { + "id": 3, + "value": "4", + "label": "Language", + "checked": false}, + { + "id": 4, + "value": "5", + "label": "Source", + "checked": false}, + { + "id": 5, + "value": "6", + "label": "Priority", + "checked": false}]; + + $scope.value = []; + $scope.checkedList = []; + $scope.updateServerFail = function(boolHolder){ + $scope.failServer = boolHolder.checked; + } + $scope.updateCheckValues = function(checky){ + answered=[]; + answered = $scope.answered(); + if (answered.length==$scope.checks.length){ + $scope.selectAll = true; + } + if (answered.length<1){ + $scope.selectAll = false; + } + }; + $scope.checkAll = function(){ + $scope.selectAll = !$scope.selectAll; + angular.forEach($scope.checks, function (check) { + check.checked = $scope.selectAll; + }); + answered = []; + angular.forEach($scope.checks, function (check){ + if(check.checked){ + answered.push(check.id); + } + }); + }; + $scope.answered = function(){ + answered = []; + $scope.checkedList = []; + angular.forEach($scope.checks, function (check){ + if(check.checked){ + answered.push(check.id); + $scope.checkedList.push(check.label); + } + }); + //console.log($scope.checkedList); + return answered; + } + $scope.validation = function(){ + answered = $scope.answered(); + if(answered.length<1){ + $scope.system.message.status = $scope.errorMessages[1].message; + return false; + }else if(answered.indexOf(flaggedID) > -1&&answered.length==1){ + $scope.system.message.status = $scope.errorMessages[2].message; + return false; + }else{ + $scope.system.message.status = $scope.errorMessages[0].message; + return true; + } + } + $scope.processPage = function(){ + if($scope.validation()==true){ + if($scope.failServer){ + console.error("server fale nao!"); + $scope.system.message.status = $scope.errorMessages[3].message; + }else{ + //serviceCall.set(check); + console.log("clicked submit nao wut?"); + + } + } + + } + + //set-and-get + +}; \ No newline at end of file diff --git a/js/app.js b/js/app.js old mode 100644 new mode 100755 index e81250d..8828178 --- a/js/app.js +++ b/js/app.js @@ -1 +1,3 @@ +var angular = angular; + angular.module('TestMe', []); \ No newline at end of file diff --git a/js/results.js b/js/results.js new file mode 100644 index 0000000..e69de29 diff --git a/js/route.js b/js/route.js new file mode 100644 index 0000000..e69de29 diff --git a/js/service.js b/js/service.js new file mode 100644 index 0000000..3eccbf5 --- /dev/null +++ b/js/service.js @@ -0,0 +1 @@ +//get/set data \ No newline at end of file diff --git a/pull_req.md b/pull_req.md new file mode 100644 index 0000000..7613cb9 --- /dev/null +++ b/pull_req.md @@ -0,0 +1,10 @@ +Incremental check-in + +So this is everything but the service call, routing, and results controller integration. + +Unfortunately I wasn't able to get started on this until late last night, and had to get my youngest to daycare nice and early this morning. + +If you'd like to discuss what's present, by all means, give me a call at 321.298.7087 + +Regards, +--Tom \ No newline at end of file diff --git a/results.html b/results.html old mode 100644 new mode 100755 index dfe49cf..36f2ca2 --- a/results.html +++ b/results.html @@ -2,18 +2,23 @@ - TestMe_lite results! - + TestMe results! + + + + From f9a355c102ccc0ef3affd6d73add32d40fe6688d Mon Sep 17 00:00:00 2001 From: Tom Pratchios Date: Wed, 9 Dec 2015 09:10:38 -0500 Subject: [PATCH 2/6] remove debug statements --- js/TestMe.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/js/TestMe.js b/js/TestMe.js index 1e22d1b..780f135 100644 --- a/js/TestMe.js +++ b/js/TestMe.js @@ -78,7 +78,6 @@ function indexController($scope) { $scope.checkedList.push(check.label); } }); - //console.log($scope.checkedList); return answered; } $scope.validation = function(){ @@ -97,12 +96,9 @@ function indexController($scope) { $scope.processPage = function(){ if($scope.validation()==true){ if($scope.failServer){ - console.error("server fale nao!"); $scope.system.message.status = $scope.errorMessages[3].message; }else{ //serviceCall.set(check); - console.log("clicked submit nao wut?"); - } } From 7af542457cbbfc53cd21ec5a722a4e56ab5feab2 Mon Sep 17 00:00:00 2001 From: Tom Pratchios Date: Wed, 9 Dec 2015 09:44:32 -0500 Subject: [PATCH 3/6] =?UTF-8?q?update=20of=20=E2=80=9Cserver=E2=80=9D=20me?= =?UTF-8?q?ssage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/TestMe.js | 2 +- pull_req.md | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/js/TestMe.js b/js/TestMe.js index 780f135..30ea616 100644 --- a/js/TestMe.js +++ b/js/TestMe.js @@ -6,7 +6,7 @@ function indexController($scope) { { "message": "Please make a selection!"}, { - "message": "Please make a selection!"}, + "message": "Please choose more items!"}, { "message": "The system is down!" }]; diff --git a/pull_req.md b/pull_req.md index 7613cb9..7bdee2f 100644 --- a/pull_req.md +++ b/pull_req.md @@ -1,10 +1 @@ -Incremental check-in - -So this is everything but the service call, routing, and results controller integration. - -Unfortunately I wasn't able to get started on this until late last night, and had to get my youngest to daycare nice and early this morning. - -If you'd like to discuss what's present, by all means, give me a call at 321.298.7087 - -Regards, ---Tom \ No newline at end of file +Having spoken with a couple other developers, the consensus is that this is essentially a full unit of work. There may be better ways to test for proficiency without requesting that much time from a developer. \ No newline at end of file From a9c2ce75cd33a6d0792f617bf3f9eb60e5596d6c Mon Sep 17 00:00:00 2001 From: Tom Pratchios Date: Wed, 9 Dec 2015 12:49:37 -0500 Subject: [PATCH 4/6] Start of $http.get, minor cleanup. --- index.html | 1 + js/TestMe.js | 11 +++++++++-- js/app.js | 3 ++- js/mock.json | 1 + js/results.js | 2 ++ 5 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 js/mock.json diff --git a/index.html b/index.html index 92a3864..e617eb5 100755 --- a/index.html +++ b/index.html @@ -18,6 +18,7 @@ + diff --git a/js/TestMe.js b/js/TestMe.js index 30ea616..43f914f 100644 --- a/js/TestMe.js +++ b/js/TestMe.js @@ -1,4 +1,4 @@ -function indexController($scope) { +function indexController($scope, $http) { var flaggedID = 3; $scope.errorMessages = [{ @@ -98,7 +98,14 @@ function indexController($scope) { if($scope.failServer){ $scope.system.message.status = $scope.errorMessages[3].message; }else{ - //serviceCall.set(check); + $http.get('js/mock.json') + .then(function(response) { + console.log('Success', response); + //response.data + }, function(error) { + console.error('ERR', error); + $scope.system.message.status = $scope.errorMessages[3].message; + }) } } diff --git a/js/app.js b/js/app.js index 8828178..8bd350d 100755 --- a/js/app.js +++ b/js/app.js @@ -1,3 +1,4 @@ var angular = angular; -angular.module('TestMe', []); \ No newline at end of file +var app = angular.module('TestMe', []); + diff --git a/js/mock.json b/js/mock.json new file mode 100644 index 0000000..529a445 --- /dev/null +++ b/js/mock.json @@ -0,0 +1 @@ +{ "spoon": "moo" } \ No newline at end of file diff --git a/js/results.js b/js/results.js index e69de29..92fd57b 100644 --- a/js/results.js +++ b/js/results.js @@ -0,0 +1,2 @@ +function resultsController($scope, $http) { +} \ No newline at end of file From 9dd1891a843e41d5c0c89ea6a9c78d2127076d6a Mon Sep 17 00:00:00 2001 From: Tom Pratchios Date: Wed, 9 Dec 2015 13:22:19 -0500 Subject: [PATCH 5/6] Routing foundation --- index.html | 2 +- js/TestMe.js | 2 +- js/app.js | 30 +++++++++++++++++++++++++++++- js/results.js | 1 + 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index e617eb5..9ca7277 100755 --- a/index.html +++ b/index.html @@ -23,7 +23,7 @@
-

+

The User Interface Developer Test

diff --git a/js/TestMe.js b/js/TestMe.js index 43f914f..d763f7c 100644 --- a/js/TestMe.js +++ b/js/TestMe.js @@ -1,5 +1,5 @@ function indexController($scope, $http) { - + $scope.title = "Index Controller"; var flaggedID = 3; $scope.errorMessages = [{ "message": ""}, diff --git a/js/app.js b/js/app.js index 8bd350d..ea216d5 100755 --- a/js/app.js +++ b/js/app.js @@ -1,4 +1,32 @@ var angular = angular; -var app = angular.module('TestMe', []); +var app = angular.module('TestMe', ['ngRoute']); + +app.config(function($routeProvider, $locationProvider) { + $routeProvider + .when('/', { + templateUrl: 'index.html', + title: 'Index Page', + controller: 'indexController', + resolve: { + delay: function($q, $timeout) { + var delay = $q.defer(); + $timeout(delay.resolve, 1000); + return delay.promise; + } + } + }) + .when('/results.html', { + templateUrl: 'results.html', + title: 'Results Page', + controller: 'resultsController' + }); + $locationProvider.html5Mode(true); +}); + +app.run(['$rootScope', function($rootScope) { + $rootScope.$on('$routeChangeSuccess', function (event, current, previous) { + $rootScope.title = current.$$route.title; + }); +}]); \ No newline at end of file diff --git a/js/results.js b/js/results.js index 92fd57b..4c50d76 100644 --- a/js/results.js +++ b/js/results.js @@ -1,2 +1,3 @@ function resultsController($scope, $http) { + $scope.title = "Results Controller"; } \ No newline at end of file From 5b44589a3856269aa8beb8fd60df82fd071cfc6d Mon Sep 17 00:00:00 2001 From: Tom Pratchios Date: Wed, 9 Dec 2015 14:23:43 -0500 Subject: [PATCH 6/6] removed pull_req.md to be replaced with email explanation --- index.html | 1 + js/TestMe.js | 7 ++++--- js/app.js | 2 +- pull_req.md | 1 - 4 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 pull_req.md diff --git a/index.html b/index.html index 9ca7277..99e7077 100755 --- a/index.html +++ b/index.html @@ -16,6 +16,7 @@ + diff --git a/js/TestMe.js b/js/TestMe.js index d763f7c..072b902 100644 --- a/js/TestMe.js +++ b/js/TestMe.js @@ -96,16 +96,17 @@ function indexController($scope, $http) { $scope.processPage = function(){ if($scope.validation()==true){ if($scope.failServer){ - $scope.system.message.status = $scope.errorMessages[3].message; + $scope.system.message.status = $scope.errorMessages[3].message; }else{ - $http.get('js/mock.json') + /*$http.get('js/mock.json') .then(function(response) { console.log('Success', response); //response.data }, function(error) { console.error('ERR', error); $scope.system.message.status = $scope.errorMessages[3].message; - }) + })*/ + return true; } } diff --git a/js/app.js b/js/app.js index ea216d5..b0184e4 100755 --- a/js/app.js +++ b/js/app.js @@ -1,6 +1,6 @@ var angular = angular; -var app = angular.module('TestMe', ['ngRoute']); +var app = angular.module('TestMe', ['ngRoute', 'ngResource']); app.config(function($routeProvider, $locationProvider) { diff --git a/pull_req.md b/pull_req.md deleted file mode 100644 index 7bdee2f..0000000 --- a/pull_req.md +++ /dev/null @@ -1 +0,0 @@ -Having spoken with a couple other developers, the consensus is that this is essentially a full unit of work. There may be better ways to test for proficiency without requesting that much time from a developer. \ No newline at end of file