aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/src/app/shared/shared-main/buttons/action-dropdown.component.html
blob: 17acb3eaba434b41f59529432761eb9953626037 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                                                                                                   
         
                                                                                                                                                          
                                                                             
   


                                                                                                                                     
                                                                  
           
 
                                             
                                                       
 
                                                   
                                                                                                                     
 
                                                       
                                                                                                                                                           
 
                                    
                                                  
                                                                                              


                        

                                                                                                         
                                                                                                                                                      
           
                                                                                                                


               
                                                                                                          
                                                                                                                                                                             
           
                                                                                                                
                 
 
             
                                                                                                                                                
                                                                                                                                      



                                                                                                                
              
                     
 
                                                                                      
 

                   
      
<div class="dropdown-root" ngbDropdown [placement]="placement" [container]="container" *ngIf="areActionsDisplayed(actions, entry)">
  <button
    class="action-button" [ngClass]="{ small: buttonSize === 'small', grey: theme === 'grey', orange: theme === 'orange', 'button-styled': buttonStyled }"
    ngbDropdownToggle role="button" aria-label="Open actions" i18n-aria-label
  >
    <my-global-icon *ngIf="!label && buttonDirection === 'horizontal'" class="more-icon" iconName="more-horizontal"></my-global-icon>
    <my-global-icon *ngIf="!label && buttonDirection === 'vertical'" class="more-icon" iconName="more-vertical"></my-global-icon>

    <span *ngIf="label" class="dropdown-toggle">{{ label }}</span>
  </button>

  <div ngbDropdownMenu class="dropdown-menu">
    <ng-container *ngFor="let actions of getActions()">

      <ng-container *ngFor="let action of actions">
        <div [ngClass]="action.class" *ngIf="action.isDisplayed === undefined || action.isDisplayed(entry) === true">

          <ng-template #templateActionLabel let-action>
            <my-global-icon *ngIf="action.iconName" [iconName]="action.iconName" [ngClass]="'icon-' + action.iconName" aria-hidden="true"></my-global-icon>

            <div class="item-label">
              <span i18n>{{ action.label }}</span>
              <small class="muted" *ngIf="action.description">{{ action.description }}</small>
            </div>
          </ng-template>

          <a
            *ngIf="action.linkBuilder && !action.isHeader" [ngClass]="{ 'with-icon': !!action.iconName }"
            class="dropdown-item"  [routerLink]="action.linkBuilder(entry)" [queryParams]="getQueryParams(action, entry)" [title]="action.title || ''"
          >
            <ng-container *ngTemplateOutlet="templateActionLabel; context:{ $implicit: action }"></ng-container>
          </a>

          <span
            *ngIf="!action.linkBuilder && !action.isHeader" [ngClass]="{ 'with-icon': !!action.iconName }"
            class="custom-action dropdown-item" tabindex="0" role="button" [title]="action.title || ''" (click)="action.handler(entry)" (keyup.enter)="action.handler(entry)"
          >
            <ng-container *ngTemplateOutlet="templateActionLabel; context:{ $implicit: action }"></ng-container>
          </span>

          <h6
            *ngIf="!action.linkBuilder && action.isHeader && areActionsDisplayed(actions, entry)" [ngClass]="{ 'with-icon': !!action.iconName }"
            class="dropdown-header" [title]="action.title || ''" (click)="action.handler(entry)" (keyup.enter)="action.handler(entry)"
          >
            <ng-container *ngTemplateOutlet="templateActionLabel; context:{ $implicit: action }"></ng-container>
          </h6>

        </div>
      </ng-container>

      <div *ngIf="areActionsDisplayed(actions, entry)" class="dropdown-divider"></div>

    </ng-container>
  </div>
</div>