Users viewing

This commit is contained in:
jendib 2013-08-08 20:17:16 +02:00
parent f328aedccd
commit 990884137b
7 changed files with 86 additions and 0 deletions

View File

@ -45,6 +45,8 @@
<script src="js/controller/SettingsAccount.js" type="text/javascript"></script> <script src="js/controller/SettingsAccount.js" type="text/javascript"></script>
<script src="js/controller/SettingsSession.js" type="text/javascript"></script> <script src="js/controller/SettingsSession.js" type="text/javascript"></script>
<script src="js/controller/SettingsLog.js" type="text/javascript"></script> <script src="js/controller/SettingsLog.js" type="text/javascript"></script>
<script src="js/controller/SettingsUser.js" type="text/javascript"></script>
<script src="js/controller/SettingsUserEdit.js" type="text/javascript"></script>
<script src="js/service/User.js" type="text/javascript"></script> <script src="js/service/User.js" type="text/javascript"></script>
<script src="js/service/Tag.js" type="text/javascript"></script> <script src="js/service/Tag.js" type="text/javascript"></script>
<script src="js/filter/Newline.js" type="text/javascript"></script> <script src="js/filter/Newline.js" type="text/javascript"></script>

View File

@ -75,6 +75,24 @@ var App = angular.module('docs', ['ui.state', 'ui.bootstrap', 'ui.route', 'ui.ke
} }
} }
}) })
.state('settings.user', {
url: '/user',
views: {
'settings': {
templateUrl: 'partial/settings.user.html',
controller: 'SettingsUser'
}
}
})
.state('settings.user.edit', {
url: '/:username',
views: {
'user': {
templateUrl: 'partial/settings.user.edit.html',
controller: 'SettingsUserEdit'
}
}
})
.state('document', { .state('document', {
url: '/document', url: '/document',
abstract: true, abstract: true,

View File

@ -0,0 +1,18 @@
'use strict';
/**
* Settings user page controller.
*/
App.controller('SettingsUser', function($scope, $state, Restangular) {
// Load users from server
Restangular.one('user/list').get({ limit: 100 }).then(function(data) {
$scope.users = data.users;
});
/**
* Edit a user.
*/
$scope.editUser = function(user) {
$state.transitionTo('settings.user.edit', { username: user.username });
};
});

View File

@ -0,0 +1,8 @@
'use strict';
/**
* Settings user edition page controller.
*/
App.controller('SettingsUserEdit', function($scope, $stateParams, Restangular) {
$scope.user = Restangular.one('user', $stateParams.username).get();
});

View File

@ -7,6 +7,7 @@
<li ng-class="{active: $uiRoute}" ui-route="/settings/session"><a href="#/settings/session">Opened sessions</a></li> <li ng-class="{active: $uiRoute}" ui-route="/settings/session"><a href="#/settings/session">Opened sessions</a></li>
<li class="nav-header">General settings</li> <li class="nav-header">General settings</li>
<li ng-class="{active: $uiRoute}" ui-route="/settings/user.*" ng-show="userInfo.base_functions.indexOf('ADMIN') != -1"><a href="#/settings/user">Users</a></li>
<li ng-class="{active: $uiRoute}" ui-route="/settings/log"><a href="#/settings/log">Server logs</a></li> <li ng-class="{active: $uiRoute}" ui-route="/settings/log"><a href="#/settings/log">Server logs</a></li>
</ul> </ul>
</div> </div>

View File

@ -0,0 +1,13 @@
<h2>{{ user.username }}</h2>
<dl class="dl-horizontal">
<dt>E-mail</dt>
<dd>{{ user.email }}</dd>
</dl>
<dl class="dl-horizontal">
<dt>Theme</dt>
<dd>{{ user.theme }}</dd>
</dl>
<dl class="dl-horizontal">
<dt>Locale</dt>
<dd>{{ user.locale }}</dd>
</dl>

View File

@ -0,0 +1,26 @@
<h1>Users <small>management</small></h1>
<div class="container-fluid">
<div class="row-fluid">
<div class="span4 well">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Username</th>
<th>Create date</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="user in users" ng-click="editUser(user)">
<td>{{ user.username }}</td>
<td>{{ user.create_date | date: 'yyyy-MM-dd' }}</td>
</tr>
</tbody>
</table>
</div>
<div class="span8">
<div ui-view="user"></div>
</div>
</div>
</div>