Fixed realms list page

This commit is contained in:
Stian Thorgersen 2013-11-25 16:56:34 +00:00
parent 52c7ae057a
commit 924184f659
4 changed files with 52 additions and 32 deletions

View file

@ -20,8 +20,12 @@ module.controller('GlobalCtrl', function($scope, $http, Auth, Current, $location
}); });
}); });
module.controller('HomeCtrl', function($scope, Realm, Current) {
console.debug("home");
});
module.controller('RealmListCtrl', function($scope, Realm, Current) { module.controller('RealmListCtrl', function($scope, Realm, Current) {
$scope.realms = Realm.get(); $scope.realms = Realm.query();
Current.realms = $scope.realms; Current.realms = $scope.realms;
}); });
@ -35,6 +39,9 @@ module.controller('RealmDropdownCtrl', function($scope, Realm, Current, Auth, $l
var show = Current.realms.length > 0; var show = Current.realms.length > 0;
return Auth.loggedIn && show; return Auth.loggedIn && show;
} }
$scope.refresh = function() {
Current.refresh();
}
}); });
module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $http, $location, Dialog, Notifications) { module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $http, $location, Dialog, Notifications) {

View file

@ -232,19 +232,25 @@ module.factory('ApplicationOrigins', function($resource) {
module.factory('Current', function(Realm, $route) { module.factory('Current', function(Realm, $route) {
var current = {}; var current = {};
current.realms = {};
current.realm = null; current.realm = null;
current.realms = Realm.query(null, function(realms) {
if ($route.current.params.realm) {
for (var i = 0; i < realms.length; i++) {
if (realms[i].id == $route.current.params.realm) {
current.realm = realms[i];
}
}
}
});
current.applications = {}; current.applications = {};
current.application = null; current.application = null;
current.refresh = function() {
current.realm = null;
current.realms = Realm.query(null, function(realms) {
if ($route.current.params.realm) {
for (var i = 0; i < realms.length; i++) {
if (realms[i].id == $route.current.params.realm) {
current.realm = realms[i];
}
}
}
});
}
current.refresh();
return current; return current;
}); });

View file

@ -25,7 +25,7 @@
<span class="dropdown-label" data-ng-show="showNav()">Realm:</span> <span class="dropdown-label" data-ng-show="showNav()">Realm:</span>
<div class="select-rcue" data-ng-show="showNav()"> <div class="select-rcue" data-ng-show="showNav()">
<select ng-change="changeRealm()" ng-model="current.realm" ng-options="r.realm for r in current.realms"></select> <select ng-change="changeRealm()" ng-model="current.realm" ng-options="r.realm for r in current.realms"></select>
</div><a href="#/realms/{{current.realm.id}}" id="refresh" data-ng-show="showNav()" class="tooltipBottomTrigger" data-original-title="Refresh"><span class="icon-spinner6">Icon: spinner</span></a> </div><a data-ng-click="refresh()" id="refresh" data-ng-show="showNav()" class="tooltipBottomTrigger" data-original-title="Refresh"><span class="icon-spinner6">Icon: spinner</span></a>
</li> </li>
</ul> </ul>
<div class="pull-right" data-ng-show="auth.loggedIn"> <div class="pull-right" data-ng-show="auth.loggedIn">

View file

@ -1,27 +1,34 @@
<div id="wrapper" class="container"> <div id="wrapper" class="container">
<div class="row"> <div class="row">
<aside class="span3" data-ng-include data-src="'partials/realm-menu.html'"></aside> <div class="bs-sidebar col-md-3 clearfix">
<div id="actions-bg"></div> <ul data-ng-hide="createRealm">
<li class="active"><a href="#/realms">Realms</a></li>
<div id="container-right" class="span9"> </ul>
<a class="btn btn-small pull-right" href="#/create/realm">Add Realm</a>
<h1>
<span class="gray">Realms</span>
</h1>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Realm</th>
</tr>
</thead>
<tr data-ng-repeat="(id, name) in realms">
<td><a href="#/realms/{{id}}">{{name}}</a></td>
</tr>
</table>
</div> </div>
<div id="content-area" class="col-md-9" role="main">
<div class="top-nav" data-ng-hide="createRealm">
<ul class="rcue-tabs">
</ul>
</div>
<div id="content">
<h1>
<span class="gray">Realms</span>
</h1>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Realm</th>
</tr>
</thead>
<tr data-ng-repeat="r in realms">
<td><a href="#/realms/{{r.id}}">{{r.realm}}</a></td>
</tr>
</table>
</div>
</div>
<div id="container-right-bg"></div> <div id="container-right-bg"></div>
</div> </div>
</div> </div>