diff --git a/public/app/host/index.js b/public/app/host/index.js new file mode 100644 index 0000000..5deb3ff --- /dev/null +++ b/public/app/host/index.js @@ -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({}); + } + } + } + }); + }]); diff --git a/public/app/host/menu.jade b/public/app/host/menu.jade new file mode 100644 index 0000000..1ec5818 --- /dev/null +++ b/public/app/host/menu.jade @@ -0,0 +1,2 @@ +li + a(ui-sref="app.host.index",ui-sref-active="active") Home diff --git a/public/app/main.jade b/public/app/main.jade index 7a4df80..18ae41c 100644 --- a/public/app/main.jade +++ b/public/app/main.jade @@ -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 - a(ui-sref="app.L.invites",ui-sref-active="active") - span.glyphicon.glyphicon-send - |  Invites - li(ng-if="session.login.superadmin") - a(ui-sref="app.A.admin",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()") + 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 + 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 + | 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,}") diff --git a/public/app/main.js b/public/app/main.js index 5755c87..8d5ad0f 100644 --- a/public/app/main.js +++ b/public/app/main.js @@ -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; }; diff --git a/public/app/settings.jade b/public/app/settings.jade index 4470fd1..4475639 100644 --- a/public/app/settings.jade +++ b/public/app/settings.jade @@ -1,29 +1,24 @@ .container h1 Settings - .row - .col-md-6 - h2 Global - form.well.well-sm(ng-submit="submit()",name="myform") - .form-group - label(for="globalUsername") Username - input.form-control(id="globalUsername",ng-model="session.login.username",readonly) - .form-group(ng-class="{'has-error': (error.fields.indexOf('currentpassword') >= 0)}") - label(for="currentPassword") Current Password - input.form-control(id="currentPassword",type="password",ng-model="obj.currentPassword") - .form-group(ng-class="{'has-error': (error.fields.indexOf('newpassword') >= 0 || !myform.newPassword.$valid)}") - label(for="newPassword") New Password - input.form-control(id="newPassword",type="password",name="newPassword",ng-model="obj.newPassword",ng-minlength="3") - .form-group(ng-class="{'has-error': (obj.newPassword != obj.repeatPassword && myform.repeatPassword.$dirty)}") - label(for="repeatPassword") Again Password - input.form-control(id="repeatPassword",type="password",name="repeatPassword",ng-model="obj.repeatPassword") - .row - .col-xs-6 - button.btn.btn-primary(type="submit") - span.glyphicon.glyphicon-floppy-disk - | Save - .col-xs-6.text-right - a.btn.btn-danger(ng-click="delete()") - span.glyphicon.glyphicon-trash - | Delete - .col-md-6 - h2 Profiles + form(ng-submit="submit()",name="myform") + .form-group + label(for="globalUsername") Username + input.form-control(id="globalUsername",ng-model="session.login.username",readonly) + .form-group(ng-class="{'has-error': (error.fields.indexOf('currentpassword') >= 0)}") + label(for="currentPassword") Current Password + input.form-control(id="currentPassword",type="password",ng-model="obj.currentPassword") + .form-group(ng-class="{'has-error': (error.fields.indexOf('newpassword') >= 0 || !myform.newPassword.$valid)}") + label(for="newPassword") New Password + input.form-control(id="newPassword",type="password",name="newPassword",ng-model="obj.newPassword",ng-minlength="3") + .form-group(ng-class="{'has-error': (obj.newPassword != obj.repeatPassword && myform.repeatPassword.$dirty)}") + label(for="repeatPassword") Again Password + input.form-control(id="repeatPassword",type="password",name="repeatPassword",ng-model="obj.repeatPassword") + .row + .col-xs-6 + button.btn.btn-primary(type="submit") + span.glyphicon.glyphicon-floppy-disk + | Save + .col-xs-6.text-right + a.btn.btn-danger(ng-click="delete()") + span.glyphicon.glyphicon-trash + | Delete diff --git a/public/app/shift/index.js b/public/app/shift/index.js deleted file mode 100644 index e69de29..0000000 diff --git a/public/app/web/index.js b/public/app/web/index.js new file mode 100644 index 0000000..fa968c2 --- /dev/null +++ b/public/app/web/index.js @@ -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({}); + } + } + } + }); + }]); diff --git a/public/app/web/menu.jade b/public/app/web/menu.jade new file mode 100644 index 0000000..0f141a7 --- /dev/null +++ b/public/app/web/menu.jade @@ -0,0 +1,2 @@ +li + a(ui-sref="app.web.index",ui-sref-active="active") Home diff --git a/public/index.html b/public/index.html index c20563f..08daf6b 100644 --- a/public/index.html +++ b/public/index.html @@ -48,11 +48,12 @@ + - +