Browse Source

navbar

develop
Robin Thoni 9 years ago
parent
commit
2aabce2782
2 changed files with 18 additions and 2 deletions
  1. 15
    0
      luticate/controllers/navbar.controller.js
  2. 3
    2
      luticate/views/navbar.html

+ 15
- 0
luticate/controllers/navbar.controller.js View File

16
                 {
16
                 {
17
                     $state.go('login');
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 View File

18
                 <li><a href="#/users" lu-show-permission="LU_USER_GET">Users</a></li>
18
                 <li><a href="#/users" lu-show-permission="LU_USER_GET">Users</a></li>
19
                 <li><a href="#/groups" lu-show-permission="LU_GROUP_GET">Groups</a></li>
19
                 <li><a href="#/groups" lu-show-permission="LU_GROUP_GET">Groups</a></li>
20
                 <li><a href="#/permissions" lu-show-permission="LU_PERM_GET">Permissions</a></li>
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
             </ul>
22
             </ul>
23
             <ul class="nav navbar-nav navbar-right">
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
             </ul>
26
             </ul>
26
         </div>
27
         </div>
27
         <!-- /.navbar-collapse -->
28
         <!-- /.navbar-collapse -->

Loading…
Cancel
Save