sum7/warehost-frontend
sum7
/
warehost-frontend
Archived
1
0
Fork 0

add modules as App

This commit is contained in:
Martin Geno 2016-09-03 13:24:54 +02:00
parent 044bfd7eca
commit a8a9d46c8b
9 changed files with 114 additions and 48 deletions

22
public/app/host/index.js Normal file
View File

@ -0,0 +1,22 @@
'use strict';
angular.module('warehost')
.config(['$stateProvider',function ($stateProvider) {
$stateProvider
.state('app.host', {
url:'/host',
views:{
'menu':{templateUrl:'app/host/menu.html'}
}
})
.state('app.host.index', {
url:'/',
views:{
'@app':{
templateUrl: 'app/home.html',
controller:function(alert){
alert.set({});
}
}
}
});
}]);

View File

@ -0,0 +1,2 @@
li
a(ui-sref="app.host.index",ui-sref-active="active") Home

View File

@ -10,27 +10,42 @@
span.icon-bar
span.icon-bar
.navbar-collapse.collapse(uib-collapse="!isOpen")
ui.nav.navbar-nav
li(ng-if="session.profil.shift",ui-sref="app.shift.index",ng-class="{ active: $state.includes('app.shift') }")
a(nav navbar-nav) Shift
li(ng-if="session.profil.host",ui-sref="app.host.index",ng-class="{ active: $state.includes('app.host') }")
a(nav navbar-nav) Hosting
ui.nav.navbar-nav(ui-view="menu")
ui.nav.navbar-nav.navbar-right(ng-if="session.login.active")
li.dropdown(ng-if="modules.length>0")
a.dropdown-toggle(data-toggle="dropdown",role="button",aria-haspopup="true",aria-expanded="false")
span.glyphicon.glyphicon-th-large
| Apps
span.caret
ul.dropdown-menu
li(ng-if="modules.indexOf('web')>-1",ui-sref="app.web.index")
a(nav navbar-nav) Websites
li(ng-if="modules.indexOf('host')>-1",ui-sref="app.host.index")
a(nav navbar-nav) Hosting
li(ng-if="modules.indexOf('test')>-1")
a(nav navbar-nav) Testing
li.dropdown
a.dropdown-toggle(data-toggle="dropdown",role="button",aria-haspopup="true",aria-expanded="false")
span.glyphicon.glyphicon-user
| {{session.login.username}}
span.caret
ul.dropdown-menu
li
a(ui-sref="app.L.invites",ui-sref-active="active")
span.glyphicon.glyphicon-send
|  Invites
| Invites
li(ng-if="session.login.superadmin")
a(ui-sref="app.A.admin",ui-sref-active="active")
span.glyphicon.glyphicon-tasks
| User Managment
li
a(ui-sref="app.L.settings",ui-sref-active="active")
span.glyphicon.glyphicon-cog
|  Admin
.navbar-text(ng-class="{ 'active': $state.includes('app.L.settings') }")
| Welcome
a(ui-sref="app.L.settings",ui-sref-active="active") {{session.login.username}}
|  
span.glyphicon.glyphicon-user
.navbar-text
span.glyphicon.glyphicon-log-out(ng-click="logout()")
| Settings
li
a(ng-click="logout()")
span.glyphicon.glyphicon-log-out
| Logout
form.navbar-form.navbar-right(ng-if="!session.login.active",ng-submit="login()")
.form-group(ng-class="{'has-error': (error.fields.indexOf('username') >= 0)}")
input.form-control(ng-model="obj.username",placeholder="Username",pattern=".{3,}")

View File

@ -4,8 +4,15 @@ angular.module('warehost')
.controller('MainCtrl',function($scope,alert,$http,$state,config,session){
$scope.isOpen = false;
$scope.obj = {};
$scope.modules = [];
$scope.$state = $state;
$http.get(config.api+'/modules').then(function(res){
session.set(res);
alert.set(res);
$scope.modules = res.data.data;
});
$scope.toggleOpen = function(){
$scope.isOpen = !$scope.isOpen;
};

View File

@ -1,9 +1,6 @@
.container
h1 Settings
.row
.col-md-6
h2 Global
form.well.well-sm(ng-submit="submit()",name="myform")
form(ng-submit="submit()",name="myform")
.form-group
label(for="globalUsername") Username
input.form-control(id="globalUsername",ng-model="session.login.username",readonly)
@ -25,5 +22,3 @@
a.btn.btn-danger(ng-click="delete()")
span.glyphicon.glyphicon-trash
| Delete
.col-md-6
h2 Profiles

22
public/app/web/index.js Normal file
View File

@ -0,0 +1,22 @@
'use strict';
angular.module('warehost')
.config(['$stateProvider',function ($stateProvider) {
$stateProvider
.state('app.web', {
url:'/web',
views:{
'menu':{templateUrl:'app/web/menu.html'}
}
})
.state('app.web.index', {
url:'/',
views:{
'@app':{
templateUrl: 'app/home.html',
controller:function(alert){
alert.set({});
}
}
}
});
}]);

2
public/app/web/menu.jade Normal file
View File

@ -0,0 +1,2 @@
li
a(ui-sref="app.web.index",ui-sref-active="active") Home

View File

@ -48,11 +48,12 @@
<!-- build:js({.tmp,public}) app/app.js -->
<script src="app/app.js"></script>
<!-- injector:js -->
<script src="app/host/index.js"></script>
<script src="app/index.js"></script>
<script src="app/invites.js"></script>
<script src="app/main.js"></script>
<script src="app/settings.js"></script>
<script src="app/shift/index.js"></script>
<script src="app/web/index.js"></script>
<script src="components/alert.js"></script>
<script src="components/config.js"></script>
<script src="components/session.js"></script>