mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-06 09:20:43 +01:00
organization pages and routing
This commit is contained in:
parent
4fdf2a98bf
commit
4d71a05d2a
@ -121,10 +121,16 @@ angular
|
||||
abstract: true
|
||||
})
|
||||
.state('backend.org.dashboard', {
|
||||
url: '^/organization/:id',
|
||||
templateUrl: 'app/organization/views/dashboard.html',
|
||||
url: '^/organization/:orgId',
|
||||
templateUrl: 'app/organization/views/organizationDashboard.html',
|
||||
controller: 'organizationDashboardController',
|
||||
data: { pageTitle: 'Org Dash' }
|
||||
data: { pageTitle: 'Organization Dashboard' }
|
||||
})
|
||||
.state('backend.org.people', {
|
||||
url: '/organization/:orgId/people',
|
||||
templateUrl: 'app/organization/views/organizationPeople.html',
|
||||
controller: 'organizationPeopleController',
|
||||
data: { pageTitle: 'Organization People' }
|
||||
})
|
||||
|
||||
// Frontend
|
||||
|
@ -4,7 +4,6 @@ angular
|
||||
.controller('mainController', function ($scope, $state, authService, appSettings, toastr) {
|
||||
var vm = this;
|
||||
vm.bodyClass = '';
|
||||
vm.userProfile = null;
|
||||
vm.searchVaultText = null;
|
||||
vm.version = appSettings.version;
|
||||
|
||||
@ -27,7 +26,6 @@ angular
|
||||
|
||||
$scope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
|
||||
vm.searchVaultText = null;
|
||||
vm.userProfile = authService.getUserProfile();
|
||||
|
||||
if (toState.data.bodyClass) {
|
||||
vm.bodyClass = toState.data.bodyClass;
|
||||
|
@ -1,6 +1,17 @@
|
||||
angular
|
||||
.module('bit.global')
|
||||
|
||||
.controller('sideNavController', function ($scope, $state) {
|
||||
.controller('sideNavController', function ($scope, $state, authService, apiService) {
|
||||
$scope.$state = $state;
|
||||
$scope.params = $state.params;
|
||||
|
||||
if ($state.includes('backend.user')) {
|
||||
$scope.userProfile = authService.getUserProfile();
|
||||
}
|
||||
else if ($state.includes('backend.org')) {
|
||||
$scope.orgProfile = {};
|
||||
apiService.organizations.get({ id: $state.params.orgId }, function (response) {
|
||||
$scope.orgProfile.name = response.Name;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
6
src/app/organization/organizationPeopleController.js
Normal file
6
src/app/organization/organizationPeopleController.js
Normal file
@ -0,0 +1,6 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationPeopleController', function ($scope) {
|
||||
|
||||
});
|
16
src/app/organization/views/organizationPeople.html
Normal file
16
src/app/organization/views/organizationPeople.html
Normal file
@ -0,0 +1,16 @@
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
People
|
||||
<small>users for your organization</small>
|
||||
</h1>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Users</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
Some data
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
@ -31,6 +31,7 @@
|
||||
|
||||
_service.organizations = $resource(_apiUri + '/organizations/:id', {}, {
|
||||
get: { method: 'GET', params: { id: '@id' } },
|
||||
getExtended: { url: _apiUri + '/organizations/:id/extended', method: 'GET', params: { id: '@id' } },
|
||||
list: { method: 'GET', params: {} },
|
||||
post: { method: 'POST', params: {} },
|
||||
put: { method: 'POST', params: { id: '@id' } },
|
||||
|
@ -86,6 +86,18 @@ angular
|
||||
twoFactorEnabled: profile.TwoFactorEnabled,
|
||||
culture: profile.Culture
|
||||
};
|
||||
|
||||
if (profile.Organizations) {
|
||||
var orgs = [];
|
||||
for (var i = 0; i < profile.Organizations.length; i++) {
|
||||
orgs.push({
|
||||
id: profile.Organizations[i].Id,
|
||||
name: profile.Organizations[i].Name
|
||||
});
|
||||
}
|
||||
|
||||
_userProfile.organizations = orgs;
|
||||
}
|
||||
}
|
||||
|
||||
_service.isAuthenticated = function () {
|
||||
|
@ -71,7 +71,7 @@
|
||||
};
|
||||
|
||||
$scope.viewOrganization = function (id) {
|
||||
$state.go('backend.org.dashboard', { id: id });
|
||||
$state.go('backend.org.dashboard', { orgId: id });
|
||||
};
|
||||
|
||||
$scope.twoFactor = function () {
|
||||
|
@ -37,7 +37,7 @@
|
||||
</div>
|
||||
<div class="col-sm-3 settings-photo">
|
||||
<a href="http://www.gravatar.com/" target="_blank">
|
||||
<img src="//www.gravatar.com/avatar/{{ main.userProfile.email | gravatar }}.jpg?s=150&d=mm"
|
||||
<img src="//www.gravatar.com/avatar/{{ model.email | gravatar }}.jpg?s=150&d=mm"
|
||||
class="img-rounded img-responsive" alt="User Image">
|
||||
</a>
|
||||
<a href="http://www.gravatar.com/" target="_blank" class="btn btn-link"
|
||||
|
@ -18,20 +18,30 @@
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<aside class="main-sidebar" ng-controller="sideNavController as sideNav">
|
||||
<aside class="main-sidebar" ng-controller="sideNavController">
|
||||
<section class="sidebar">
|
||||
<div class="user-panel">
|
||||
<div class="pull-left image">
|
||||
<img src="//www.gravatar.com/avatar/{{ main.userProfile.email | gravatar }}.jpg?s=45&d=mm"
|
||||
<img src="//www.gravatar.com/avatar/{{ orgProfile.name | gravatar }}.jpg?s=45&d=mm"
|
||||
class="img-circle" alt="User Image">
|
||||
</div>
|
||||
<div class="pull-left info">
|
||||
<p>{{main.userProfile.extended && main.userProfile.extended.name ? main.userProfile.extended.name : main.userProfile.email}}</p>
|
||||
<p>{{orgProfile.name}}</p>
|
||||
<a ui-sref="frontend.logout">Log Out</a>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="sidebar-menu">
|
||||
<li class="header">ORG</li>
|
||||
<li class="header">MY ORGANIZATION</li>
|
||||
<li ng-class="{active: $state.is('backend.org.dashboard')}">
|
||||
<a ui-sref="backend.org.dashboard({orgId: params.orgId})">
|
||||
<i class="fa fa-dashboard fa-fw"></i> <span>Dashboard</span>
|
||||
</a>
|
||||
</li>
|
||||
<li ng-class="{active: $state.is('backend.org.people')}">
|
||||
<a ui-sref="backend.org.people({orgId: params.orgId})">
|
||||
<i class="fa fa-users fa-fw"></i> <span>People</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</aside>
|
||||
|
@ -22,11 +22,11 @@
|
||||
<section class="sidebar">
|
||||
<div class="user-panel">
|
||||
<div class="pull-left image">
|
||||
<img src="//www.gravatar.com/avatar/{{ main.userProfile.email | gravatar }}.jpg?s=45&d=mm"
|
||||
<img src="//www.gravatar.com/avatar/{{ userProfile.email | gravatar }}.jpg?s=45&d=mm"
|
||||
class="img-circle" alt="User Image">
|
||||
</div>
|
||||
<div class="pull-left info">
|
||||
<p>{{main.userProfile.extended && main.userProfile.extended.name ? main.userProfile.extended.name : main.userProfile.email}}</p>
|
||||
<p>{{userProfile.extended && userProfile.extended.name ? userProfile.extended.name : userProfile.email}}</p>
|
||||
<a ui-sref="frontend.logout">Log Out</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -122,6 +122,7 @@
|
||||
|
||||
<script src="app/organization/organizationModule.js"></script>
|
||||
<script src="app/organization/organizationDashboardController.js"></script>
|
||||
<script src="app/organization/organizationPeopleController.js"></script>
|
||||
|
||||
<script src="app/settings/settingsModule.js"></script>
|
||||
<script src="app/settings/settingsController.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user