Skip to content

Commit df28641

Browse files
authored
Merge pull request #109 from marc101101/feature/create-menue
Feature/create menue
2 parents 0884f5f + c15dc03 commit df28641

55 files changed

Lines changed: 6015 additions & 126 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

client/app/app-routing.module.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import { Routes, RouterModule } from '@angular/router';
33
import { AppComponent } from './app.component';
44
import { LoginComponent } from './components/login/login.component';
55
import { RegistrationComponent } from './components/registration/registration.component';
6-
import { CategoriesComponent } from './components/categories/categories.component';
76
import { AuthGuard } from './guards/auth.guard';
87
import { PageNotFoundComponent } from './components/not-found';
9-
import { ProfilComponent } from './components/profil/profil.component';
8+
import { HomeComponent } from './components/home/home.component';
9+
import { CategoriesComponent } from './components/home/categories/categories.component';
10+
import { ProfilComponent } from './components/home/profil/profil.component';
11+
import { SelectivePreloadingStrategy } from './selective-preloading-strategy';
1012

1113
const routes: Routes = [
1214
{
@@ -23,13 +25,9 @@ import { ProfilComponent } from './components/profil/profil.component';
2325
component: RegistrationComponent
2426
},
2527
{
26-
path: 'categories',
27-
component: CategoriesComponent
28-
},
29-
{
30-
path: 'profil',
31-
component: ProfilComponent,
32-
canActivate: [AuthGuard]
28+
path: 'home',
29+
loadChildren: './components/home/home.module#HomeModule',
30+
data: {prelaod: true}
3331
},
3432
{
3533
path: '**',
@@ -39,7 +37,8 @@ import { ProfilComponent } from './components/profil/profil.component';
3937

4038

4139
@NgModule({
42-
imports: [RouterModule.forRoot(routes)],
43-
exports: [RouterModule]
40+
imports: [RouterModule.forRoot(routes, { preloadingStrategy: SelectivePreloadingStrategy })],
41+
exports: [RouterModule],
42+
providers: [SelectivePreloadingStrategy]
4443
})
4544
export class AppRoutingModule { }

client/app/app.module.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,22 @@ import { LoginComponent } from './components/login/login.component';
1111
import { RegistrationComponent } from './components/registration/registration.component';
1212
import { AuthGuard } from './guards/auth.guard';
1313
import { AuthService } from './services/auth.service';
14-
import { CategoriesComponent } from './components/categories/categories.component';
1514
import { PageNotFoundComponent } from './components/not-found';
1615
import { FormsModule } from '@angular/forms';
1716
import { AlertService } from './services/alert.service';
18-
import { AlertComponent } from './directives';
1917
import { RouterModule } from '@angular/router';
20-
import { ProfilComponent } from './components/profil/profil.component';
18+
import { CategoriesComponent } from './components/home/categories/categories.component';
19+
import { ProfilComponent } from './components/home/profil/profil.component';
20+
import { HomeComponent } from './components/home/home.component';
21+
import { AlertComponent } from './directives/alert/alert.component';
2122

2223
@NgModule({
2324
declarations: [
2425
AppComponent,
2526
LoginComponent,
2627
RegistrationComponent,
27-
CategoriesComponent,
2828
PageNotFoundComponent,
29-
AlertComponent,
30-
ProfilComponent
29+
AlertComponent
3130
],
3231
imports: [
3332
HttpClientModule,

client/app/components/categories/categories.component.html renamed to client/app/components/home/categories/categories.component.html

File renamed without changes.

client/app/components/categories/categories.component.scss renamed to client/app/components/home/categories/categories.component.scss

File renamed without changes.

client/app/components/categories/categories.component.ts renamed to client/app/components/home/categories/categories.component.ts

File renamed without changes.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { NgModule } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
3+
import { AuthGuard } from '../../guards/auth.guard';
4+
import { HomeComponent } from './home.component';
5+
import { CategoriesComponent } from './categories/categories.component';
6+
import { ProfilComponent } from './profil/profil.component';
7+
8+
const routes: Routes = [
9+
{
10+
path: '',
11+
component: HomeComponent,
12+
//canActivate: [AuthGuard],
13+
children: [
14+
{
15+
path: 'kategorien',
16+
component: CategoriesComponent
17+
},
18+
{
19+
path: 'meine-kurse',
20+
component: CategoriesComponent
21+
},
22+
{
23+
path: 'aktuelles',
24+
component: CategoriesComponent
25+
},
26+
{
27+
path: 'kurs-uebersicht',
28+
component: CategoriesComponent
29+
},
30+
{
31+
path: 'kontakt',
32+
component: CategoriesComponent
33+
},
34+
{
35+
path: 'profil',
36+
component: ProfilComponent
37+
}
38+
]
39+
}
40+
];
41+
42+
@NgModule({
43+
imports: [RouterModule.forChild(routes)],
44+
exports: [RouterModule]
45+
})
46+
export class HomeRoutingModule { }
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<div class="burgerElement" (click)="setMenu()">
2+
<i class="fa fa-bars" aria-hidden="true"></i>
3+
</div>
4+
5+
<menu *ngIf="menuOpen" class="menuPosition"></menu>
6+
7+
<div *ngIf="menuOpen" class="contentPosition" (click)="setMenu()">
8+
<router-outlet></router-outlet>
9+
</div>
10+
11+
<div *ngIf="!menuOpen">
12+
<router-outlet></router-outlet>
13+
</div>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.burgerElement{
2+
color: white;
3+
font-size: 1.5rem;
4+
padding: 1.25rem;
5+
padding-bottom: 0rem;
6+
position: absolute;
7+
z-index: 1;
8+
}
9+
10+
.navbar {
11+
float: left;
12+
}
13+
14+
.menuPosition {
15+
height: 100%;
16+
background-color: white;
17+
position: absolute;
18+
z-index: 1;
19+
margin-top: -2.5rem;
20+
width: 65%;
21+
overflow: hidden;
22+
border-top-right-radius: 1rem;
23+
}
24+
25+
.contentPosition {
26+
margin-left: 19rem;
27+
margin-top: 3rem;
28+
}
29+
30+
/*
31+
background-color: white;
32+
border: 1px solid;
33+
width: 75%;
34+
margin-top: -3.5rem;
35+
*/
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import {
2+
Component,
3+
OnInit,
4+
AfterViewInit
5+
} from '@angular/core';
6+
import { CommunicationService } from './shared/communication.service';
7+
8+
@Component({
9+
selector: 'home',
10+
templateUrl: './home.component.html',
11+
styleUrls: ['./home.component.scss']
12+
})
13+
export class HomeComponent implements OnInit, AfterViewInit {
14+
15+
public menuOpen: boolean = false;
16+
17+
constructor(public comService: CommunicationService) {
18+
19+
}
20+
21+
ngOnInit() {
22+
this.comService.instruction_sub_comb.subscribe(message =>{
23+
this.menuOpen = message;
24+
});
25+
}
26+
27+
ngAfterViewInit() {
28+
29+
}
30+
31+
setMenu() {
32+
33+
this.menuOpen = !this.menuOpen;
34+
}
35+
36+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { NgModule } from '@angular/core';
2+
import { CommonModule } from '@angular/common';
3+
import { FormsModule } from '@angular/forms';
4+
5+
import { CategoriesComponent } from './categories/categories.component';
6+
import { ProfilComponent } from './profil/profil.component';
7+
import { HomeRoutingModule } from './home-routing.module';
8+
import { AlertService } from '../../services/alert.service';
9+
import { AuthService } from '../../services/auth.service';
10+
import { UserService } from '../../services/user.service';
11+
import { AlertComponent } from './shared/alert/alert.component';
12+
import { HomeComponent } from './home.component';
13+
import { MenuComponent } from './shared/menu/menu.component';
14+
import { CommunicationService } from './shared/communication.service';
15+
16+
@NgModule({
17+
imports: [
18+
CommonModule,
19+
FormsModule,
20+
HomeRoutingModule,
21+
],
22+
declarations: [
23+
CategoriesComponent,
24+
ProfilComponent,
25+
MenuComponent,
26+
HomeComponent,
27+
AlertComponent
28+
],
29+
providers: [
30+
AlertService,
31+
AuthService,
32+
UserService,
33+
CommunicationService
34+
],
35+
exports: [MenuComponent],
36+
})
37+
export class HomeModule { }

0 commit comments

Comments
 (0)