#70: Init user profiles UI

This commit is contained in:
jendib 2016-02-16 01:12:27 +01:00
parent ef3a592807
commit 6fbcd46a76
7 changed files with 46 additions and 3 deletions

View File

@ -484,7 +484,6 @@ public class UserResource extends BaseResource {
if (!authenticate()) {
throw new ForbiddenClientException();
}
checkBaseFunction(BaseFunction.ADMIN);
UserDao userDao = new UserDao();
User user = userDao.getActiveByUsername(username);
@ -519,7 +518,6 @@ public class UserResource extends BaseResource {
if (!authenticate()) {
throw new ForbiddenClientException();
}
checkBaseFunction(BaseFunction.ADMIN);
JsonArrayBuilder users = Json.createArrayBuilder();
PaginatedList<UserDto> paginatedList = PaginatedLists.create(limit, offset);

View File

@ -216,7 +216,25 @@ angular.module('docs',
controller: 'Login'
}
}
});
})
.state('user', {
url: '/user',
views: {
'page': {
templateUrl: 'partial/docs/user.html',
controller: 'User'
}
}
})
.state('user.profile', {
url: '/:username',
views: {
'user': {
templateUrl: 'partial/docs/user.profile.html',
controller: 'UserProfile'
}
}
});
// Configuring Restangular
RestangularProvider.setBaseUrl('../api');

View File

@ -0,0 +1,7 @@
'use strict';
/**
* User controller.
*/
angular.module('docs').controller('User', function() {
});

View File

@ -0,0 +1,11 @@
'use strict';
/**
* User profile controller.
*/
angular.module('docs').controller('UserProfile', function($stateParams, Restangular, $scope) {
// Load user
Restangular.one('user', $stateParams.username).get().then(function(data) {
$scope.user = data;
});
});

View File

@ -61,6 +61,8 @@
<script src="app/docs/controller/SettingsUser.js" type="text/javascript"></script>
<script src="app/docs/controller/SettingsUserEdit.js" type="text/javascript"></script>
<script src="app/docs/controller/SettingsVocabulary.js" type="text/javascript"></script>
<script src="app/docs/controller/User.js" type="text/javascript"></script>
<script src="app/docs/controller/UserProfile.js" type="text/javascript"></script>
<script src="app/docs/service/User.js" type="text/javascript"></script>
<script src="app/docs/service/Tag.js" type="text/javascript"></script>
<script src="app/docs/filter/Newline.js" type="text/javascript"></script>
@ -104,6 +106,9 @@
<li ng-class="{active: $uiRoute}" ui-route="/tag.*">
<a href="#/tag"><span class="glyphicon glyphicon-tags"></span> Tags</a>
</li>
<li ng-class="{active: $uiRoute}" ui-route="/user.*">
<a href="#/user"><span class="glyphicon glyphicon-user"></span> Users</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right" ng-show="!userInfo.anonymous">

View File

@ -0,0 +1,3 @@
User
<div ui-view="user"></div>

View File

@ -0,0 +1 @@
{{ user }}