Skip to content

Commit b70617f

Browse files
committed
Changed layout of footer links and added options to hide the links.
1 parent 349d670 commit b70617f

8 files changed

+62
-31
lines changed

.editorconfig

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Rules in this file were initially inferred by Visual Studio IntelliCode from the D:\Code\GitHub\VsixGallery\src\ codebase based on best match to current usage at 2021-07-21
2-
# You can modify the rules from these initially generated values to suit your own policies
3-
# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
41
[*.cs]
52

63

src/Options/DisplayOptions.cs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace VsixGallery
2+
{
3+
public class DisplayOptions
4+
{
5+
public bool HideSetupLink { get; set; }
6+
7+
public bool HideUploadGuideLink { get; set; }
8+
9+
public bool HideCreateExtensionLink { get; set; }
10+
11+
public bool HideContributeLink { get; set; }
12+
}
13+
}

src/Pages/Shared/_Layout.cshtml

+14-16
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,20 @@
4141
</main>
4242

4343
<footer>
44-
<div class="container">
45-
<div>
46-
<h3>How to</h3>
47-
<ul>
48-
<li><a href="~/feedguide">Set up gallery feed</a></li>
49-
<li><a href="~/devguide">Add your extension</a></li>
50-
<li><a href="https://devblogs.microsoft.com/visualstudio/getting-started-writing-visual-studio-extensions/" rel="noopener noreferrer">Write your first extension</a></li>
51-
</ul>
52-
</div>
53-
<div>
54-
<h3>Contribute</h3>
55-
<ul>
56-
<li><a href="https://github.com/madskristensen/VsixGallery/" rel="noopener noreferrer">Source code on GitHub</a></li>
57-
</ul>
58-
</div>
59-
</div>
44+
<ul>
45+
@if (!(bool)ViewData["HideSetupLink"]) {
46+
<li><a href="~/feedguide">Set up gallery feed</a></li>
47+
}
48+
@if (!(bool)ViewData["HideUploadGuideLink"]) {
49+
<li><a href="~/devguide">Add your extension</a></li>
50+
}
51+
@if (!(bool)ViewData["HideCreateExtensionLink"]) {
52+
<li><a href="https://devblogs.microsoft.com/visualstudio/getting-started-writing-visual-studio-extensions/" rel="noopener noreferrer">Write your first extension</a></li>
53+
}
54+
@if (!(bool)ViewData["HideContributeLink"]) {
55+
<li><a href="https://github.com/madskristensen/VsixGallery/" rel="noopener noreferrer">Contribute on GitHub</a></li>
56+
}
57+
</ul>
6058

6159
<p id="copyright">
6260
Copyright &copy; 2020 <a href="https://www.madskristensen.net" rel="noopener noreferrer">Mads Kristensen</a>

src/Pages/_ViewStart.cshtml

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
@{
1+
@using Microsoft.Extensions.DependencyInjection;
2+
@using Microsoft.Extensions.Options;
3+
@{
24
Layout = "_Layout";
35

46
Context.Response.Headers["Cache-Control"] = "max-age=180"; // 3 minutes
@@ -10,4 +12,10 @@
1012
Context.Response.Headers["Referrer-Policy"] = "no-referrer-when-downgrade";
1113
Context.Response.Headers["X-Frame-Options"] = "DENY";
1214
}
15+
16+
DisplayOptions options = Context.RequestServices.GetRequiredService<IOptions<DisplayOptions>>().Value;
17+
ViewData["HideSetupLink"] = options.HideSetupLink;
18+
ViewData["HideUploadGuideLink"] = options.HideUploadGuideLink;
19+
ViewData["HideCreateExtensionLink"] = options.HideCreateExtensionLink;
20+
ViewData["HideContributeLink"] = options.HideContributeLink;
1321
}

src/Startup.cs

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public void ConfigureServices(IServiceCollection services)
4747
services.AddSingleton<PackageHelper>();
4848

4949
services.Configure<ExtensionsOptions>(Configuration.GetSection("Extensions"));
50+
services.Configure<DisplayOptions>(Configuration.GetSection("Display"));
5051

5152
// HTML minification (https://github.com/Taritsyn/WebMarkupMin)
5253
services

src/VsixGallery.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
44
<TargetFramework>netcoreapp3.1</TargetFramework>

src/appsettings.json

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
"Directory": "",
44
"RemoveOldExtensions": true
55
},
6+
"Display": {
7+
"HideSetupLink": false,
8+
"HideUploadGuideLink": false,
9+
"HideCreateExtensionLink": false,
10+
"HideContributeLink": false
11+
},
612
"Logging": {
713
"LogLevel": {
814
"Default": "Information",

src/wwwroot/css/site.scss

+18-10
Original file line numberDiff line numberDiff line change
@@ -189,32 +189,40 @@ dt {
189189
footer {
190190
background: $dark-backdrop;
191191
color: white;
192+
display: flex;
193+
flex-direction: column;
194+
align-items: center;
192195

193196
a {
194197
color: inherit;
195198
}
196199

197200
ul {
201+
margin: 1em 0 0 0;
198202
list-style: none;
199203
padding: 0;
200-
}
201204

202-
.container {
203-
display: flex;
204-
margin-bottom: 2em;
205+
li {
206+
display: inline-block;
205207

206-
> div:not(:first-child) {
207-
margin-left: 2em;
208+
&:not(:last-child) {
209+
&::after {
210+
padding: 0 0.75em;
211+
content: '\00b7'; // &middot;
212+
}
213+
}
208214
}
209-
}
210215

211-
h3 {
212-
margin: 5px 0;
216+
&:empty {
217+
// Hide the element if none of the links inside it are displayed.
218+
display: none;
219+
}
213220
}
214221

215222
#copyright {
216-
text-align: center;
217223
font-size: .9em;
224+
padding: 1em;
225+
margin: 0;
218226
}
219227
}
220228

0 commit comments

Comments
 (0)