Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add barebones start page #19

Merged
merged 4 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Dfsseta.ApplyForLanding/Pages/BasePageModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace Dfsseta.ApplyForLanding.Pages;

public abstract class BasePageModel(string heading) : PageModel
{
public string Heading { get; init; } = heading;
}
67 changes: 61 additions & 6 deletions src/Dfsseta.ApplyForLanding/Pages/Index.cshtml
Original file line number Diff line number Diff line change
@@ -1,10 +1,65 @@
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}

<div class="text-center">
<h1 class="display-4">Welcome to @Model.ServiceName</h1>
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<section class="container">
<div class="row">
<p class="govuk-body-l">
You can use this service to apply to land on one of several planets and astronomical bodies.
</p>
<article class="col">
<h2 class="govuk-heading-l">Available destinations</h2>
<p class="govuk-body">
You can use this service to obtain a landing permit for:
</p>
<ul class="govuk-list govuk-list--bullet">
@foreach (var landableBody in Model.LandableBodies)
{
<li>@landableBody</li>
}
</ul>
</article>

</div></section>

<hr class="govuk-section-break govuk-section-break--xl govuk-section-break--visible">

<section class="container requirements">
<div class="row">
<article class="col">
<h2 class="govuk-heading-l">What you will need ready</h2>
<p class="govuk-body">
To apply for a landing permit you must provide your:
</p>
<ul class="govuk-list govuk-list--bullet">
<li>name</li>
<li>email address</li>
<li>date of birth</li>
<li>passport number</li>
<li>pilot's licence number</li>
<li>vehicle registration number</li>
</ul>
<p class="govuk-body">You will also need to tell us the dates of your proposed visit as not all dates are available on all destinations, due to local public holidays.</p>
</article>

</div></section>

<hr class="govuk-section-break govuk-section-break--xl govuk-section-break--visible">

<section class="container">
<div class="row">
<article class="col">

<a role="button" draggable="false" class="govuk-button govuk-button--start" data-module="govuk-button">
Start now
<svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" aria-hidden="true" focusable="false">
<path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z"></path>
</svg>
</a>
</article>

</div>
</section>
</div>
</div>
20 changes: 12 additions & 8 deletions src/Dfsseta.ApplyForLanding/Pages/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@

namespace Dfsseta.ApplyForLanding.Pages;

public class IndexModel : PageModel
public class IndexModel(ILogger<IndexModel> logger) : BasePageModel("Apply for landing")
{
private readonly ILogger<IndexModel> _logger;
public string ServiceName => "Apply for landing";
private readonly ILogger<IndexModel> _logger = logger;

public IndexModel(ILogger<IndexModel> logger)
{
_logger = logger;
}
public string[] LandableBodies { get; set; } = [];

public void OnGet()
{

LandableBodies =
[
"Mars",
"Saturn (core)",
"International Space Station (ESA)",
"Tiangong space station",
"Earth's moon",
"Pluto"
];
}
}
8 changes: 0 additions & 8 deletions src/Dfsseta.ApplyForLanding/Pages/Privacy.cshtml

This file was deleted.

18 changes: 0 additions & 18 deletions src/Dfsseta.ApplyForLanding/Pages/Privacy.cshtml.cs

This file was deleted.

49 changes: 13 additions & 36 deletions src/Dfsseta.ApplyForLanding/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
@@ -1,51 +1,28 @@
<!DOCTYPE html>
@model BasePageModel

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>@ViewData["Title"] - Dfsseta.ApplyForLanding</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css"/>
<title>@Model.Heading - Dfsseta.ApplyForLanding</title>
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true"/>
<link rel="stylesheet" href="~/Dfsseta.ApplyForLanding.styles.css" asp-append-version="true"/>
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container">
<a class="navbar-brand" asp-area="" asp-page="/Index">Dfsseta.ApplyForLanding</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
</li>
</ul>
</div>
</div>
</nav>

</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<main role="main">
<h1 class="govuk-heading-xl">@Model.Heading</h1>
@RenderBody()
</main>

<footer>

<footer class="border-top footer text-muted">
<div class="container">
&copy; 2024 - Dfsseta.ApplyForLanding - <a asp-area="" asp-page="/Privacy">Privacy</a>
</div>
</footer>

<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>

@await RenderSectionAsync("Scripts", required: false)
@await RenderSectionAsync("Scripts", false)
</body>
</html>
</html>
29 changes: 25 additions & 4 deletions tests/Dfsseta.ApplyForLanding.UnitTests/Pages/IndexModelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,32 @@ namespace Dfsseta.ApplyForLanding.UnitTests.Pages;

public class IndexModelTests
{
[Fact]
public void ServiceName_is_ApplyForLanding()
private readonly IndexModel _sut;

public IndexModelTests()
{
var fakeLogger = A.Fake<Logger<IndexModel>>();
var sut = new IndexModel(fakeLogger);
sut.ServiceName.Should().Be("Apply for landing");
_sut = new IndexModel(fakeLogger);
}

[Fact]
public void Heading_is_ApplyForLanding()
{
_sut.Heading.Should().Be("Apply for landing");
}

[Fact]
public void OnGet_should_set_LandableBodies()
{
_sut.OnGet();
_sut.LandableBodies.Should().Equal(
[
"Mars",
"Saturn (core)",
"International Space Station (ESA)",
"Tiangong space station",
"Earth's moon",
"Pluto"
]);
}
}
Loading