SKE-2 display competition page

This commit is contained in:
Przemysław Stawujak 2018-12-12 02:08:56 +01:00
parent a09c5b8d0e
commit b382d3fe3b
7 changed files with 41 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import { TenantsComponent } from './tenants/tenants.component';
import { RolesComponent } from 'app/roles/roles.component';
import { CategoriesListComponent } from '@app/categories-list/categories-list.component';
import { CompetitionsListComponent } from '@app/competitions-list/competitions-list.component';
import { CompetitionDetailComponent } from '@app/competition-detail/competition-detail.component';
@NgModule({
imports: [
@ -24,6 +25,7 @@ import { CompetitionsListComponent } from '@app/competitions-list/competitions-l
{ path: 'about', component: AboutComponent },
{ path: 'categories-list', component: CategoriesListComponent, canActivate: [AppRouteGuard] },
{ path: 'categories-list/:id', component: CompetitionsListComponent, canActivate: [AppRouteGuard] }
{ path: 'categories-list/:id/:competitionId', component: CompetitionDetailComponent, canActivate: [AppRouteGuard] }
]
}
])

View File

@ -34,6 +34,8 @@ import { SideBarFooterComponent } from '@app/layout/sidebar-footer.component';
import { RightSideBarComponent } from '@app/layout/right-sidebar.component';
import { CategoriesListComponent } from '@app/categories-list/categories-list.component';
import { CompetitionsListComponent } from '@app/competitions-list/competitions-list.component';
import { CompetitionDetailComponent } from '@app/competition-detail/competition-detail.component';
import { FilterClassesPipe } from '@app/pipe/filter-classes.pipe';
@NgModule({
@ -58,6 +60,7 @@ import { FilterClassesPipe } from '@app/pipe/filter-classes.pipe';
RightSideBarComponent,
CategoriesListComponent,
CompetitionsListComponent,
CompetitionDetailComponent,
FilterClassesPipe
],

View File

@ -0,0 +1 @@
<p>Szczegóły konkursu</p>

View File

@ -0,0 +1,26 @@
import { Component, OnInit, Injector, OnDestroy } from '@angular/core';
import { appModuleAnimation } from '@shared/animations/routerTransition';
import { AppComponentBase } from '@shared/app-component-base';
@Component({
templateUrl: './competition-detail.component.html',
styleUrls: ['./competition-detail.component.css'],
animations: [appModuleAnimation()]
})
export class CompetitionDetailComponent extends AppComponentBase implements OnInit, OnDestroy {
constructor(
injector: Injector,
) {
super(injector);
}
public ngOnInit() {
}
public ngOnDestroy() {
}
}

View File

@ -1,5 +1,5 @@
<div class="flex-container" id="competitions-list-area">
<div class="flex-item" *ngFor="let competition of (competitionsList | filterClasses : [2, 6])">
<div class="flex-item" (click)="goToDetail(competition)" *ngFor="let competition of (competitionsList | filterClasses : [2, 6])">
{{ competition.name }}
</div>
</div>

View File

@ -7,6 +7,7 @@ import { Subscription } from 'rxjs/Rx';
import { finalize } from 'rxjs/operators';
import { ActivatedRoute } from '@angular/router';
import { mergeMap } from 'rxjs/operators';
import { Router } from '@angular/router';
@Component({
templateUrl: './competitions-list.component.html',
@ -26,6 +27,7 @@ export class CompetitionsListComponent extends AppComponentBase implements OnIni
injector: Injector,
private _competitionCategoryService: CompetitionCategoryServiceProxy,
private route: ActivatedRoute,
private router: Router
) {
super(injector);
}
@ -55,4 +57,10 @@ export class CompetitionsListComponent extends AppComponentBase implements OnIni
});
}
public goToDetail(competition: CompetitionDto): void {
console.log(this.router.url);
const route: string = this.router.url + `/${competition.id}`;
this.router.navigate([route]);
}
}