From 65f0fa625575592639a24a9b39330e4a6b500f22 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 27 Oct 2017 19:36:31 -0400 Subject: [PATCH] add scaffolding for web UI (#358) --- ...ModsController.cs => ModsApiController.cs} | 6 +- src/SMAPI.Web/Startup.cs | 1 + src/SMAPI.Web/Views/Shared/_Layout.cshtml | 29 +++++ src/SMAPI.Web/Views/_ViewStart.cshtml | 3 + src/SMAPI.Web/wwwroot/Content/main.css | 107 ++++++++++++++++++ src/SMAPI.Web/wwwroot/Content/sidebar-bg.gif | Bin 0 -> 1104 bytes src/SMAPI.Web/wwwroot/favicon.ico | Bin 0 -> 15086 bytes 7 files changed, 143 insertions(+), 3 deletions(-) rename src/SMAPI.Web/Controllers/{ModsController.cs => ModsApiController.cs} (97%) create mode 100644 src/SMAPI.Web/Views/Shared/_Layout.cshtml create mode 100644 src/SMAPI.Web/Views/_ViewStart.cshtml create mode 100644 src/SMAPI.Web/wwwroot/Content/main.css create mode 100644 src/SMAPI.Web/wwwroot/Content/sidebar-bg.gif create mode 100644 src/SMAPI.Web/wwwroot/favicon.ico diff --git a/src/SMAPI.Web/Controllers/ModsController.cs b/src/SMAPI.Web/Controllers/ModsApiController.cs similarity index 97% rename from src/SMAPI.Web/Controllers/ModsController.cs rename to src/SMAPI.Web/Controllers/ModsApiController.cs index a671ddca..1db5b59e 100644 --- a/src/SMAPI.Web/Controllers/ModsController.cs +++ b/src/SMAPI.Web/Controllers/ModsApiController.cs @@ -14,8 +14,8 @@ namespace StardewModdingAPI.Web.Controllers { /// Provides an API to perform mod update checks. [Produces("application/json")] - [Route("api/{version:semanticVersion}/[controller]")] - internal class ModsController : Controller + [Route("api/{version:semanticVersion}/mods")] + internal class ModsApiController : Controller { /********* ** Properties @@ -39,7 +39,7 @@ namespace StardewModdingAPI.Web.Controllers /// Construct an instance. /// The cache in which to store mod metadata. /// The config settings for mod update checks. - public ModsController(IMemoryCache cache, IOptions configProvider) + public ModsApiController(IMemoryCache cache, IOptions configProvider) { ModUpdateCheckConfig config = configProvider.Value; diff --git a/src/SMAPI.Web/Startup.cs b/src/SMAPI.Web/Startup.cs index eaf14983..abce8f28 100644 --- a/src/SMAPI.Web/Startup.cs +++ b/src/SMAPI.Web/Startup.cs @@ -64,6 +64,7 @@ namespace StardewModdingAPI.Web loggerFactory.AddDebug(); app .UseRewriter(new RewriteOptions().Add(new RewriteSubdomainRule())) // convert subdomain.smapi.io => smapi.io/subdomain for routing + .UseStaticFiles() // wwwroot folder .UseMvc(); } } diff --git a/src/SMAPI.Web/Views/Shared/_Layout.cshtml b/src/SMAPI.Web/Views/Shared/_Layout.cshtml new file mode 100644 index 00000000..89b1866c --- /dev/null +++ b/src/SMAPI.Web/Views/Shared/_Layout.cshtml @@ -0,0 +1,29 @@ + + + + + @ViewData["Title"] - SMAPI.io + + + + +
+
+

@ViewData["Title"]

+ @RenderBody() +
+ +
+ + diff --git a/src/SMAPI.Web/Views/_ViewStart.cshtml b/src/SMAPI.Web/Views/_ViewStart.cshtml new file mode 100644 index 00000000..a5f10045 --- /dev/null +++ b/src/SMAPI.Web/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/src/SMAPI.Web/wwwroot/Content/main.css b/src/SMAPI.Web/wwwroot/Content/main.css new file mode 100644 index 00000000..c8ce8d33 --- /dev/null +++ b/src/SMAPI.Web/wwwroot/Content/main.css @@ -0,0 +1,107 @@ +/* tags */ +html { + height: 100%; +} + +body { + height: 100%; + font-family: sans-serif; +} + +h1, h2, h3 { + font-weight: bold; + margin: 0.2em 0 0.1em 0; + padding-top: .5em; +} + +h1 { + font-size: 1.5em; + color: #888; + margin-bottom: 0; +} + +h2 { + font-size: 1.5em; + border-bottom: 1px solid #AAA; +} + +h3 { + font-size: 1.2em; + border-bottom: 1px solid #AAA; + width: 50%; +} + +a { + color: #006; +} + +/* content */ +#content-column { + position: absolute; + top: 1em; + left: 10em; +} + +#content { + min-height: 140px; + padding: 0 1em 1em 1em; + border-left: 1px solid #CCC; + background: #FFF; + font-size: 0.9em; +} + +#content p { + max-width: 55em; +} + +.section { + border: 1px solid #CCC; + padding: 0.5em; + margin-bottom: 1em; +} + +/* sidebar */ +#sidebar { + margin-top: 3em; + min-height: 75%; + width: 12em; + background: url("sidebar-bg.gif") no-repeat top right; + color: #666; +} + +#sidebar h4 { + margin: 0 0 0.2em 0; + width: 10em; + border-bottom: 1px solid #CCC; + font-size: 0.8em; + font-weight: normal; +} + +#sidebar a { + color: #77B; + border: 0; +} + +#sidebar ul, #sidebar li { + margin: 0; + padding: 0; + list-style: none none; + font-size: 0.9em; + color: #888; +} + +#sidebar li { + margin-left: 1em; +} + +/* footer */ +#footer { + margin: 1em; + padding: 1em; + font-size: 0.6em; + color: gray; +} + +#footer a { + color: #669; +} diff --git a/src/SMAPI.Web/wwwroot/Content/sidebar-bg.gif b/src/SMAPI.Web/wwwroot/Content/sidebar-bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..48e9af5a033ad34ecfe9b737d48a31d1172fe396 GIT binary patch literal 1104 zcmb8o2{+pZ008iRB8em-!5pFPTO17y646y#qa`+Brmt&N>PlLz)k-5B3klLK4cXSY zg4AA2bhWiV>LERl_WnqQpF4sSJ?$XFV2Bq1@baO8 zKy)w|KIU1`HxW1p0?)c3#wUaX*vFt7ZiaIzmN!2K1S^KFZv>#EU?hA)_#33#F*bRS z@abMi-XW=YpvG=c@AS5r&f{=ZU|Wg0kr!T!v~Pa7XL=qir0KEv*#7LHqHn@r;zrp* zKRcnRWB>)gp`4mdy6kfgwhO`#IrO^W+JXbf9J!(8NutjnJcn4G>y7(HaYkx#^)wz0nw6S5LC$B9DO5Jgqu zENe6RGx}1 z4aYUd+7s^XWQQ6Ssz?!KR|E##zDf)b{}J-2&VA)48*#Rk7_uXF#@!AGVg>5nQ*L&o zf%LPtqUNN*ZST;lCg8V;op%nAkX=0G=8E{u3jX8#r8~`tmkV;2Dh^?nZsvu2`A$1)8E>$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