Skip to content

Commit

Permalink
Added sample dashboard.
Browse files Browse the repository at this point in the history
  • Loading branch information
umairsiddique committed Jun 11, 2020
1 parent 21e703d commit 53cd55a
Show file tree
Hide file tree
Showing 16 changed files with 260 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { ExampleModule } from './example/example.module';
import { DashboardModule } from './dashboard/dashboard.module';

@NgModule({
declarations: [
Expand All @@ -13,6 +14,7 @@ import { ExampleModule } from './example/example.module';
BrowserModule,
AppRoutingModule,
ExampleModule,
DashboardModule,
],
providers: [],
bootstrap: [AppComponent]
Expand Down
24 changes: 24 additions & 0 deletions src/app/dashboard/dashboard-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { DashboardComponent } from './dashboard.component';
import { DesignListComponent } from './design-list/design-list.component';
import { DesignEditComponent } from './design-edit/design-edit.component';

const routes: Routes = [
{
path: 'dashboard',
component: DashboardComponent,
children: [
{ path: '', component: DesignListComponent },
{ path: 'new', component: DesignEditComponent },
{ path: 'edit/:designId', component: DesignEditComponent }
]
}
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class DashboardRoutingModule { }
Empty file.
1 change: 1 addition & 0 deletions src/app/dashboard/dashboard.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<router-outlet></router-outlet>
25 changes: 25 additions & 0 deletions src/app/dashboard/dashboard.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { DashboardComponent } from './dashboard.component';

describe('DashboardComponent', () => {
let component: DashboardComponent;
let fixture: ComponentFixture<DashboardComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DashboardComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(DashboardComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions src/app/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.css']
})
export class DashboardComponent implements OnInit {

constructor() { }

ngOnInit() {
}

}
19 changes: 19 additions & 0 deletions src/app/dashboard/dashboard.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { DashboardRoutingModule } from './dashboard-routing.module';
import { EmailEditorModule } from 'email-editor';

import { DashboardComponent } from './dashboard.component';
import { DesignListComponent } from './design-list/design-list.component';
import { DesignEditComponent } from './design-edit/design-edit.component';

@NgModule({
declarations: [DashboardComponent, DesignListComponent, DesignEditComponent],
imports: [
CommonModule,
DashboardRoutingModule,
EmailEditorModule
]
})
export class DashboardModule { }
53 changes: 53 additions & 0 deletions src/app/dashboard/design-edit/design-edit.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
:host {
height: 100%;
display: block;
}

.container {
display: flex;
flex-direction: column;
position: relative;
height: 100%;
}

#bar {
flex: 1;
background-color: #dc0027;
color: #fff;
padding: 10px;
display: flex;
max-height: 40px;
}

#bar h1 {
flex: 1;
font-size: 16px;
text-align: left;
}

#bar button {
flex: 1;
padding: 10px;
margin-left: 10px;
font-size: 14px;
font-weight: bold;
background-color: #000;
color: #fff;
border: 0px;
max-width: 150px;
cursor: pointer;
}

#bar a {
flex: 1;
padding: 10px;
margin-left: 10px;
font-size: 14px;
font-weight: bold;
color: #fff;
border: 0px;
cursor: pointer;
text-align: right;
text-decoration: none;
line-height: 160%;
}
15 changes: 15 additions & 0 deletions src/app/dashboard/design-edit/design-edit.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div class="container">
<div id="bar">
<h1>Angular Email Editor (Demo)</h1>
<a routerLink="/dashboard">Dashboard</a>

<button (click)="saveDesign()">Save Design</button>
<button (click)="exportHtml()">Export HTML</button>
</div>

<email-editor
[options]="options"
(loaded)="editorLoaded($event)"
#editor
></email-editor>
</div>
25 changes: 25 additions & 0 deletions src/app/dashboard/design-edit/design-edit.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { DesignEditComponent } from './design-edit.component';

describe('DesignEditComponent', () => {
let component: DesignEditComponent;
let fixture: ComponentFixture<DesignEditComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DesignEditComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(DesignEditComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
37 changes: 37 additions & 0 deletions src/app/dashboard/design-edit/design-edit.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { EmailEditorComponent } from 'email-editor';

@Component({
selector: 'app-design-edit',
templateUrl: './design-edit.component.html',
styleUrls: ['./design-edit.component.css']
})
export class DesignEditComponent implements OnInit {

options = {
};

constructor() { }

ngOnInit() {
}

@ViewChild('editor')
private emailEditor: EmailEditorComponent;

editorLoaded(event) {
}

saveDesign() {
this.emailEditor.saveDesign(
(data) => console.log('saveDesign', data)
);
}

exportHtml() {
this.emailEditor.exportHtml(
(data) => console.log('exportHtml', data)
);
}

}
Empty file.
3 changes: 3 additions & 0 deletions src/app/dashboard/design-list/design-list.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h1>My Designs</h1>

<p><a routerLink="/dashboard/new">New Design</a></p>
25 changes: 25 additions & 0 deletions src/app/dashboard/design-list/design-list.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { DesignListComponent } from './design-list.component';

describe('DesignListComponent', () => {
let component: DesignListComponent;
let fixture: ComponentFixture<DesignListComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DesignListComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(DesignListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions src/app/dashboard/design-list/design-list.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-design-list',
templateUrl: './design-list.component.html',
styleUrls: ['./design-list.component.css']
})
export class DesignListComponent implements OnInit {

constructor() { }

ngOnInit() {
}

}
2 changes: 1 addition & 1 deletion src/app/example/example.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ExampleComponent implements OnInit {
@ViewChild('editor')
private emailEditor: EmailEditorComponent;

editorLoaded() {
editorLoaded(event) {
this.emailEditor.loadDesign(sample);
}

Expand Down

0 comments on commit 53cd55a

Please sign in to comment.