diff --git a/src/app/core/components/navigation/navigation.component.scss b/src/app/core/components/navigation/navigation.component.scss index d22262b2..8087fe06 100644 --- a/src/app/core/components/navigation/navigation.component.scss +++ b/src/app/core/components/navigation/navigation.component.scss @@ -3,16 +3,4 @@ #main-navigation { margin: 0; padding: 0; - - .nav-item { - - .nav-link { - background-color: map-get($background, raised-button); - color: map_get($foreground, text); - - &:hover { - background-color: map-get($background, hover); - } - } - } } diff --git a/src/app/core/modules/shared.module.ts b/src/app/core/modules/shared.module.ts index 5c698762..66d60ba4 100644 --- a/src/app/core/modules/shared.module.ts +++ b/src/app/core/modules/shared.module.ts @@ -1,28 +1,28 @@ -import {NgModule} from '@angular/core'; -import {MaterialModule} from './material.module'; -import {FlexLayoutModule} from '@angular/flex-layout'; -import {FormsModule} from '@angular/forms'; -import {CommonModule} from '@angular/common'; +import { NgModule } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { CommonModule } from '@angular/common'; + +import { MaterialModule } from './material.module'; +import { FlexLayoutModule } from '@angular/flex-layout'; +import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar'; + import { FuseMdSidenavHelperDirective, FuseMdSidenavTogglerDirective } from '../directives/md-sidenav-helper/md-sidenav-helper.directive'; -import {PerfectScrollbarModule} from 'ngx-perfect-scrollbar'; -import {KeysPipe} from '../pipes/keys'; -import {HtmlToPlaintextPipe} from '../pipes//htmlToPlaintext'; +import { FusePipesModule } from '../pipes/pipes.module'; @NgModule({ declarations: [ FuseMdSidenavHelperDirective, - FuseMdSidenavTogglerDirective, - KeysPipe, - HtmlToPlaintextPipe + FuseMdSidenavTogglerDirective ], imports : [ FlexLayoutModule, MaterialModule, CommonModule, FormsModule, + FusePipesModule, PerfectScrollbarModule ], exports : [ @@ -32,9 +32,8 @@ import {HtmlToPlaintextPipe} from '../pipes//htmlToPlaintext'; FormsModule, FuseMdSidenavHelperDirective, FuseMdSidenavTogglerDirective, - PerfectScrollbarModule, - KeysPipe, - HtmlToPlaintextPipe + FusePipesModule, + PerfectScrollbarModule ] }) diff --git a/src/app/core/pipes/getById.pipe.ts b/src/app/core/pipes/getById.pipe.ts new file mode 100644 index 00000000..fbbf6895 --- /dev/null +++ b/src/app/core/pipes/getById.pipe.ts @@ -0,0 +1,22 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({name: 'getById'}) +export class GetByIdPipe implements PipeTransform +{ + transform(value: any[], id: number, property: string ): any + { + const foundItem = value.find(item => { + if ( item.id ) + { + return item.id === id; + } + + return false; + }); + + if ( foundItem ) + { + return foundItem[property]; + } + } +} diff --git a/src/app/core/pipes/htmlToPlaintext.ts b/src/app/core/pipes/htmlToPlaintext.pipe.ts similarity index 100% rename from src/app/core/pipes/htmlToPlaintext.ts rename to src/app/core/pipes/htmlToPlaintext.pipe.ts diff --git a/src/app/core/pipes/keys.pipe.ts b/src/app/core/pipes/keys.pipe.ts new file mode 100644 index 00000000..03b6355a --- /dev/null +++ b/src/app/core/pipes/keys.pipe.ts @@ -0,0 +1,23 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({name: 'keys'}) +export class KeysPipe implements PipeTransform +{ + transform(value: any, args: string[]): any + { + const keys: any[] = []; + + for ( const key in value ) + { + if ( value.hasOwnProperty(key) ) + { + keys.push({ + key : key, + value: value[key] + }); + } + } + + return keys; + } +} diff --git a/src/app/core/pipes/keys.ts b/src/app/core/pipes/keys.ts deleted file mode 100644 index e7a03181..00000000 --- a/src/app/core/pipes/keys.ts +++ /dev/null @@ -1,15 +0,0 @@ -import {Pipe, PipeTransform} from '@angular/core'; - -@Pipe({name: 'keys'}) -export class KeysPipe implements PipeTransform -{ - transform(value: any, args: string[]): any - { - let keys: any[] = []; - for ( let key in value ) - { - keys.push({key: key, value: value[key]}); - } - return keys; - } -} diff --git a/src/app/core/pipes/pipes.module.ts b/src/app/core/pipes/pipes.module.ts new file mode 100644 index 00000000..a5f01259 --- /dev/null +++ b/src/app/core/pipes/pipes.module.ts @@ -0,0 +1,27 @@ +import { NgModule } from '@angular/core'; + +import { KeysPipe } from './keys.pipe'; +import { GetByIdPipe } from './getById.pipe'; +import { HtmlToPlaintextPipe } from './htmlToPlaintext.pipe'; +import { SearchPipe } from './search.pipe'; + +@NgModule({ + declarations: [ + KeysPipe, + GetByIdPipe, + HtmlToPlaintextPipe, + SearchPipe + ], + imports : [], + exports : [ + KeysPipe, + GetByIdPipe, + HtmlToPlaintextPipe, + SearchPipe + ] +}) + +export class FusePipesModule +{ + +} diff --git a/src/app/core/pipes/search.pipe.ts b/src/app/core/pipes/search.pipe.ts new file mode 100644 index 00000000..afa0e955 --- /dev/null +++ b/src/app/core/pipes/search.pipe.ts @@ -0,0 +1,49 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'filter' +}) +export class SearchPipe implements PipeTransform +{ + transform(items: any, term: string): any + { + if ( term === undefined ) + { + return items; + } + + return this.filter(items, term); + } + + filter(items: any, term: string) + { + return items.filter(item => { + + for ( const property in item ) + { + if ( !item.hasOwnProperty(property) || !item[property] ) + { + console.log('continueing...'); + continue; + } + + if ( Array.isArray(item[property]) ) + { + console.log('is Array'); + return this.filter(item[property], term); + } + + if ( item[property].toString().toLowerCase().includes(term.toLowerCase()) ) + { + console.log('found!'); + return true; + } + } + + return false; + } + ); + } +} + + diff --git a/src/app/main/apps/mail/mail-details/mail-details.component.html b/src/app/main/apps/mail/mail-details/mail-details.component.html index 10da4bfd..3b7e5a5c 100644 --- a/src/app/main/apps/mail/mail-details/mail-details.component.html +++ b/src/app/main/apps/mail/mail-details/mail-details.component.html @@ -1,3 +1,8 @@ +