diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-08-06 13:35:20 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-09-14 19:06:34 -0400 |
commit | 3f6865e8301535c8fbe83bc0f931a116adac0636 (patch) | |
tree | ed8e01fbd9a9f758c59aafaac5f4bff72ee30002 /src/SMAPI.Web/Views/JsonValidator/Index.cshtml | |
parent | 6036fbf0500795109b1c5dcf53162cb55834d35a (diff) | |
download | SMAPI-3f6865e8301535c8fbe83bc0f931a116adac0636.tar.gz SMAPI-3f6865e8301535c8fbe83bc0f931a116adac0636.tar.bz2 SMAPI-3f6865e8301535c8fbe83bc0f931a116adac0636.zip |
add footer tip about using schema directly, add details to page title (#654)
Diffstat (limited to 'src/SMAPI.Web/Views/JsonValidator/Index.cshtml')
-rw-r--r-- | src/SMAPI.Web/Views/JsonValidator/Index.cshtml | 27 |
1 files changed, 21 insertions, 6 deletions
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) } } - <h2>Raw content</h2> + <h2>Content</h2> <pre id="raw-content" class="sunlight-highlight-javascript">@Model.Content</pre> + + @if (isValidSchema) + { + <p class="footer-tip">(Tip: you can <a href="https://github.com/Pathoschild/SMAPI/blob/develop/docs/technical/web.md#using-a-schema-file-directly">validate directly in your text editor</a> if it supports JSON Schema.)</p> + } </div> } |