From 591de8ae0ea4dae4e7f1e210dfd19cb1a582d3da Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Wed, 31 Aug 2016 10:42:23 -0400 Subject: [PATCH] nitweb: extract user sidebar directive Signed-off-by: Alexandre Terrasa --- share/nitweb/directives/user/sidebar.html | 15 +++++++++++++++ share/nitweb/javascripts/users.js | 11 +++++++++-- share/nitweb/views/user.html | 18 +++--------------- 3 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 share/nitweb/directives/user/sidebar.html diff --git a/share/nitweb/directives/user/sidebar.html b/share/nitweb/directives/user/sidebar.html new file mode 100644 index 0000000..8a546f9 --- /dev/null +++ b/share/nitweb/directives/user/sidebar.html @@ -0,0 +1,15 @@ +
+ +

{{user.login}}

+

{{user.name}}

+ +
diff --git a/share/nitweb/javascripts/users.js b/share/nitweb/javascripts/users.js index b9c077a..bd446b7 100644 --- a/share/nitweb/javascripts/users.js +++ b/share/nitweb/javascripts/users.js @@ -39,7 +39,7 @@ this.loadGrades(); }]) - .directive('userMenu', ['User', function(User) { + .directive('userMenu', ['User', '$rootScope', function(User, $rootScope) { return { restrict: 'E', templateUrl: '/directives/user/user-menu.html', @@ -47,7 +47,7 @@ $scope.loadUser = function() { User.loadUser( function(data) { - $scope.user = data; + $rootScope.user = data; }, function(err) { //$scope.error = err; }); @@ -56,4 +56,11 @@ } }; }]) + + .directive('userSidebar', ['User', '$rootScope', function(User, $rootScope) { + return { + restrict: 'E', + templateUrl: '/directives/user/sidebar.html', + }; + }]) })(); diff --git a/share/nitweb/views/user.html b/share/nitweb/views/user.html index c9f10f5..b1d947c 100644 --- a/share/nitweb/views/user.html +++ b/share/nitweb/views/user.html @@ -1,18 +1,6 @@ -
-
- -

{{user.login}}

-

{{user.name}}

- +
+
+

Your grades

-- 1.7.9.5