Skip to content

Commit

Permalink
Merge pull request #561 from rullyrmd/enhancement/nav-bar-responsive-…
Browse files Browse the repository at this point in the history
…toggle

Enhancement/nav bar responsive toggle
  • Loading branch information
poppastring authored Apr 9, 2021
2 parents 77292e5 + 836fc5b commit 26235c3
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 25 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pool:

variables:
buildConfiguration: 'Release'
version: 2.40
version: 2.41

steps:
- task: UseDotNet@2
Expand Down
2 changes: 2 additions & 0 deletions source/DasBlog.Services/ConfigFile/Interfaces/ISiteConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ public interface ISiteConfig

string SecurityStyleSources { get; set; }

string DefaultSources { get; set; }

bool CookieConsentEnabled { get; set; }

bool EnableDoubleDecode { get; set; }
Expand Down
5 changes: 4 additions & 1 deletion source/DasBlog.Services/ConfigFile/SiteConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ public SiteConfig() { }
public string SecurityScriptSources { get; set; }

public string SecurityStyleSources { get; set; }
public bool EnableDoubleDecode { get; set; }

public string DefaultSources { get; set; }

public bool EnableDoubleDecode { get; set; }
}
}
2 changes: 1 addition & 1 deletion source/DasBlog.Services/DasBlog.Services.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>2.40.0</Version>
<Version>3.0.0</Version>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DasBlog.Web.Core\DasBlog.Core.csproj" />
Expand Down
1 change: 1 addition & 0 deletions source/DasBlog.Tests/UnitTests/SiteConfigTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,6 @@ public class SiteConfigTest : ISiteConfig

public string SecurityStyleSources { get; set; }
public bool EnableDoubleDecode { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public string DefaultSources { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
}
}
1 change: 1 addition & 0 deletions source/DasBlog.Web.UI/Config/site.config
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@

<CookieConsentEnabled>false</CookieConsentEnabled>

<DefaultSources>data:;https:</DefaultSources>
<SecurityStyleSources>cloud.tinymce.com;cdn.tiny.cloud;cdn.jsdelivr.net;js.nicedit.com;www.google.com;platform.twitter.com;cdn.syndication.twimg.com;fonts.googleapis.com;maxcdn.bootstrapcdn.com</SecurityStyleSources>
<SecurityScriptSources>cloud.tinymce.com;cdn.tiny.cloud;cdn.jsdelivr.net;js.nicedit.com;www.google.com;cse.google.com;cdn.syndication.twimg.com;platform.twitter.com;apis.google.com;www.google-analytics.com;www.googletagservices.com;adservice.google.com;securepubads.g.doubleclick.net;ajax.aspnetcdn.com;ssl.google-analytics.com</SecurityScriptSources>

Expand Down
2 changes: 1 addition & 1 deletion source/DasBlog.Web.UI/DasBlog.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<UserSecretsId>d3583964-0aca-4de4-9521-c74cdf42f990</UserSecretsId>
<Version>2.40.0</Version>
<Version>2.41.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="9.0.0" />
Expand Down
5 changes: 5 additions & 0 deletions source/DasBlog.Web.UI/Models/AdminViewModels/SiteViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ public class SiteViewModel
[Description("")]
public bool EnableDoubleDecode { get; set; }

[DisplayName("Default Sources (seperated by semi colon")]
[Description("")]
[StringLength(50, MinimumLength = 1, ErrorMessage = "{0} should be between 1 to 50 characters")]
public string DefaultSources { get; set; }

public bool EntryTitleAsLink { get; set; }
public bool ObfuscateEmail { get; set; }
public bool SendReferralsByEmail { get; set; }
Expand Down
7 changes: 4 additions & 3 deletions source/DasBlog.Web.UI/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,14 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IDasBlog

var SecurityScriptSources = Configuration.GetSection("SecurityScriptSources")?.Value?.Split(";");
var SecurityStyleSources = Configuration.GetSection("SecurityStyleSources")?.Value?.Split(";");
var DefaultSources = Configuration.GetSection("DefaultSources")?.Value?.Split(";");

if (SecurityStyleSources != null && SecurityScriptSources != null)
if (SecurityStyleSources != null && SecurityScriptSources != null && DefaultSources != null)
{
app.UseCsp(options => options
.DefaultSources(s => s.Self()
.CustomSources("data:")
.CustomSources("https:"))
.CustomSources(DefaultSources)
)
.StyleSources(s => s.Self()
.CustomSources(SecurityStyleSources)
.UnsafeInline()
Expand Down
35 changes: 17 additions & 18 deletions source/DasBlog.Web.UI/Themes/darkly/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,23 @@
</head>

<body>
<div class="navbar navbar-dark navbar-expand-lg sticky-top bg-dark">
<div class="navbar-collapse">
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand"><site-title /></a>
<div class="container">
<div>
<ul class="navbar-nav mr-auto">
<li class="nav-item nav-item-active"><a class="nav-link" asp-area="" asp-controller="home" asp-action="index">Home</a></li>
<li class="nav-item"><a class="nav-link" asp-area="" asp-controller="category" asp-action="category">Category</a></li>
<li class="nav-item"><a class="nav-link" asp-area="" asp-controller="archive" asp-action="archive">Archive</a></li>
<li class="nav-item"><a class="nav-link" asp-area="" asp-controller="feed" asp-action="rss">Subscribe</a></li>
<li class="nav-item" dasblog-authorized><a id="CreatePostLink" class="nav-link" asp-area="" asp-controller="post" asp-action="create">Create Post</a></li>
<li class="nav-item" dasblog-authorized><a class="nav-link" asp-area="" asp-controller="admin" asp-action="settings">Site Admin</a></li>
<li class="nav-item" dasblog-authorized><a class="nav-link" asp-area="" asp-controller="admin" asp-action="managecomments">Manage Comments</a></li>
<li class="nav-item" dasblog-authorized><a class="nav-link" asp-area="" asp-controller="users" asp-action="index">Users</a></li>
<li class="nav-item" dasblog-authorized><a class="nav-link" asp-area="" asp-controller="activity" asp-action="index">Activity</a></li>
</ul>
</div>
</div>
<div class="navbar navbar-expand-lg navbar-dark bg-dark">
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand"><site-title /></a>
<button class="navbar-toggler collapsed" type="button" data-toggle="collapse" data-target="#navbar-darkly" aria-controls="navbar-darkly" aria-expanded="true" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar-darkly" class="navbar-collapse collapse" style="">
<ul class="navbar-nav mr-auto">
<li class="nav-item nav-item-active"><a class="nav-link" asp-area="" asp-controller="home" asp-action="index">Home</a></li>
<li class="nav-item"><a class="nav-link" asp-area="" asp-controller="category" asp-action="category">Category</a></li>
<li class="nav-item"><a class="nav-link" asp-area="" asp-controller="archive" asp-action="archive">Archive</a></li>
<li class="nav-item"><a class="nav-link" asp-area="" asp-controller="feed" asp-action="rss">Subscribe</a></li>
<li class="nav-item" dasblog-authorized><a id="CreatePostLink" class="nav-link" asp-area="" asp-controller="post" asp-action="create">Create Post</a></li>
<li class="nav-item" dasblog-authorized><a class="nav-link" asp-area="" asp-controller="admin" asp-action="settings">Site Admin</a></li>
<li class="nav-item" dasblog-authorized><a class="nav-link" asp-area="" asp-controller="admin" asp-action="managecomments">Manage Comments</a></li>
<li class="nav-item" dasblog-authorized><a class="nav-link" asp-area="" asp-controller="users" asp-action="index">Users</a></li>
<li class="nav-item" dasblog-authorized><a class="nav-link" asp-area="" asp-controller="activity" asp-action="index">Activity</a></li>
</ul>
<div class="navbar navbar-collapse col-md-offset-10 col-md-2">
@* could not make this go further right (or perhaps it already was fully justified on an indented column *@
<ul class="navbar-nav mr-auto">
Expand Down
8 changes: 8 additions & 0 deletions source/DasBlog.Web.UI/Views/Admin/Settings.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,14 @@

</div>

<div class="dbc-form-group row">

@Html.LabelFor(m => @Model.SiteConfig.DefaultSources, null, new { @class = "dbc-col-form-label col-3" })
@Html.TextBoxFor(m => @Model.SiteConfig.DefaultSources, null, new { @class = "form-control col-9" })
@Html.ValidationMessageFor(m => m.SiteConfig.DefaultSources, null, new { @class = "text-danger" })

</div>

<hr />

<div class="form-group">
Expand Down

0 comments on commit 26235c3

Please sign in to comment.