Wire up new menu

This commit is contained in:
Stian Thorgersen 2015-07-14 11:19:44 +02:00
parent 5a213fcad9
commit 32b89adc04
7 changed files with 34 additions and 74 deletions

View file

@ -884,21 +884,22 @@ module.factory('ClientOrigins', function($resource) {
});
module.factory('Current', function(Realm, $route, $rootScope) {
var current = {};
current.realms = {};
current.realm = null;
var current = {
realms: {},
realm: null
};
$rootScope.$on('$routeChangeStart', function() {
current.realm = null;
current.realms = Realm.query(null, function(realms) {
var currentRealm = null;
if ($route.current.params.realm) {
for (var i = 0; i < realms.length; i++) {
if (realms[i].realm == $route.current.params.realm) {
current.realm = realms[i];
currentRealm = realms[i];
}
}
}
current.realm = currentRealm;
});
});

View file

@ -22,38 +22,4 @@
</ul>
</li>
</ul>
<!--
<ul class="nav navbar-nav navbar-primary" data-ng-controller="RealmDropdownCtrl">
<li class="dropdown" data-ng-show="current.realm.realm">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
{{current.realm.realm|capitalize}}
<b class="caret" data-ng-show="current.realms.length > 1"></b>
</a>
<ul class="dropdown-menu" data-ng-show="current.realms.length > 1">
<li data-ng-repeat="realm in current.realms" data-ng-if="realm.realm != current.realm.realm">
<a href="" ng-click="changeRealm(realm.realm)">{{realm.realm|capitalize}}</a>
</li>
</ul>
</li>
<li class="dropdown" data-ng-show="!current.realm.realm">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Select realm...
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li data-ng-repeat="realm in current.realms">
<a href="" ng-click="changeRealm(realm.realm)">{{realm.realm}}</a>
</li>
</ul>
</li>
<li class="pull-right" data-ng-show="auth.user && access.createRealm">
<a class="button primary" href="#/create/realm" data-ng-class="path[0] == 'create' && path[1] == 'realm' && 'active'"
data-ng-show="auth.user">Add Realm</a>
</li>
</ul>
-->
</div>

View file

@ -1,4 +1,4 @@
<div class="col-md-12">
<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">
<h1>Add Realm</h1>
@ -49,3 +49,5 @@
</div>
</form>
</div>
<kc-menu></kc-menu>

View file

@ -1,4 +1,5 @@
<div class="col-md-12">
<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">
<h1>Realms</h1>
<table class="datatable table table-striped table-bordered">
@ -13,4 +14,7 @@
</tr>
</tbody>
</table>
</div>
</div>
<kc-menu></kc-menu>

View file

@ -1,32 +1,22 @@
<div kc-sidebar-resize class="col-sm-3 col-md-2 col-sm-pull-9 col-md-pull-10 sidebar-pf sidebar-pf-left">
<div kc-sidebar-resize class="col-sm-3 col-md-2 col-sm-pull-9 col-md-pull-10 sidebar-pf sidebar-pf-left" data-ng-controller="RealmDropdownCtrl">
<div class="realm-selector">
<h2>
Social Realm
<i class="fa fa-angle-down"></i>
</h2>
<h2 data-ng-show="current.realm">{{current.realm.realm|capitalize}} <i class="fa fa-angle-down"></i></h2>
<h2 data-ng-hide="current.realm">Select realm <i class="fa fa-angle-down"></i></h2>
<div class="realm-dropmenu">
<!-- if it has more than 5 it generates a scroll bar -->
<ul>
<li><a href="#">Name of the Realm</a></li>
<li><a href="#">Name of the Realm</a></li>
<li><a href="#">Name of the Realm</a></li>
<li><a href="#">Name of the Realm</a></li>
<li><a href="#">Name of the Realm</a></li>
<li><a href="#">Name of the Realm</a></li>
<li><a href="#">Name of the Realm</a></li>
<li><a href="#">Name of the Realm</a></li>
<li data-ng-repeat="realm in current.realms | orderBy:'realm'" data-ng-if="realm.realm != current.realm.realm">
<a href="" ng-click="changeRealm(realm.realm)">{{realm.realm|capitalize}}</a>
</li>
</ul>
<div class="realm-add">
<a href="#" class="btn btn-sm btn-block btn-primary">Add Realm</a>
<div class="realm-add" data-ng-show="auth.user && access.createRealm">
<a href="#/create/realm" class="btn btn-sm btn-block btn-primary">Add Realm</a>
</div>
</div> <!-- class="realm-dropmenu-->
</div> <!-- realm-selector -->
<div class="nav-category">
</div>
</div>
<div class="nav-category" data-ng-show="current.realm">
<h2>Configure</h2>
<ul class="nav nav-pills nav-stacked">
<li data-ng-show="access.viewRealm" data-ng-class="((!path[2]
@ -47,7 +37,7 @@
</ul>
</div>
<div class="nav-category">
<div class="nav-category" data-ng-show="current.realm">
<h2>Manage</h2>
<ul class="nav nav-pills nav-stacked">
<li data-ng-show="access.viewUsers" data-ng-class="(path[2] == 'users' || path[1] == 'user') && 'active'"><a href="#/realms/{{realm.realm}}/users"><span class="pficon pficon-users"></span> Users</a></li>
@ -55,9 +45,4 @@
<li data-ng-show="access.viewEvents" data-ng-class="(path[2] == 'events' || path[2] == 'events-settings') && 'active'"><a href="#/realms/{{realm.realm}}/events"><i class="fa fa-calendar"></i> Events</a></li>
</ul>
</div>
<div class="nav-category" data-ng-hide="createRealm">
<ul class="nav nav-pills nav-stacked">
</ul>
</div>
</div>

View file

@ -2,12 +2,14 @@ html,body {
height: 100%;
}
/**
.navbar-pf .navbar-brand {
background: url('../img/brand.svg') no-repeat 0px 5px;
display: block;
height: 25px;
width: 200px;
}
**/
form {
margin-top: 20px;
@ -225,7 +227,6 @@ table {
.realm-add{
padding: 10px;
bor
}
.realm-selector h2{
@ -275,6 +276,7 @@ table {
background-position: center center!important;
background-image: url('../img/keyclok-logo.svg')!important;
background-size: 148px 36px !important;
background-repeat: no-repeat;
width: 148px!important;
}

View file

@ -1,3 +1,3 @@
parent=base
import=common/keycloak
styles=css/styles.css lib/patternfly/css/patternfly.css lib/select2-3.4.1/select2.css css/styles.css
styles=lib/patternfly/css/patternfly.css lib/select2-3.4.1/select2.css css/styles.css