diff --git a/index.html b/index.html index 6f5c271..869136b 100644 --- a/index.html +++ b/index.html @@ -1,75 +1,46 @@ + - - - - - - - - + + + + + + + + + - - - - - - -
-
-

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 -
  • 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?
  • -

    Read the README.md

    -
-
-
-
-
- Select All -
-
- - - - - - -
- -
- + + +
+
+
+ + + - \ No newline at end of file + + diff --git a/js/app.js b/js/app.js index e81250d..458e73e 100644 --- a/js/app.js +++ b/js/app.js @@ -1 +1,113 @@ -angular.module('TestMe', []); \ No newline at end of file +angular.module('TestMe', ['ngTest.cbSelector', 'ngTest.results', 'ngRoute']) +.config(['$routeProvider', + function($routeProvider) { + $routeProvider. + when('/', { + templateUrl: '/testForm.html', + controller: 'CheckBoxController' + }). + when('/results', { + templateUrl: '/results.html', + controller: 'ResultsController' + }). + otherwise({ + redirectTo: '/' + }); + } +]); + +angular.module('ngTest.cbSelector', []) +.controller('CheckBoxController', ['$scope', '$rootScope','$location', function($scope, $rootScope, $location){ + $scope.cbSelectedByVal = { + abstract: false, + publication: false, + inventor: false, + language: false, + source: false, + priority: false + }; + $scope.cbSelectAll = false; + + $scope.getKeys = function(Obj,order){ + return Object.keys(Obj).sort(); //ensures that checkboxes are sorted by name. + } + + //checks for the indeterminate condition. + var checkIndeterminate = function(selectObject){ + var keys = $scope.getKeys(selectObject); + var counter = 0; max_limit = keys.length, t = true; + var elm = document.getElementById('selectAllChkBox'); + keys.forEach(function(el, i){ + t = t && selectObject[el]; + if(selectObject[el]){counter++;} + }); + if(counter - - - - TestMe_lite results! - - - - - - -
-
-

You made it to the results page!

-
-
-

On this page you will:

-
    -
  • Tastefully display the selections the user made .
  • -
  • Fix the json3 and css includes for IE7.
  • -
- -
- - \ No newline at end of file +
+
+

You made it to the results page!

+
+
+

Selected Items:

+
    +
  • {{item}}
  • +
+ Return to Form +
+
diff --git a/testForm.html b/testForm.html new file mode 100644 index 0000000..56d458b --- /dev/null +++ b/testForm.html @@ -0,0 +1,34 @@ +
+
+

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
  • +
  • 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?
  • +

    Read the README.md

    +
+
+
+
+ Select All +
+
+
+ + +
+
+ +
+
+ +