Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
update from home
- Loading branch information
Chris Rollings
committed
Mar 21, 2019
1 parent
283e7ed
commit ffecdcc4331b6532102090acacd5a41621b285ca
Showing
179 changed files
with
16,520 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<p> | ||
admin-dashboard works! | ||
</p> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { AdminDashboardComponent } from './admin-dashboard.component'; | ||
|
||
describe('AdminDashboardComponent', () => { | ||
let component: AdminDashboardComponent; | ||
let fixture: ComponentFixture<AdminDashboardComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ AdminDashboardComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(AdminDashboardComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-admin-dashboard', | ||
templateUrl: './admin-dashboard.component.html', | ||
styleUrls: ['./admin-dashboard.component.scss'] | ||
}) | ||
export class AdminDashboardComponent implements OnInit { | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { Routes, RouterModule } from '@angular/router'; | ||
import { AdminComponent } from './admin/admin.component'; | ||
import { ManageEventsComponent } from './manage-events/manage-events.component'; | ||
import { AdminDashboardComponent } from './admin-dashboard/admin-dashboard.component'; | ||
import { AuthGuard } from '../auth/auth.guard'; | ||
|
||
const adminRoutes: Routes = [ | ||
{ | ||
path: 'admin', | ||
component: AdminComponent, | ||
canActivate: [AuthGuard], | ||
children: [ | ||
{ | ||
path: '', | ||
|
||
children: [ | ||
{ path: 'events', component: ManageEventsComponent }, | ||
{ path: '', component: AdminDashboardComponent } | ||
] | ||
} | ||
] | ||
} | ||
]; | ||
@NgModule({ | ||
imports: [RouterModule.forChild(adminRoutes)], | ||
exports: [RouterModule] | ||
}) | ||
export class AdminRoutingModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
|
||
import { AdminRoutingModule } from './admin-routing.module'; | ||
import { AdminDashboardComponent } from './admin-dashboard/admin-dashboard.component'; | ||
import { AdminComponent } from './admin/admin.component'; | ||
import { ManageEventsComponent } from './manage-events/manage-events.component'; | ||
|
||
@NgModule({ | ||
declarations: [AdminDashboardComponent, AdminComponent, ManageEventsComponent], | ||
imports: [ | ||
CommonModule, | ||
AdminRoutingModule | ||
] | ||
}) | ||
export class AdminModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<h3>ADMIN</h3> | ||
<nav> | ||
<a routerLink="./" routerLinkActive="active" | ||
[routerLinkActiveOptions]="{ exact: true }">Dashboard</a> | ||
<a routerLink="./events" routerLinkActive="active">Manage Events</a> | ||
</nav> | ||
<router-outlet></router-outlet> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { AdminComponent } from './admin.component'; | ||
|
||
describe('AdminComponent', () => { | ||
let component: AdminComponent; | ||
let fixture: ComponentFixture<AdminComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ AdminComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(AdminComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-admin', | ||
templateUrl: './admin.component.html', | ||
styleUrls: ['./admin.component.scss'] | ||
}) | ||
export class AdminComponent implements OnInit { | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<p> | ||
manage-events works! | ||
</p> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ManageEventsComponent } from './manage-events.component'; | ||
|
||
describe('ManageEventsComponent', () => { | ||
let component: ManageEventsComponent; | ||
let fixture: ComponentFixture<ManageEventsComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ ManageEventsComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ManageEventsComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-manage-events', | ||
templateUrl: './manage-events.component.html', | ||
styleUrls: ['./manage-events.component.scss'] | ||
}) | ||
export class ManageEventsComponent implements OnInit { | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule, Routes } from '@angular/router'; | ||
import { HomeComponent } from './home/home.component'; | ||
import { LoginComponent } from './auth/login/login.component'; | ||
import { SignupComponent } from './auth/signup/signup.component'; | ||
|
||
import { RegisterComponent } from './register/register.component'; | ||
import { EventComponent } from './event/component/event.component'; | ||
import { AccountComponent } from './account/component/account.component'; | ||
|
||
const routes: Routes = [ | ||
{ path: '', component: HomeComponent }, | ||
{ path: 'register', component: RegisterComponent }, | ||
{ path: 'event/:eventId', component: EventComponent }, | ||
{ path: 'login', component: LoginComponent }, | ||
{ path: 'signup', component: SignupComponent }, | ||
{ path: 'account', component: AccountComponent }, | ||
|
||
]; | ||
@NgModule({ | ||
imports: [RouterModule.forRoot(routes)], | ||
exports: [RouterModule] | ||
}) | ||
export class AppRoutingModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { TestBed, async, inject } from '@angular/core/testing'; | ||
|
||
import { AuthGuard } from './auth.guard'; | ||
|
||
describe('AuthGuard', () => { | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
providers: [AuthGuard] | ||
}); | ||
}); | ||
|
||
it('should ...', inject([AuthGuard], (guard: AuthGuard) => { | ||
expect(guard).toBeTruthy(); | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router'; | ||
import { Observable } from 'rxjs'; | ||
import { AuthService } from './auth.service'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class AuthGuard implements CanActivate { | ||
constructor(private authService:AuthService, private router:Router){ | ||
console.log("Auth guard") | ||
} | ||
canActivate( | ||
next: ActivatedRouteSnapshot, | ||
state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean { | ||
let url: string = state.url; | ||
console.log("AuthGuardCanactivate : " + this.authService.isAuthenticated) | ||
|
||
return this.checkLogin(url); | ||
} | ||
|
||
checkLogin(url: string): boolean { | ||
console.log("AuthGuardCanactivate : " + this.authService.isAuthenticated) | ||
if (this.authService.isAuthenticated) { return true; } | ||
|
||
// Store the attempted URL for redirecting | ||
this.authService.redirectUrl = url; | ||
|
||
// Navigate to the login page with extras | ||
this.router.navigate(['/login']); | ||
return false; | ||
} | ||
} |
Oops, something went wrong.