From 3f6865e8301535c8fbe83bc0f931a116adac0636 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 6 Aug 2019 13:35:20 -0400 Subject: add footer tip about using schema directly, add details to page title (#654) --- src/SMAPI.Web/Views/JsonValidator/Index.cshtml | 27 +++++++++++++++++----- src/SMAPI.Web/Views/Shared/_Layout.cshtml | 2 +- .../wwwroot/Content/css/json-validator.css | 9 ++++++++ 3 files changed, 31 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/SMAPI.Web/Views/JsonValidator/Index.cshtml b/src/SMAPI.Web/Views/JsonValidator/Index.cshtml index 34c1c1f3..3143fad9 100644 --- a/src/SMAPI.Web/Views/JsonValidator/Index.cshtml +++ b/src/SMAPI.Web/Views/JsonValidator/Index.cshtml @@ -2,12 +2,22 @@ @model JsonValidatorModel @{ - ViewData["Title"] = "JSON validator"; - + // get view data string curPageUrl = new Uri(new Uri(Model.SectionUrl), $"{Model.SchemaName}/{Model.PasteID}").ToString(); - string newUploadUrl = Model.SchemaName != null - ? new Uri(new Uri(Model.SectionUrl), Model.SchemaName).ToString() - : Model.SectionUrl; + string newUploadUrl = Model.SchemaName != null ? new Uri(new Uri(Model.SectionUrl), Model.SchemaName).ToString() : Model.SectionUrl; + string schemaDisplayName = null; + bool isValidSchema = Model.SchemaName != null && Model.SchemaFormats.TryGetValue(Model.SchemaName, out schemaDisplayName) && schemaDisplayName != "None"; + + // build title + ViewData["Title"] = "JSON validator"; + @if (Model.PasteID != null) + { + ViewData["ViewTitle"] = ViewData["Title"]; + ViewData["Title"] += + " (" + + string.Join(", ", new[] { isValidSchema ? schemaDisplayName : null, Model.PasteID }.Where(p => p != null)) + + ")"; + } } @section Head { @@ -130,7 +140,12 @@ else if (Model.PasteID != null) } } -

Raw content

+

Content

@Model.Content
+ + @if (isValidSchema) + { + + } } diff --git a/src/SMAPI.Web/Views/Shared/_Layout.cshtml b/src/SMAPI.Web/Views/Shared/_Layout.cshtml index 9911ef0e..87a22f06 100644 --- a/src/SMAPI.Web/Views/Shared/_Layout.cshtml +++ b/src/SMAPI.Web/Views/Shared/_Layout.cshtml @@ -28,7 +28,7 @@
-

@ViewData["Title"]

+

@(ViewData["ViewTitle"] ?? ViewData["Title"])

@RenderBody()