diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-26 12:25:25 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-26 12:25:25 -0400 |
commit | da29f3f08f2192cdce2d3a9ed3c55680421e0caf (patch) | |
tree | dea9bf89cf4e12322960b5efa8dfc9598d51a235 | |
parent | fb3b7aefa79ed9edeee85cf64004e928d203de81 (diff) | |
download | SMAPI-da29f3f08f2192cdce2d3a9ed3c55680421e0caf.tar.gz SMAPI-da29f3f08f2192cdce2d3a9ed3c55680421e0caf.tar.bz2 SMAPI-da29f3f08f2192cdce2d3a9ed3c55680421e0caf.zip |
make beta download blurb configurable (#585)
-rw-r--r-- | src/SMAPI.Web/Controllers/IndexController.cs | 4 | ||||
-rw-r--r-- | src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs | 5 | ||||
-rw-r--r-- | src/SMAPI.Web/ViewModels/IndexModel.cs | 7 | ||||
-rw-r--r-- | src/SMAPI.Web/Views/Index/Index.cshtml | 8 | ||||
-rw-r--r-- | src/SMAPI.Web/appsettings.Development.json | 3 | ||||
-rw-r--r-- | src/SMAPI.Web/appsettings.json | 3 |
6 files changed, 23 insertions, 7 deletions
diff --git a/src/SMAPI.Web/Controllers/IndexController.cs b/src/SMAPI.Web/Controllers/IndexController.cs index 8c4a0332..dadbedd1 100644 --- a/src/SMAPI.Web/Controllers/IndexController.cs +++ b/src/SMAPI.Web/Controllers/IndexController.cs @@ -67,12 +67,12 @@ namespace StardewModdingAPI.Web.Controllers IndexVersionModel stableVersionModel = stableVersion != null ? new IndexVersionModel(stableVersion.Version.ToString(), stableVersion.Release.Body, stableVersion.Asset.DownloadUrl, stableVersionForDevs?.Asset.DownloadUrl) : new IndexVersionModel("unknown", "", "https://github.com/Pathoschild/SMAPI/releases", null); // just in case something goes wrong) - IndexVersionModel betaVersionModel = betaVersion != null && this.SiteConfig.EnableSmapiBeta + IndexVersionModel betaVersionModel = betaVersion != null && this.SiteConfig.BetaEnabled ? new IndexVersionModel(betaVersion.Version.ToString(), betaVersion.Release.Body, betaVersion.Asset.DownloadUrl, betaVersionForDevs?.Asset.DownloadUrl) : null; // render view - var model = new IndexModel(stableVersionModel, betaVersionModel); + var model = new IndexModel(stableVersionModel, betaVersionModel, this.SiteConfig.BetaBlurb); return this.View(model); } diff --git a/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs index 3d428015..c0e4c4c8 100644 --- a/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs +++ b/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs @@ -13,6 +13,9 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels public string LogParserUrl { get; set; } /// <summary>Whether to show SMAPI beta versions on the main page, if any.</summary> - public bool EnableSmapiBeta { get; set; } + public bool BetaEnabled { get; set; } + + /// <summary>A short sentence shown under the beta download button, if any.</summary> + public string BetaBlurb { get; set; } } } diff --git a/src/SMAPI.Web/ViewModels/IndexModel.cs b/src/SMAPI.Web/ViewModels/IndexModel.cs index 4268c878..82c4e06f 100644 --- a/src/SMAPI.Web/ViewModels/IndexModel.cs +++ b/src/SMAPI.Web/ViewModels/IndexModel.cs @@ -12,6 +12,9 @@ namespace StardewModdingAPI.Web.ViewModels /// <summary>The latest prerelease SMAPI version (if newer than <see cref="StableVersion"/>).</summary> public IndexVersionModel BetaVersion { get; set; } + /// <summary>A short sentence shown under the beta download button, if any.</summary> + public string BetaBlurb { get; set; } + /********* ** Public methods @@ -22,10 +25,12 @@ namespace StardewModdingAPI.Web.ViewModels /// <summary>Construct an instance.</summary> /// <param name="stableVersion">The latest stable SMAPI version.</param> /// <param name="betaVersion">The latest prerelease SMAPI version (if newer than <paramref name="stableVersion"/>).</param> - internal IndexModel(IndexVersionModel stableVersion, IndexVersionModel betaVersion) + /// <param name="betaBlurb">A short sentence shown under the beta download button, if any.</param> + internal IndexModel(IndexVersionModel stableVersion, IndexVersionModel betaVersion, string betaBlurb) { this.StableVersion = stableVersion; this.BetaVersion = betaVersion; + this.BetaBlurb = betaBlurb; } } } diff --git a/src/SMAPI.Web/Views/Index/Index.cshtml b/src/SMAPI.Web/Views/Index/Index.cshtml index 361d01de..ce0e6275 100644 --- a/src/SMAPI.Web/Views/Index/Index.cshtml +++ b/src/SMAPI.Web/Views/Index/Index.cshtml @@ -26,7 +26,13 @@ @if (Model.BetaVersion != null) { <div class="cta-dropdown secondary-cta-dropdown"> - <a href="@Model.BetaVersion.DownloadUrl" class="secondary-cta download">Download SMAPI @Model.BetaVersion.Version<br/><small>for Stardew Valley 1.3 beta</small></a><br/> + <a href="@Model.BetaVersion.DownloadUrl" class="secondary-cta download"> + Download SMAPI @Model.BetaVersion.Version + @if (!string.IsNullOrWhiteSpace(Model.BetaBlurb)) + { + <br/><small>@Model.BetaBlurb</small> + } + </a><br/> <div class="dropdown-content"> <a href="https://www.nexusmods.com/stardewvalley/mods/2400"><img src="Content/images/nexus-icon.png" /> Download from Nexus</a> <a href="@Model.BetaVersion.DownloadUrl"><img src="Content/images/direct-download-icon.png" /> Direct download</a> diff --git a/src/SMAPI.Web/appsettings.Development.json b/src/SMAPI.Web/appsettings.Development.json index 67bb7748..dc22791b 100644 --- a/src/SMAPI.Web/appsettings.Development.json +++ b/src/SMAPI.Web/appsettings.Development.json @@ -20,7 +20,8 @@ "Site": { "RootUrl": "http://localhost:59482/", "LogParserUrl": "http://localhost:59482/log/", - "EnableSmapiBeta": false + "BetaEnabled": false, + "BetaBlurb": null }, "ApiClients": { diff --git a/src/SMAPI.Web/appsettings.json b/src/SMAPI.Web/appsettings.json index 9e3270ae..bd948aa0 100644 --- a/src/SMAPI.Web/appsettings.json +++ b/src/SMAPI.Web/appsettings.json @@ -17,7 +17,8 @@ "Site": { "RootUrl": null, // see top note "LogParserUrl": null, // see top note - "EnableSmapiBeta": null // see top note + "BetaEnabled": null, // see top note + "BetaBlurb": null // see top note }, "ApiClients": { |