Kaynağa Gözat

navbar

develop
Robin Thoni 9 yıl önce
ebeveyn
işleme
2aabce2782

+ 15
- 0
luticate/controllers/navbar.controller.js Dosyayı Görüntüle

@@ -16,5 +16,20 @@ angular.module('luticate')
16 16
                 {
17 17
                     $state.go('login');
18 18
                 });
19
+            };
20
+
21
+            $scope.isLogged = function()
22
+            {
23
+                var user = luticateAuthCache.getUser();
24
+                return user != null && user.Id != 0;
25
+            };
26
+
27
+            $scope.getUsername = function()
28
+            {
29
+                var user = luticateAuthCache.getUser();
30
+                if (user != null) {
31
+                    return user.Username;
32
+                }
33
+                return "";
19 34
             }
20 35
         }]);

+ 3
- 2
luticate/views/navbar.html Dosyayı Görüntüle

@@ -18,10 +18,11 @@
18 18
                 <li><a href="#/users" lu-show-permission="LU_USER_GET">Users</a></li>
19 19
                 <li><a href="#/groups" lu-show-permission="LU_GROUP_GET">Groups</a></li>
20 20
                 <li><a href="#/permissions" lu-show-permission="LU_PERM_GET">Permissions</a></li>
21
-                <li><a href="#/test" >Test</a></li>
21
+                <!--<li><a href="#/test" >Test</a></li>-->
22 22
             </ul>
23 23
             <ul class="nav navbar-nav navbar-right">
24
-                <li><a href="" ng-click="logout()">Logout</a></li>
24
+                <li ng-show="isLogged()"><a href="#/home">{{ getUsername() }}</a></li>
25
+                <li ng-show="isLogged()"><a href="" ng-click="logout()">Logout</a></li>
25 26
             </ul>
26 27
         </div>
27 28
         <!-- /.navbar-collapse -->

Loading…
İptal
Kaydet