Skip to content

Commit 17ad0a0

Browse files
author
marc101101
committed
Merge remote-tracking branch 'origin/master' into feature/registration_duplicate_email
2 parents c3a993d + 4dddda1 commit 17ad0a0

45 files changed

Lines changed: 454 additions & 163 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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { HomeComponent } from './components/home/home.component';
99
import { CategoriesComponent } from './components/home/categories/categories.component';
1010
import { ProfilComponent } from './components/home/profil/profil.component';
1111
import { SelectivePreloadingStrategy } from './selective-preloading-strategy';
12+
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
1213

1314
const routes: Routes = [
1415
{
@@ -27,6 +28,7 @@ import { SelectivePreloadingStrategy } from './selective-preloading-strategy';
2728
{
2829
path: 'home',
2930
loadChildren: './components/home/home.module#HomeModule',
31+
//canActivate: [AuthGuard],
3032
data: {prelaod: true}
3133
},
3234
{
@@ -39,6 +41,6 @@ import { SelectivePreloadingStrategy } from './selective-preloading-strategy';
3941
@NgModule({
4042
imports: [RouterModule.forRoot(routes, { preloadingStrategy: SelectivePreloadingStrategy })],
4143
exports: [RouterModule],
42-
providers: [SelectivePreloadingStrategy]
44+
providers: [SelectivePreloadingStrategy, { provide: LocationStrategy, useClass: HashLocationStrategy}]
4345
})
4446
export class AppRoutingModule { }

client/app/app.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ $input-height: 2.75rem;
4040
width: 380px;
4141
height: 607px;
4242
position: absolute;
43+
overflow:hidden
4344
}

client/app/app.module.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import {BrowserModule} from '@angular/platform-browser';
21
import {NgModule} from '@angular/core';
32
import {HttpClientModule} from '@angular/common/http';
43
import {AppComponent} from './app.component';
54
import {ReactiveFormsModule} from "@angular/forms";
6-
import {environment} from '../environments/environment.dev';
75
import {ServiceWorkerModule} from '@angular/service-worker';
86
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
97
import { AppRoutingModule } from "./app-routing.module";
@@ -15,38 +13,34 @@ import { PageNotFoundComponent } from './components/not-found';
1513
import { FormsModule } from '@angular/forms';
1614
import { AlertService } from './services/alert.service';
1715
import { RouterModule } from '@angular/router';
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';
16+
import { SharedModule } from './sharedModule/shared.module';
17+
import { CategoryService } from './services/category.service';
2218

2319
@NgModule({
2420
declarations: [
2521
AppComponent,
2622
LoginComponent,
2723
RegistrationComponent,
28-
PageNotFoundComponent,
29-
AlertComponent
24+
PageNotFoundComponent
3025
],
3126
imports: [
3227
HttpClientModule,
3328
BrowserAnimationsModule,
3429
AppRoutingModule,
3530
ReactiveFormsModule,
3631
FormsModule,
37-
RouterModule
32+
RouterModule,
33+
SharedModule
3834
//ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production })
3935
],
4036
providers: [
4137
AuthGuard,
4238
AuthService,
4339
AlertService,
40+
CategoryService,
4441
RouterModule,
4542
HttpClientModule
4643
],
47-
exports: [AlertComponent],
4844
bootstrap: [AppComponent]
4945
})
50-
export class AppModule {
51-
52-
}
46+
export class AppModule {}
Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1-
<div class="tile is-primary">
2-
<p class="title">Categories</p>
1+
<div class="container fullScreenBackground">
2+
<div class="circleBackground"></div>
3+
<div class="columns is-mobile">
4+
<div class="column is-12" style="z-index: 0; padding: 2rem; padding-left: 5rem;">
5+
<div style="font-size: 1.5rem; color:white;">
6+
Kurs Kategorien
7+
</div>
8+
</div>
9+
</div>
10+
11+
<div class="column" style="margin-top: -2rem;padding: 1.0rem;">
12+
<alert></alert>
13+
</div>
14+
15+
<section style="padding: 1rem;" *ngIf="dataIsAvailable">
16+
<div class="card" *ngFor="let category of categories; let i=index" (click)="routeToCourse(category.RUB_ID, colorArray[i])">
17+
<div class="color-marker" [ngClass]="colorArray[i]">
18+
</div>
19+
<div class="card-content">
20+
<p class="title">
21+
{{category.RUB_NAME}}
22+
</p>
23+
<p class="subtitle">
24+
{{category.RUB_TEXT}}
25+
</p>
26+
</div>
27+
</div>
28+
</section>
29+
330
</div>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
.circleBackground {
2+
height: 30rem;
3+
width: 30rem;
4+
z-index: 0;
5+
background-color: #209cee;
6+
border-radius: 15rem;
7+
position: absolute;
8+
margin-top: -13rem;
9+
margin-left: -7rem;
10+
}
11+
12+
.fullScreenBackground {
13+
position: absolute;
14+
height: 100%;
15+
width: 100%;
16+
overflow: hidden;
17+
box-shadow: 0px 0px 13px #6E6E6E;
18+
}
19+
20+
.card {
21+
margin-top: 1rem;
22+
border-radius: 0.5rem;
23+
}
24+
25+
.title {
26+
font-size: 1.25rem !important;
27+
padding-left: 1rem;
28+
}
29+
30+
.subtitle {
31+
font-size: 0.9rem;
32+
padding-left: 1rem;
33+
}
34+
35+
.color-marker {
36+
float: right;
37+
height: 100%;
38+
position: absolute;
39+
width: 10px;
40+
border-top-left-radius: 0.8rem;
41+
border-bottom-left-radius: 0.8rem;
42+
}
43+
44+
.primary{
45+
background-color: #00d1b2;
46+
}
47+
48+
.link{
49+
background-color: #3273dc;
50+
}
51+
52+
.info{
53+
background-color: #23d160;
54+
}
55+
56+
.success{
57+
background-color: #ffdd57;
58+
}
59+
60+
.warning{
61+
background-color: #ffbc6b;
62+
}
63+
64+
.danger{
65+
background-color: #ff3860;
66+
}
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
11
import { Component, OnInit } from '@angular/core';
2+
import { CategoryService } from '../../../services/category.service';
3+
import { Router } from '@angular/router';
4+
import { CommunicationService } from '../shared/communication.service';
25

36
@Component({
47
selector: 'categories',
58
templateUrl: './categories.component.html',
69
styleUrls: ['./categories.component.scss']
710
})
811
export class CategoriesComponent implements OnInit {
12+
public dataIsAvailable: boolean = false;
13+
public categories: Array<any>;
14+
public colorArray: Array<any> = ["primary", "link", "danger", "success", "warning", "info"];
915

10-
constructor() { }
16+
constructor(public categoryService: CategoryService, private router: Router, public comService: CommunicationService) { }
1117

1218
ngOnInit() {
19+
this.categoryService.getAllCategories().subscribe(response =>{
20+
if(response.name != "HttpResponseError"){
21+
this.dataIsAvailable = true;
22+
this.categories = response;
23+
}
24+
});
25+
}
26+
27+
routeToCourse(categoryId: number, color: string) {
28+
this.router.navigateByUrl('home/kurs-uebersicht/' + categoryId);
29+
this.comService.setColor(color);
1330
}
1431

1532
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<div class="container fullScreenBackground">
2+
<div class="circleBackground" #backgroundElement></div>
3+
<div class="columns is-mobile">
4+
<div class="column is-12" style="z-index: 0; padding: 2rem; padding-left: 5rem;">
5+
<div style="font-size: 1.5rem; color:white;">
6+
Kurs Kategorien
7+
</div>
8+
</div>
9+
</div>
10+
11+
<div class="column" style="margin-top: -2rem;padding: 1.0rem;">
12+
<alert></alert>
13+
</div>
14+
15+
<section style="padding: 1rem;" *ngIf="dataIsAvailable">
16+
<div class="card" *ngFor="let course of courses; let i=index">
17+
<div class="color-marker">
18+
</div>
19+
<div class="card-content">
20+
<p class="title">
21+
{{course.KURS_NAME}}
22+
</p>
23+
<p class="subtitle">
24+
{{course.KURS_BESCHREIBUNG}}
25+
</p>
26+
</div>
27+
</div>
28+
</section>
29+
30+
</div>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
.circleBackground {
2+
height: 30rem;
3+
width: 30rem;
4+
z-index: 0;
5+
background-color: #209cee;
6+
border-radius: 15rem;
7+
position: absolute;
8+
margin-top: -13rem;
9+
margin-left: -7rem;
10+
}
11+
12+
.fullScreenBackground {
13+
position: absolute;
14+
height: 100%;
15+
width: 100%;
16+
overflow: hidden;
17+
box-shadow: 0px 0px 13px #6E6E6E;
18+
}
19+
20+
.card {
21+
margin-top: 1rem;
22+
border-radius: 0.5rem;
23+
}
24+
25+
.title {
26+
font-size: 1.25rem !important;
27+
padding-left: 1rem;
28+
}
29+
30+
.subtitle {
31+
font-size: 0.9rem;
32+
padding-left: 1rem;
33+
}
34+
35+
.color-marker {
36+
float: right;
37+
height: 100%;
38+
position: absolute;
39+
width: 10px;
40+
border-top-left-radius: 0.8rem;
41+
border-bottom-left-radius: 0.8rem;
42+
}
43+
44+
.primary{
45+
background-color: #00d1b2;
46+
}
47+
48+
.link{
49+
background-color: #3273dc;
50+
}
51+
52+
.info{
53+
background-color: #23d160;
54+
}
55+
56+
.success{
57+
background-color: #ffdd57;
58+
}
59+
60+
.warning{
61+
background-color: #ffbc6b;
62+
}
63+
64+
.danger{
65+
background-color: #ff3860;
66+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { Component, OnInit, Renderer2, ViewChild, ElementRef } from '@angular/core';
2+
import { CategoryService } from '../../../services/category.service';
3+
import { ActivatedRoute, Params } from '@angular/router';
4+
import { CommunicationService } from '../shared/communication.service';
5+
import { log } from 'util';
6+
7+
@Component({
8+
selector: 'courses',
9+
templateUrl: './courses.component.html',
10+
styleUrls: ['./courses.component.scss']
11+
})
12+
export class CoursesComponent implements OnInit {
13+
14+
@ViewChild('backgroundElement') backgroundElement: ElementRef;
15+
16+
public dataIsAvailable: boolean = false;
17+
public courses: Array<any>;
18+
19+
constructor(public categoryService: CategoryService,
20+
private activatedRoute: ActivatedRoute,
21+
public comService: CommunicationService,
22+
public renderer: Renderer2) {
23+
let localThis = this;
24+
this.comService.getColor().subscribe(color => {
25+
console.log(color);
26+
this.renderer.addClass(this.backgroundElement.nativeElement, color);
27+
});
28+
}
29+
30+
ngOnInit() {
31+
this.activatedRoute.params.subscribe((params: Params) => {
32+
this.categoryService.getCoursesByCategoryId(params.courseId).subscribe(response =>{
33+
this.courses = response;
34+
if(response.name != "HttpResponseError"){
35+
this.dataIsAvailable = true;
36+
this.courses = response;
37+
}
38+
});
39+
});
40+
}
41+
42+
}

client/app/components/home/home-routing.module.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { AuthGuard } from '../../guards/auth.guard';
44
import { HomeComponent } from './home.component';
55
import { CategoriesComponent } from './categories/categories.component';
66
import { ProfilComponent } from './profil/profil.component';
7+
import { CoursesComponent } from './courses/courses.component';
78

89
const routes: Routes = [
910
{
@@ -24,8 +25,8 @@ const routes: Routes = [
2425
component: CategoriesComponent
2526
},
2627
{
27-
path: 'kurs-uebersicht',
28-
component: CategoriesComponent
28+
path: 'kurs-uebersicht/:courseId',
29+
component: CoursesComponent
2930
},
3031
{
3132
path: 'kontakt',
@@ -42,5 +43,6 @@ const routes: Routes = [
4243
@NgModule({
4344
imports: [RouterModule.forChild(routes)],
4445
exports: [RouterModule]
46+
4547
})
4648
export class HomeRoutingModule { }

0 commit comments

Comments
 (0)