generate RegistrationState buttons from service data
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 25 Jan 2013 11:55:23 +0000 (12:55 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 25 Jan 2013 11:55:23 +0000 (12:55 +0100)
app/css/app.css
app/js/controllers.js
app/partials/list.html.ep
app/partials/verified.html.ep

index 334eb57..cffc395 100644 (file)
@@ -45,3 +45,7 @@ textarea.ng-invalid {
 .verified {
        color: #080;
 }
+
+.review {
+       color: #c80;
+}
index 012415d..977758c 100644 (file)
@@ -11,7 +11,7 @@ function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $
                $scope.organizations = data;
                $log.info('organizations promise ', $scope.organizations);
        });
-       $scope.RegistrationState = RegistrationState;
+       $scope.RegistrationState = RegistrationState();
 
        $scope.info = { message: '', css_class: '' } ; // alert box
 
@@ -161,7 +161,7 @@ function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $
 }
 RegistrationCtrl.$inject = [ '$scope', '$log', 'Registration', '$routeParams', '$location', '$route', 'Organizations', 'RegistrationState' ];
 
-function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter) {
+function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter, RegistrationState ) {
 
        $scope.list = [];
        $scope.list_results = 0;
@@ -181,6 +181,7 @@ function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter) {
                states: true,
                pager_numeric: false
        };
+       $scope.RegistrationState = RegistrationState();
 
        $scope.create_counts = function( array ) {
                $log.info('create_counts', array.length );
@@ -270,5 +271,5 @@ function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter) {
        }
 }
 
+ListCtrl.$inject = [ '$scope', '$log', 'Registration', 'RegistrationTypes', '$filter', 'RegistrationState' ];
 
-ListCtrl.$inject = [ '$scope', '$log', 'Registration', 'RegistrationTypes', '$filter' ];
index 4bb6388..59a07d8 100644 (file)
@@ -57,11 +57,9 @@ Search
 </fieldset>
 
 <fieldset ng-show="show.states">
-
-<button ng-click="search.$ = 'draft'" class="btn draft">draft</button>
-<button ng-click="search.$ = 'confirmation'" class="btn confirmation">confirmation</button>
-<button ng-click="search.$ = 'verified'" class="btn verified">verified</button>
-
+<button ng-repeat="state in RegistrationState" ng-click="search.$ = state" class="btn {{state}}">
+{{state}}
+</button>
 </fieldset>
 
 <fieldset ng-show="show.pager_numeric">
index f3637fc..a5a541b 100644 (file)
@@ -13,7 +13,7 @@
 
 <select
        ng-model="registration.state"
-       ng-options="state for state in RegistrationState()"
+       ng-options="state for state in RegistrationState"
        class="my-label-select"
        label="<%= locale en => 'State', hr => 'Stanje' %>"
 >