#70: User profiles UI

This commit is contained in:
jendib 2016-02-17 00:28:48 +01:00
parent 6fbcd46a76
commit adebb7ff6d
4 changed files with 43 additions and 6 deletions

View File

@ -3,5 +3,14 @@
/** /**
* User controller. * User controller.
*/ */
angular.module('docs').controller('User', function() { angular.module('docs').controller('User', function(Restangular, $scope, $state) {
// Load users
Restangular.one('user/list').get({ limit: 100 }).then(function(data) {
$scope.users = data.users;
});
// Open a user
$scope.openUser = function(user) {
$state.go('user.profile', { username: user.username });
};
}); });

View File

@ -17,10 +17,10 @@
<input type="search" class="form-control" placeholder="Search" ng-model="search.name"> <input type="search" class="form-control" placeholder="Search" ng-model="search.name">
</p> </p>
<table class="row table table-striped table-hover table-tags"> <table class="row table table-striped table-hover">
<tbody> <tbody>
<tr ng-repeat="tag in tags | filter:search"> <tr ng-repeat="tag in tags | filter:search">
<td><inline-edit value="tag.name" on-edit="updateTag(tag)" /></td> <td><inline-edit value="tag.name" on-edit="updateTag(tag)" ></inline-edit></td>
<td class="col-xs-4"> <td class="col-xs-4">
<select class="form-control" ng-model="tag.parent" ng-change="updateTag(tag)"> <select class="form-control" ng-model="tag.parent" ng-change="updateTag(tag)">
<option value="" ng-selected="!tag.parent"></option> <option value="" ng-selected="!tag.parent"></option>

View File

@ -1,3 +1,26 @@
User <div class="row">
<div class="col-md-4">
<div class="well">
<p class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-search"></span></span>
<input type="search" class="form-control" placeholder="Search" ng-model="search">
</p>
<div ui-view="user"></div> <table class="row table table-striped table-hover">
<tbody>
<tr class="pointer" ng-repeat="user in users | filter: search"
ng-click="openUser(user)" ng-class="{ active: $stateParams.username == user.username }">
<td class="col-xs-4">
<span class="glyphicon glyphicon-user"></span>
{{ user.username }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-8">
<div ui-view="user"></div>
</div>
</div>

View File

@ -1 +1,6 @@
{{ user }} <div class="page-header">
<h1>{{ user.username }} <small>{{ user.email }}</small></h1>
</div>
<h4>Documents created by {{ user.username }}</h4>
TODO