<script src='/javascripts/index.js'></script>
<script src='/javascripts/docdown.js'></script>
<script src='/javascripts/metrics.js'></script>
+ <script src='/javascripts/users.js'></script>
</body>
</html>
}
}
}])
+
+ .factory('User', [ '$http', function($http) {
+ return {
+ loadUser: function(cb, cbErr) {
+ $http.get(apiUrl + '/user')
+ .success(cb)
+ .error(cbErr);
+ }
+ }
+ }])
})();
*/
(function() {
- angular.module('nitweb', ['ngRoute', 'ngSanitize', 'angular-loading-bar', 'entities', 'docdown', 'index', 'metrics'])
+ angular.module('nitweb', ['ngRoute', 'ngSanitize', 'angular-loading-bar', 'entities', 'docdown', 'index', 'metrics', 'users'])
.config(['cfpLoadingBarProvider', function(cfpLoadingBarProvider) {
cfpLoadingBarProvider.includeSpinner = false;
}])
controller: 'IndexCtrl',
controllerAs: 'indexCtrl'
})
+ .when('/user', {
+ templateUrl: 'views/user.html',
+ controller: 'UserCtrl',
+ controllerAs: 'userCtrl'
+ })
.when('/docdown', {
templateUrl: 'views/docdown.html',
controller: 'DocdownCtrl',
controllerAs: 'docdownCtrl'
})
+ .when('/login', {
+ controller : function(){
+ window.location.replace('/login');
+ },
+ template : "<div></div>"
+ })
+ .when('/logout', {
+ controller : function(){
+ window.location.replace('/logout');
+ },
+ template : "<div></div>"
+ })
.when('/doc/:id', {
templateUrl: 'views/doc.html',
controller: 'EntityCtrl',
--- /dev/null
+/*
+ * Copyright 2016 Alexandre Terrasa <alexandre@moz-code.org>.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function() {
+ angular
+ .module('users', ['ngSanitize', 'model'])
+
+ .controller('UserCtrl', ['User', '$routeParams', '$scope', function(User, $routeParams, $scope) {
+ this.loadUser = function() {
+ User.loadUser(
+ function(data) {
+ $scope.user = data;
+ }, function(err) {
+ $scope.error = err;
+ });
+ };
+
+ this.loadUser();
+ }])
+
+ .directive('userMenu', ['User', function(User) {
+ return {
+ restrict: 'E',
+ templateUrl: '/directives/user/user-menu.html',
+ link: function ($scope, element, attrs) {
+ $scope.loadUser = function() {
+ User.loadUser(
+ function(data) {
+ $scope.user = data;
+ }, function(err) {
+ //$scope.error = err;
+ });
+ }
+ $scope.loadUser();
+ }
+ };
+ }])
+})();
--- /dev/null
+<div class='container'>
+ <div class='col-xs-4'>
+ <img class='avatar' width='100%' src='{{user.avatar_url}}' />
+ <h1>{{user.login}}</h1>
+ <h3>{{user.name}}</h3>
+ <ul class='list-unstyled'>
+ <li>
+ <span class='glyphicon glyphicon-envelope' />
+ <a href='mailto:{{user.email}}'>{{user.email}}</a>
+ </li>
+ <li>
+ <span class='glyphicon glyphicon-link' />
+ <a href='{{user.blog}}'>{{user.blog}}</a>
+ </li>
+ </ul>
+ </div>
+ <div class='col-xs-8'>
+ Nothing to display yet.
+ </div>
+<div>