Skip to content

Commit a71ec20

Browse files
committed
Add versions and release-notes components.
1 parent 5ad7368 commit a71ec20

19 files changed

Lines changed: 210 additions & 2 deletions

src/app/root/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {TopNavComponent} from "./top-nav/top-nav.component";
22
import {FooterComponent} from "./footer/footer.component";
33

4+
45
export const COMPONENTS: any[] = [
56
TopNavComponent,
67
FooterComponent

src/app/root/root-routing.module.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import {NgModule} from "@angular/core";
22
import {RouterModule, Routes} from "@angular/router";
33

4+
import * as fromShared from "../shared";
5+
46
import * as fromContainers from "./containers";
57

68
const routes: Routes = [
@@ -23,6 +25,21 @@ const routes: Routes = [
2325
loadChildren: () => import("../version1.0.0").then(m => m.Version100Module)
2426
}
2527
]
28+
},
29+
{
30+
path: "versions",
31+
component: fromContainers.LayoutComponent,
32+
children: [
33+
{
34+
path: "",
35+
component: fromShared.VersionsComponent
36+
},
37+
{
38+
path: "**",
39+
pathMatch: "full",
40+
redirectTo: ""
41+
},
42+
]
2643
}
2744
];
2845

src/app/root/root.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {BrowserModule} from "@angular/platform-browser";
22
import {NgModule} from "@angular/core";
33
import {HttpClientModule} from "@angular/common/http";
44

5+
import {SharedModule} from "../shared";
56
import {RootRoutingModule} from "./root-routing.module";
67

78
import * as fromContainers from "./containers";
@@ -17,6 +18,7 @@ import * as fromServices from "./services";
1718
BrowserModule,
1819
RootRoutingModule,
1920
HttpClientModule,
21+
SharedModule.forRoot()
2022
],
2123
providers: [
2224
...fromServices.SERVICES

src/app/shared/components/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@ import {PostSectionNavigatorComponent} from "./post-section-navigator/post-secti
33
import {PostArticleComponent} from "./post-article/post-article.component";
44
import {PostNavigatorComponent} from "./post-navigator/post-navigator.component";
55
import {SideNavigatorItemComponent} from "./side-navigator-item/side-navigator-item.component";
6+
import {VersionsComponent} from "./versions/versions.component";
7+
8+
export * from "./versions/versions.component";
9+
610

711
export const COMPONENTS: any[] = [
812
PostHeaderComponent,
913
PostSectionNavigatorComponent,
1014
PostArticleComponent,
1115
PostNavigatorComponent,
12-
SideNavigatorItemComponent
16+
SideNavigatorItemComponent,
17+
VersionsComponent
1318
];
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<div class="post-wrapper">
2+
3+
<div class="post">
4+
<!-- Article -->
5+
<app-post-article [title]="'DotNet Validator Versions'">
6+
7+
<ng-container class="article">
8+
9+
<!-- Pass article content to article component -->
10+
<div>
11+
<h2 class="section-heading">
12+
Latest Version
13+
</h2>
14+
<table class="table table-bordered">
15+
<tbody>
16+
<tr>
17+
<th scope="row">{{latestVersion.id}}</th>
18+
<td>
19+
<a [routerLink]="['/docs/' + latestVersion.version]">
20+
Documentation
21+
</a>
22+
</td>
23+
<td>
24+
<a [routerLink]="['/docs/' + latestVersion.version + '/release-notes']">
25+
Release Notes
26+
</a>
27+
</td>
28+
</tr>
29+
</tbody>
30+
</table>
31+
32+
</div>
33+
34+
<div>
35+
<h2 class="section-heading">
36+
Past Versions
37+
</h2>
38+
<table class="table table-bordered">
39+
<tbody>
40+
<tr *ngFor="let version of versions">
41+
<th scope="row">{{version.id}}</th>
42+
<td>
43+
<a [routerLink]="['/docs/' + version.version]">
44+
Documentation
45+
</a>
46+
</td>
47+
<td>
48+
<a [routerLink]="['/docs/' + version.version + '/release-notes']">
49+
Release Notes
50+
</a>
51+
</td>
52+
</tr>
53+
</tbody>
54+
</table>
55+
56+
</div>
57+
58+
</ng-container>
59+
60+
</app-post-article>
61+
<!-- End Article -->
62+
</div>
63+
64+
</div>
65+
<!-- Post Wrapper -->

src/app/shared/components/versions/versions.component.sass

Whitespace-only changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {Component, OnInit} from "@angular/core";
2+
import {DocService} from "../../services";
3+
import {IVersion} from "../../models";
4+
5+
@Component({
6+
selector: "app-versions",
7+
templateUrl: "./versions.component.html",
8+
styleUrls: ["./versions.component.sass"]
9+
})
10+
export class VersionsComponent implements OnInit {
11+
12+
latestVersion: IVersion;
13+
versions: IVersion[];
14+
15+
ngOnInit() {
16+
this.latestVersion = DocService.getLatestVersion();
17+
this.versions = DocService.getPastVersions();
18+
}
19+
20+
}

src/app/shared/data/versions.data.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,11 @@ export const Versions: IVersion[] = [
11651165
{
11661166
title: "Development",
11671167
posts: [
1168+
{
1169+
id: "release-notes",
1170+
title: "Release Notes",
1171+
route: resolveRoute(VERSIONS["1.0.0"], "release-notes"),
1172+
},
11681173
{
11691174
id: "why-dotnet-validator",
11701175
title: "Why DotNet Validator?",

src/app/shared/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from "./shared.module";
22
export * from "./models";
33
export * from "./services";
4+
export * from "./components";

src/app/shared/services/documentation.service.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ export class DocService {
4848
return Versions[Versions.length - 1];
4949
}
5050

51+
52+
/**
53+
* Gets all versions except the latest version.
54+
*/
55+
public static getPastVersions(): IVersion[] {
56+
return Versions.filter(version => version.id !== this.getLatestVersion().id);
57+
}
58+
5159
/**
5260
* Gets all posts in the specified documentation version.
5361
* @param versionId The unique identifier for the documentation version.

0 commit comments

Comments
 (0)