rename RegistrationState to ValidStates
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 26 Jan 2013 01:46:50 +0000 (02:46 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 26 Jan 2013 01:46:50 +0000 (02:46 +0100)
app/js/controllers.js
app/js/services.js.ep
app/partials/list.html.ep
app/partials/verified.html.ep
test/unit/controllersSpec.js
test/unit/directivesSpec.js
test/unit/servicesSpec.js

index 3561aff..3c43f53 100644 (file)
@@ -2,7 +2,7 @@
 
 /* Controllers */
 
-function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $route, Organizations, RegistrationState) {
+function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $route, Organizations, ValidStates) {
 
        $scope.$routeParams = $routeParams;
        $scope.$location = $location;
@@ -11,7 +11,7 @@ function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $
                $scope.organizations = data;
                $log.info('organizations promise ', $scope.organizations);
        });
-       $scope.RegistrationState = RegistrationState();
+       $scope.ValidStates = ValidStates();
 
        $scope.info = { message: '', css_class: '' } ; // alert box
 
@@ -173,9 +173,9 @@ function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $
 
        $scope.reset();
 }
-RegistrationCtrl.$inject = [ '$scope', '$log', 'Registration', '$routeParams', '$location', '$route', 'Organizations', 'RegistrationState' ];
+RegistrationCtrl.$inject = [ '$scope', '$log', 'Registration', '$routeParams', '$location', '$route', 'Organizations', 'ValidStates' ];
 
-function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter, RegistrationState ) {
+function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter, ValidStates ) {
 
        $scope.list = [];
        $scope.list_results = 0;
@@ -196,7 +196,7 @@ function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter, Regist
                states: true,
                pager_numeric: false
        };
-       $scope.RegistrationState = RegistrationState();
+       $scope.ValidStates = ValidStates();
 
        $scope.create_counts = function( array ) {
                $log.info('create_counts', array.length );
@@ -289,5 +289,5 @@ function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter, Regist
        }
 }
 
-ListCtrl.$inject = [ '$scope', '$log', 'Registration', 'RegistrationTypes', '$filter', 'RegistrationState' ];
+ListCtrl.$inject = [ '$scope', '$log', 'Registration', 'RegistrationTypes', '$filter', 'ValidStates' ];
 
index 9149a3f..62578ed 100644 (file)
@@ -67,6 +67,6 @@ angular.module('myApp.services', [ 'ngResource' ]).
                return $scope.organizations;
        }).
 /* http://jsfiddle.net/asgoth/7bNAd/ */
-       value('RegistrationState', function() {
+       value('ValidStates', function() {
                return [ 'draft', 'confirmation', 'verified', 'review' ];
        });
index e61930c..cf7aeef 100644 (file)
@@ -64,7 +64,7 @@ All results on single page <b>(can be slow!)</b>
 </fieldset>
 
 <fieldset ng-show="show.states">
-<button ng-repeat="state in RegistrationState" ng-click="search.$ = state" class="btn {{state}}">
+<button ng-repeat="state in ValidStates" ng-click="search.$ = state" class="btn {{state}}">
 <span class="badge">{{Counts['state+'+state]}}</span>
 {{state}}
 </button>
index a5a541b..55381a7 100644 (file)
@@ -13,7 +13,7 @@
 
 <select
        ng-model="registration.state"
-       ng-options="state for state in RegistrationState"
+       ng-options="state for state in ValidStates"
        class="my-label-select"
        label="<%= locale en => 'State', hr => 'Stanje' %>"
 >
index a8b34e7..de7a63d 100644 (file)
@@ -68,8 +68,8 @@ describe('ListCtrl', function(){
        expect( scope.ready ).toBe( true );
   });
 
-  it('RegistrationState', function() {
+  it('ValidStates', function() {
        $httpBackend.flush();
-       expect( scope.RegistrationState ).toBeTruthy();
+       expect( scope.ValidStates ).toBeTruthy();
   });
 });
index 32c0ae3..fe2d390 100644 (file)
@@ -40,9 +40,9 @@ describe('directives', function() {
   describe('my-label-select', function() {
     beforeEach(module('myApp.services'));
     it('div+label+input', function() {
-      inject(function($compile, $rootScope, RegistrationState) {
-               //dump( RegistrationState() );
-        var element = $compile('<div><select class="my-label-select" ng-model="m" label="label" ng-options="value for value in RegistrationState()"></select></div>')($rootScope);
+      inject(function($compile, $rootScope, ValidStates) {
+               //dump( ValidStates() );
+        var element = $compile('<div><select class="my-label-select" ng-model="m" label="label" ng-options="value for value in ValidStates()"></select></div>')($rootScope);
                //dump(element.html());
         expect(element.html()).toMatch(/div.*label.*label.*div.*select.*select.*div.*div/i);
       });
index 138ffec..bb06cee 100644 (file)
@@ -19,9 +19,9 @@ describe('service', function() {
     }));
   });
 
-       describe('RegistrationState', function() {
-               it('have status', inject(function(RegistrationState) {
-                       expect(RegistrationState().length).toBe(4);
+       describe('ValidStates', function() {
+               it('have status', inject(function(ValidStates) {
+                       expect(ValidStates().length).toBe(4);
                }));
        });