Project

General

Profile

« Previous | Next » 

Revision 60206

[Library|Trunk]
Navbar: uk-toogle to close
usermenu: add active menu link

View differences:

userMini.component.ts
5 5
import {StringUtils} from '../utils/string-utils.class';
6 6
import {properties} from "../../../environments/environment";
7 7
import {Subscriber} from "rxjs";
8
import {MenuItem} from "../sharedComponents/menu";
8 9

  
9 10
// declare var logoutClicked;
10 11
@Component({
......
28 29
              </svg>
29 30
            </svg>
30 31
          </a>
31
          <a *ngIf="!loggedIn" class="loginLink" (click)="logIn()">Sign in <span
32
          <a *ngIf="!loggedIn" class="loginLink" id="userMenu-parent" (click)="logIn()">Sign in <span
32 33
              class=" uk-margin-small-left uk-margin-small-right uk-icon"><svg width="20" height="20"
33 34
                                                                               viewBox="0 0 20 20"
34 35
                                                                               xmlns="http://www.w3.org/2000/svg"
......
42 43
          </a>
43 44

  
44 45

  
45
          <div *ngIf="loggedIn" class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left" id="userMenu"
46
               (click)="onClick('userMenu')">
46
          <div *ngIf="loggedIn" class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left" id="userMenu" uk-toggle>
47 47
            <div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack" uk-grid="">
48 48
              <div class="uk-first-column uk-height-max-medium uk-overflow-auto">
49 49
                <ul class="uk-nav uk-navbar-dropdown-nav">
......
51 51
                  <li><a   routerLinkActive="uk-link" routerLink="/myclaims">My Claims</a></li>
52 52
                  <li *ngIf="isAuthorized"><a   routerLinkActive="uk-link" routerLink="/claims">Manage all Claims</a></li-->
53 53
                  <ng-container *ngFor="let item of userMenuItems ">
54
                    <li *ngIf="item.needsAuthorization && isAuthorized || !item.needsAuthorization">
54
                    <li *ngIf="item.needsAuthorization && isAuthorized || !item.needsAuthorization" [class.uk-active]="isTheActiveSubMenu(item)">
55 55
                      <a *ngIf="item.route.length > 0" routerLink="{{item.route}}"
56 56
                         [queryParams]=item.params>{{item.title}}</a>
57 57
                      <a *ngIf="item.route.length == 0 && item.url.length > 0" href="{{item.url}}"
......
259 259
      this.fixRedirectUrl ? (properties.baseLink + this.fixRedirectUrl) : this.redirectUrl, this.search);
260 260
    window.location.href = this.logInUrl;
261 261
  }
262
  
263
  onClick(id: string) {
264
    let el: HTMLElement = document.getElementById(id);
265
    el.setAttribute('uk-toggle', 'true');
262

  
263
  isTheActiveSubMenu(menuItem: MenuItem): boolean {
264
    let currentRoute = this.router.url.split('?')[0];
265
    if (menuItem.route == currentRoute || menuItem.route == (currentRoute + "/") ) {
266
      return true;
267
    }
268
    return false;
266 269
  }
267
  
268 270
  parseName() {
269 271
    this.firstLetters = "";
270 272
    if (this.user && this.user.firstname) {

Also available in: Unified diff