Refactor filter buttons to standalone component
							parent
							
								
									ff0e615862
								
							
						
					
					
						commit
						0255e63c3a
					
				| 
						 | 
					@ -0,0 +1,15 @@
 | 
				
			||||||
 | 
					.list-header {
 | 
				
			||||||
 | 
					  width: 100%;
 | 
				
			||||||
 | 
					  padding-bottom: 20px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.add-btn {
 | 
				
			||||||
 | 
					  margin-right: 16px;
 | 
				
			||||||
 | 
					  margin-top: -3px;
 | 
				
			||||||
 | 
					  float: right;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					:host/deep/.mat-icon {
 | 
				
			||||||
 | 
					  height: 32px;
 | 
				
			||||||
 | 
					  width: 32px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,11 @@
 | 
				
			||||||
 | 
					<div class="input-group list-header pull-left">
 | 
				
			||||||
 | 
					  <mat-button-toggle-group #group="matButtonToggleGroup">
 | 
				
			||||||
 | 
					    <mat-button-toggle *ngFor="let button of filterButtons" value="{{button.value}}" (change)="execute(group)">
 | 
				
			||||||
 | 
					      {{button.label}}
 | 
				
			||||||
 | 
					    </mat-button-toggle>
 | 
				
			||||||
 | 
					  </mat-button-toggle-group>
 | 
				
			||||||
 | 
					  <button mat-icon-button class="add-btn">
 | 
				
			||||||
 | 
					    <mat-icon svgIcon="{{addButton.svgIcon}}" title="addButton.tooltip"
 | 
				
			||||||
 | 
					              (click)="add()"></mat-icon>
 | 
				
			||||||
 | 
					  </button>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,28 @@
 | 
				
			||||||
 | 
					import {Component, EventEmitter, Input, Output} from '@angular/core';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Component({
 | 
				
			||||||
 | 
					  selector: 'cc-list-filter',
 | 
				
			||||||
 | 
					  templateUrl: './list-filter.component.html',
 | 
				
			||||||
 | 
					  styleUrls: ['./list-filter.component.css']
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					export class ListFilterComponent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @Input() filterButtons: any[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @Input() addButton: any;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @Output() executeSearch = new EventEmitter();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @Output() openAddFrom = new EventEmitter();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  constructor() {
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  execute(group) {
 | 
				
			||||||
 | 
					    this.executeSearch.emit(group);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  add() {
 | 
				
			||||||
 | 
					    this.openAddFrom.emit();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1,21 +1,12 @@
 | 
				
			||||||
<div class="select-list">
 | 
					<div class="select-list">
 | 
				
			||||||
  <div class="input-group list-header pull-left">
 | 
					  <cc-list-filter
 | 
				
			||||||
    <mat-button-toggle-group #group="matButtonToggleGroup">
 | 
					    [filterButtons]="[{label: fraction.BLUFOR, value: 'BLUFOR'},
 | 
				
			||||||
      <mat-button-toggle value="BLUFOR" (change)="filterDecorations(group)">
 | 
					                      {label: fraction.OPFOR, value: 'OPFOR'},
 | 
				
			||||||
        {{fraction.BLUFOR}}
 | 
					                      {label: 'Global', value: 'GLOBAL'}]"
 | 
				
			||||||
      </mat-button-toggle>
 | 
					    [addButton]="{svgIcon: 'add', tooltip: 'Neue Auszeichnung hinzufügen'}"
 | 
				
			||||||
      <mat-button-toggle value="OPFOR" (change)="filterDecorations(group)">
 | 
					    (executeSearch)="filterDecorations($event)"
 | 
				
			||||||
        {{fraction.OPFOR}}
 | 
					    (openAddFrom)="openNewDecorationForm()">
 | 
				
			||||||
      </mat-button-toggle>
 | 
					  </cc-list-filter>
 | 
				
			||||||
      <mat-button-toggle value="GLOBAL" (change)="filterDecorations(group)">
 | 
					 | 
				
			||||||
        Global
 | 
					 | 
				
			||||||
      </mat-button-toggle>
 | 
					 | 
				
			||||||
    </mat-button-toggle-group>
 | 
					 | 
				
			||||||
    <button mat-icon-button class="add-btn">
 | 
					 | 
				
			||||||
      <mat-icon svgIcon="add" title="Neue Auszeichnung hinzufügen"
 | 
					 | 
				
			||||||
                (click)="openNewDecorationForm()"></mat-icon>
 | 
					 | 
				
			||||||
    </button>
 | 
					 | 
				
			||||||
  </div>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <div class="input-group list-header">
 | 
					  <div class="input-group list-header">
 | 
				
			||||||
    <input id="search-tasks"
 | 
					    <input id="search-tasks"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,6 +4,7 @@ import {DecorationListComponent} from './decoration-list/decoration-list.compone
 | 
				
			||||||
import {EditDecorationComponent} from './edit-decoration/edit-decoration.component';
 | 
					import {EditDecorationComponent} from './edit-decoration/edit-decoration.component';
 | 
				
			||||||
import {ModuleWithProviders} from '@angular/core';
 | 
					import {ModuleWithProviders} from '@angular/core';
 | 
				
			||||||
import {DecorationItemComponent} from './decoration-list/decoration-item.component';
 | 
					import {DecorationItemComponent} from './decoration-list/decoration-item.component';
 | 
				
			||||||
 | 
					import {ListFilterComponent} from '../common/user-interface/list-filter/list-filter.component';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const decorationsRoutes: Routes = [{
 | 
					export const decorationsRoutes: Routes = [{
 | 
				
			||||||
  path: '', component: DecorationComponent,
 | 
					  path: '', component: DecorationComponent,
 | 
				
			||||||
| 
						 | 
					@ -28,5 +29,5 @@ export const decorationsRoutes: Routes = [{
 | 
				
			||||||
export const decorationRoutesModule: ModuleWithProviders = RouterModule.forChild(decorationsRoutes);
 | 
					export const decorationRoutesModule: ModuleWithProviders = RouterModule.forChild(decorationsRoutes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const decorationsRoutingComponents = [DecorationItemComponent, DecorationComponent, DecorationListComponent,
 | 
					export const decorationsRoutingComponents = [DecorationItemComponent, DecorationComponent, DecorationListComponent,
 | 
				
			||||||
  EditDecorationComponent];
 | 
					  EditDecorationComponent, ListFilterComponent];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue