Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
472 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@Html.Raw(Model) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Core.Services; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Common.Widgets | ||
{ | ||
[ViewComponent(Name = "HtmlBlock")] | ||
public class HtmlBlock : ViewComponent | ||
{ | ||
IDataService _db; | ||
|
||
public HtmlBlock(IDataService db) | ||
{ | ||
_db = db; | ||
} | ||
|
||
public IViewComponentResult Invoke(string id, string theme, string author) | ||
{ | ||
string model = @"<ul class=""blog-social nav ml-auto my-auto""> | ||
<li class=""blog-social-item""><a href=""#"" target=""_blank"" class=""blog-social-link""><i class=""blog-social-icon fa fa-twitter""></i></a></li> | ||
<li class=""blog-social-item""><a href=""#"" target=""_blank"" class=""blog-social-link""><i class=""blog-social-icon fa fa-google-plus""></i></a></li> | ||
<li class=""blog-social-item""><a href=""#"" target=""_blank"" class=""blog-social-link""><i class=""blog-social-icon fa fa-facebook-official""></i></a></li> | ||
</ul>"; | ||
|
||
var existing = _db.HtmlWidgets.Single(w => w.Name == id && w.Theme == theme && w.Author == author); | ||
|
||
if (existing == null) | ||
{ | ||
_db.HtmlWidgets.Add(new Core.Data.HtmlWidget { | ||
Name = id, | ||
Theme = theme, | ||
Author = author, | ||
Content = model | ||
}); | ||
_db.Complete(); | ||
} | ||
else | ||
{ | ||
model = existing.Content; | ||
} | ||
|
||
return View("~/Views/Widgets/HtmlBlock/Index.cshtml", model); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
<header class="blog-header d-flex flex-column"> | ||
<div class="container d-flex"> | ||
<a href="~/" class="blog-logo my-auto d-flex"> | ||
<img src="~/@AppSettings.Logo" alt="@AppSettings.Title" class="my-auto" /> | ||
@if(ViewData["bodyClass"] != null && ViewData["bodyClass"].ToString() != "home") { | ||
<img src="~/@AppSettings.Logo" alt="@AppSettings.Title" class="my-auto" /> | ||
@if (ViewData["bodyClass"] != null && ViewData["bodyClass"].ToString() != "home") | ||
{ | ||
<span class="my-auto">@AppSettings.Title</span> | ||
} | ||
</a> | ||
<ul class="blog-social nav ml-auto my-auto"> | ||
<li class="blog-social-item"><a href="#" target="_blank" class="blog-social-link"><i class="blog-social-icon fa fa-twitter"></i></a></li> | ||
<li class="blog-social-item"><a href="#" target="_blank" class="blog-social-link"><i class="blog-social-icon fa fa-google-plus"></i></a></li> | ||
<li class="blog-social-item"><a href="#" target="_blank" class="blog-social-link"><i class="blog-social-icon fa fa-facebook-official"></i></a></li> | ||
</ul> | ||
@await Component.InvokeAsync("HtmlBlock", new { id = "social-btns", theme = "Standard", author = "" }) | ||
|
||
<button class="blog-search-toggle btn-unstyled" type="button" data-toggle="modal" data-target="#blog-search"><i class="fa fa-search"></i></button> | ||
</div> | ||
</header> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Core.Data | ||
{ | ||
public class HtmlWidget | ||
{ | ||
public int Id { get; set; } | ||
public string Name { get; set; } | ||
public string Theme { get; set; } | ||
public string Author { get; set; } | ||
public string Content { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Core.Data | ||
{ | ||
public interface IHtmlWidgetRepository : IRepository<HtmlWidget> | ||
{ | ||
} | ||
|
||
public class HtmlWidgetRepository : Repository<HtmlWidget>, IHtmlWidgetRepository | ||
{ | ||
AppDbContext _db; | ||
|
||
public HtmlWidgetRepository(AppDbContext db) : base(db) | ||
{ | ||
_db = db; | ||
} | ||
} | ||
} |
Oops, something went wrong.