Skip to content

Commit 1ba8ebc

Browse files
CMS template update (#139)
* Features/upgrate to dotnet 6 (#108) * Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere * Removed old project folders/files * Removed temporary old solution * Refactored code; Set some members to nullable * Changed usage on TryUpdateModelAsync * Features/fix email bugs (#110) * Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere * Removed old project folders/files * Removed temporary old solution * Refactored code; Set some members to nullable * Changed usage on TryUpdateModelAsync * Fixed e-mail issues * Features/fix email bugs (#112) * Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere * Removed old project folders/files * Removed temporary old solution * Refactored code; Set some members to nullable * Changed usage on TryUpdateModelAsync * Fixed e-mail issues * Feature/fix email send issues (#114) * Removed development files * Updated .gitignore * Added MailKit library * Implemented e-mail sender with MailKit * Feature/minor changes (#116) * Updated nuget packages * Improved HtmlHelperExtensions logic and added possibility to use with slugs * Added "About me" menu item * Feature/code improvements (#117) * Add possibility to use global.json * Add global.json file with targeting SDK 6.0.403 * Removed warnings * Add exclusion of generated code * Exclude Identity pages from null check * Update packages; Add ardalis.GuardClauses * Remove warnings * Remove null warnings; Minor code improvements * Fixed post not being saved * Fixed post not being saved * Add filter to prevent articles to appear before publishing time * Add filter to prevent articles to appear before publishing time * Add about me and subscribe; Reorder menu * Add Author partial view * Change DateTime format * Add SASS package * Reduce padding; Add max-height of 100% * Minor improvements (#118) * Develop (#113) * Features/upgrate to dotnet 6 (#108) * Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere * Removed old project folders/files * Removed temporary old solution * Refactored code; Set some members to nullable * Changed usage on TryUpdateModelAsync * Features/fix email bugs (#110) * Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere * Removed old project folders/files * Removed temporary old solution * Refactored code; Set some members to nullable * Changed usage on TryUpdateModelAsync * Fixed e-mail issues * Features/fix email bugs (#112) * Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere * Removed old project folders/files * Removed temporary old solution * Refactored code; Set some members to nullable * Changed usage on TryUpdateModelAsync * Fixed e-mail issues * Bugfix for e-mail sending (#115) * Features/upgrate to dotnet 6 (#108) * Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere * Removed old project folders/files * Removed temporary old solution * Refactored code; Set some members to nullable * Changed usage on TryUpdateModelAsync * Features/fix email bugs (#110) * Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere * Removed old project folders/files * Removed temporary old solution * Refactored code; Set some members to nullable * Changed usage on TryUpdateModelAsync * Fixed e-mail issues * Features/fix email bugs (#112) * Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere * Removed old project folders/files * Removed temporary old solution * Refactored code; Set some members to nullable * Changed usage on TryUpdateModelAsync * Fixed e-mail issues * Feature/fix email send issues (#114) * Removed development files * Updated .gitignore * Added MailKit library * Implemented e-mail sender with MailKit * Feature/remove contact form (#120) * Add empty connection strings * Removed Contact form and references * Redirected contact route to index * Feature/fix merge issues (#121) * Remove duplicate subscribe link * Feature/optimizations (#123) * Remove dotnet-tools * Remove .config folder * Set CmsEngine.Ui to run out of process * Upgrade to .NET 7 * Code refactor * Code refactor * Make repository and services disposable * Feature/upgrade to dotnet 8 (#124) * .NET upgrade * Code refactor * Feature/GitHub actions (#126) * Add github action * Add develop branch to push/pull request; Remove tests * Feature/GitHub actions (#127) * Add github action * Add develop branch to push/pull request; Remove tests * Set SDK to 8.0.302 * Github actions configuration (#128) * Add github action * Add develop branch to push/pull request; Remove tests * Set SDK to 8.0.302 * Change action trigger to feature/** * Library update * Add build status to readme.md * Update readme.md (#131) * Upgrade libraries (#134) * Dev certificate password; Layout changes (#136) * CMS theme update (#137) * Migration of layout files * Add _DataTableCardHeader * Replaced some icons; Fixed paths * Add new assets; Moved old assets around * Add custom CSS * Update packages * Update JS for updated packages * Update Views / Helpers to match new theme * Moving admin.css * Feature/minor changes (#138) * Minor style changes * Add Count method in the Repository and Services * Add counter in the dashboard * Removed menu items; Add "not implemented" message * Fix for image paths and files not being copied on build
1 parent c03fd21 commit 1ba8ebc

File tree

1,400 files changed

+24602
-4311
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,400 files changed

+24602
-4311
lines changed

src/CmsEngine.Application/Helpers/DataTableHelper.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ private static string PrepareProperty(IViewModel item, PropertyInfo property)
6565
break;
6666
}
6767

68-
return $"<span class=\"badge badge-{generalStatus.ToString().ToLowerInvariant()}\">{documentStatus.ToEnum<DocumentStatus>().GetName()}</status-label>";
68+
return $"<span class=\"badge text-bg-{generalStatus.ToString().ToLowerInvariant()}\">{documentStatus.ToEnum<DocumentStatus>().GetName()}</status-label>";
6969
case "UserViewModel":
7070
var author = (UserViewModel)value;
7171
return HtmlEncoder.Default.Encode(author?.FullName ?? string.Empty);
7272
case "Boolean":
7373
generalStatus = (bool)value ? GeneralStatus.Success : GeneralStatus.Danger;
74-
return $"<span class=\"badge badge-{generalStatus.ToString().ToLowerInvariant()}\">{((bool)value).ToYesNo().ToUpper()}</status-label>";
74+
return $"<span class=\"badge text-bg-{generalStatus.ToString().ToLowerInvariant()}\">{((bool)value).ToYesNo().ToUpper()}</status-label>";
7575
default:
7676
return HtmlEncoder.Default.Encode(value?.ToString() ?? string.Empty);
7777
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace CmsEngine.Application.Models.ViewModels;
2+
3+
public class HomeViewModel
4+
{
5+
public int PostCount { get; set; }
6+
7+
public int PageCount { get; set; }
8+
9+
public int CategoryCount { get; set; }
10+
11+
public int TagCount { get; set; }
12+
}

src/CmsEngine.Application/Services/CategoryService.cs

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ public IEnumerable<Category> FilterForDataTable(string searchValue, IEnumerable<
6262
return items;
6363
}
6464

65+
public async Task<int> GetCategoryCount()
66+
{
67+
logger.LogDebug("CategoryService > GetCategoryCount()");
68+
var items = await unitOfWork.Categories.CountAsync();
69+
logger.LogDebug("Category count: {0}", items);
70+
return items;
71+
}
72+
6573
public async Task<IEnumerable<CategoryViewModel>> GetCategoriesWithPost()
6674
{
6775
logger.LogDebug("CategoryService > GetCategoriesWithPost()");

src/CmsEngine.Application/Services/Interfaces/ICategoryService.cs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public interface ICategoryService : IDataTableService<Category>, IDisposable
88
Task<ReturnValue> DeleteRange(Guid[] ids);
99
Task<(IEnumerable<CategoryTableViewModel> Data, int RecordsTotal, int RecordsFiltered)> GetForDataTable(DataParameters parameters);
1010
Task<ReturnValue> Save(CategoryEditModel categoryEditModel);
11+
Task<int> GetCategoryCount();
1112
Task<IEnumerable<CategoryViewModel>> GetCategoriesWithPostCount();
1213
Task<IEnumerable<CategoryViewModel>> GetCategoriesWithPost();
1314
}

src/CmsEngine.Application/Services/Interfaces/IPageService.cs

+1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ public interface IPageService : IDataTableService<Page>, IDisposable
99
Task<(IEnumerable<PageTableViewModel> Data, int RecordsTotal, int RecordsFiltered)> GetForDataTable(DataParameters parameters);
1010
Task<ReturnValue> Save(PageEditModel pageEditModel);
1111
Task<PageViewModel> GetBySlug(string slug);
12+
Task<int> GetPageCount();
1213
Task<IEnumerable<PageViewModel>> GetAllPublished();
1314
}

src/CmsEngine.Application/Services/Interfaces/IPostService.cs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public interface IPostService : IDataTableService<Post>, IDisposable
1010
Task<ReturnValue> Save(PostEditModel postEditModel);
1111
Task<IEnumerable<PostEditModel>> GetPublishedOrderedByDate(int count = 0);
1212
Task<PostViewModel> GetBySlug(string slug);
13+
Task<int> GetPostCount();
1314
Task<PaginatedList<PostViewModel>> GetPublishedByCategoryForPagination(string categorySlug, int page = 1);
1415
Task<PaginatedList<PostViewModel>> GetPublishedByTagForPagination(string tagSlug, int page = 1);
1516
Task<PaginatedList<PostViewModel>> GetPublishedForPagination(int page = 1);

src/CmsEngine.Application/Services/Interfaces/ITagService.cs

+1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ public interface ITagService : IDataTableService<Tag>, IDisposable
88
Task<ReturnValue> DeleteRange(Guid[] ids);
99
Task<(IEnumerable<TagTableViewModel> Data, int RecordsTotal, int RecordsFiltered)> GetForDataTable(DataParameters parameters);
1010
Task<ReturnValue> Save(TagEditModel tagEditModel);
11+
Task<int> GetTagCount();
1112
Task<IEnumerable<TagViewModel>> GetAllTags();
1213
}

src/CmsEngine.Application/Services/PageService.cs

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ public IEnumerable<Page> FilterForDataTable(string searchValue, IEnumerable<Page
6262
return items;
6363
}
6464

65+
public async Task<int> GetPageCount()
66+
{
67+
logger.LogDebug("PageService > GetPageCount()");
68+
var items = await unitOfWork.Pages.CountAsync();
69+
logger.LogDebug("Page count: {0}", items);
70+
return items;
71+
}
72+
6573
public async Task<IEnumerable<PageViewModel>> GetAllPublished()
6674
{
6775
logger.LogDebug("PageService > GetPagesByStatusReadOnly()");

src/CmsEngine.Application/Services/PostService.cs

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ public IEnumerable<Post> FilterForDataTable(string searchValue, IEnumerable<Post
6262
return items;
6363
}
6464

65+
public async Task<int> GetPostCount()
66+
{
67+
logger.LogDebug("PostService > GetPostCount()");
68+
var items = await unitOfWork.Posts.CountAsync();
69+
logger.LogDebug("Post count: {0}", items);
70+
return items;
71+
}
72+
6573
public async Task<PostViewModel> GetBySlug(string slug)
6674
{
6775
logger.LogDebug("PostService > GetBySlug({slug})", slug);

src/CmsEngine.Application/Services/TagService.cs

+8
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ public IEnumerable<Tag> FilterForDataTable(string searchValue, IEnumerable<Tag>
7575
return (items.MapToTableViewModel(), recordsTotal, items.Count());
7676
}
7777

78+
public async Task<int> GetTagCount()
79+
{
80+
logger.LogDebug("TagService > GetTagCount()");
81+
var items = await unitOfWork.Tags.CountAsync();
82+
logger.LogDebug("Tag count: {0}", items);
83+
return items;
84+
}
85+
7886
public async Task<IEnumerable<TagViewModel>> GetAllTags()
7987
{
8088
logger.LogDebug("TagService > GetAllTags()");

src/CmsEngine.Data/Repositories/Interfaces/IReadRepository.cs

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ namespace CmsEngine.Data.Repositories.Interfaces;
22

33
public interface IReadRepository<TEntity> where TEntity : class
44
{
5+
/// <summary>
6+
/// Count valid items
7+
/// </summary>
8+
/// <returns></returns>
9+
public Task<int> CountAsync();
10+
511
/// <summary>
612
/// Get all records which were not marked as deleted (IsDeleted == false)
713
/// </summary>

src/CmsEngine.Data/Repositories/Repository.cs

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ public Repository(CmsEngineContext context)
1515
dbContext = context;
1616
}
1717

18+
public async Task<int> CountAsync()
19+
{
20+
return await Get().CountAsync();
21+
}
22+
1823
public async Task<IEnumerable<TEntity>> GetAllAsync()
1924
{
2025
return await GetValidRecords().ToListAsync();

src/CmsEngine.Ui/Areas/Cms/Controllers/HomeController.cs

+21-4
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,34 @@ namespace CmsEngine.Ui.Areas.Cms.Controllers;
33
[Area("Cms")]
44
public class HomeController : BaseController
55
{
6-
private readonly IEmailService _emailService;
6+
private readonly ICategoryService _categoryService;
7+
private readonly IPageService _pageService;
8+
private readonly IPostService _postService;
9+
private readonly ITagService _tagService;
710

8-
public HomeController(ILoggerFactory loggerFactory, IService service, IEmailService emailService)
11+
public HomeController(ILoggerFactory loggerFactory, IService service, ICategoryService categoryService,
12+
IPageService pageService, IPostService postService, ITagService tagService)
913
: base(loggerFactory, service)
1014
{
11-
_emailService = emailService;
15+
_categoryService = categoryService;
16+
_pageService = pageService;
17+
_postService = postService;
18+
_tagService = tagService;
19+
1220
}
1321

1422
public async Task<IActionResult> IndexAsync()
1523
{
1624
SetupMessages("Dashboard");
17-
return View(await _emailService.GetOrderedByDate());
25+
26+
var homeViewModel = new HomeViewModel
27+
{
28+
CategoryCount = await _categoryService.GetCategoryCount(),
29+
PageCount = await _pageService.GetPageCount(),
30+
PostCount = await _postService.GetPostCount(),
31+
TagCount = await _tagService.GetTagCount()
32+
};
33+
34+
return View(homeViewModel);
1835
}
1936
}

src/CmsEngine.Ui/Areas/Cms/Views/Category/CreateEdit.cshtml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@model CategoryEditModel
22

33
@section Breadcrumb {
4-
<ol class="breadcrumb">
4+
<ol class="breadcrumb my-0">
55
<li class="breadcrumb-item"><a href="~/cms">Dashboard</a></li>
66
<li class="breadcrumb-item"><a href="~/cms/category">@ViewBag.PageTitle</a></li>
77
<li class="breadcrumb-item active">@ViewBag.PageType</li>
@@ -21,22 +21,22 @@
2121
<input asp-for="Id" type="hidden" />
2222
}
2323

24-
<div class="form-group">
24+
<div class="form-group mb-3">
2525
<label asp-for="Name"></label>
2626
<input asp-for="Name" class="form-control slugify" />
2727
</div>
28-
<div class="form-group">
28+
<div class="form-group mb-3">
2929
<label asp-for="Slug"></label>
3030
<input asp-for="Slug" class="form-control slug" />
3131
</div>
32-
<div class="form-group">
32+
<div class="form-group mb-3">
3333
<label asp-for="Description"></label>
3434
<textarea asp-for="Description" class="form-control"></textarea>
3535
</div>
3636
<div asp-validation-summary="All" class="text-danger"></div>
3737
</div>
3838
<div class="card-footer">
39-
<button type="submit" class="btn btn-primary"><i class="far fa-dot-circle"></i> Save</button>
39+
<button type="submit" class="btn btn-primary"><i class="cil-save"></i> Save</button>
4040
</div>
4141
</form>
4242
</div>

src/CmsEngine.Ui/Areas/Cms/Views/Category/List.cshtml

+4-15
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,16 @@
33
}
44

55
@section Breadcrumb {
6-
<ol class="breadcrumb">
6+
<ol class="breadcrumb my-0">
77
<li class="breadcrumb-item"><a href="~/cms">Dashboard</a></li>
88
<li class="breadcrumb-item active">@ViewBag.PageTitle</li>
99
</ol>
1010
}
1111

1212
<div class="card">
13-
<div class="card-header">
14-
<i class="fa fa-align-justify"></i>
15-
@ViewBag.PanelTitle
16-
<div class="btn-toolbar float-right" role="toolbar" aria-label="Toolbar with button groups">
17-
<div class="btn-group" role="group" aria-label="Actions">
18-
<a asp-action="create" class="btn btn-success" data-toggle="tooltip" data-placement="top" title="Create a new item">
19-
<span class="fas fa-plus"></span>
20-
</a>
21-
<a asp-action="bulkdelete" class="btn btn-danger" id="bulk-delete" data-toggle="tooltip" data-placement="top" title="Select the items you want to delete" disabled="disabled">
22-
<span class="far fa-trash-alt"></span>
23-
</a>
24-
</div>
25-
</div>
26-
</div>
13+
@{
14+
await Html.RenderPartialAsync("_DataTableCardHeader");
15+
}
2716
<div class="card-body">
2817
<table id="table-list" class="table table-striped table-bordered">
2918
<thead>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@model IEnumerable<CmsEngine.Application.Helpers.Email.ContactForm>
1+
@model HomeViewModel
22
@section Breadcrumb {
3-
<ol class="breadcrumb">
3+
<ol class="breadcrumb my-0">
44
<li class="breadcrumb-item active">@ViewBag.PageTitle</li>
55
</ol>
66
}
@@ -9,32 +9,27 @@
99
<div class="col-sm-4 col-md-3">
1010
<div class="card">
1111
<div class="card-header">
12-
<i class="fa fa-info"></i> Information
12+
<i class="cil-info"></i> Information
1313
</div>
1414
<div class="card-body">
15-
<ul>
16-
<li>
17-
.NET version: @Environment.Version.ToString()
15+
<ul class="list-group list-group-flush">
16+
<li class="list-group-item">
17+
<strong>.NET version: </strong>@Environment.Version.ToString()
18+
</li>
19+
<li class="list-group-item">
20+
<strong>Posts: </strong> @Model.PostCount
21+
</li>
22+
<li class="list-group-item">
23+
<strong>Pages: </strong> @Model.PageCount
24+
</li>
25+
<li class="list-group-item">
26+
<strong>Categories: </strong> @Model.CategoryCount
27+
</li>
28+
<li class="list-group-item">
29+
<strong>Tags: </strong> @Model.TagCount
1830
</li>
1931
</ul>
2032
</div>
2133
</div>
2234
</div>
23-
<div class="col-sm-8 col-md-9">
24-
<div class="card">
25-
<div class="card-header">
26-
<i class="icon-envelope-letter"></i> E-mails
27-
</div>
28-
<div class="card-body">
29-
@foreach (var item in Model)
30-
{
31-
<ul>
32-
<li>From: @item.From</li>
33-
<li>Subject: @item.Subject</li>
34-
<li>Message: @item.Message</li>
35-
</ul>
36-
}
37-
</div>
38-
</div>
39-
</div>
4035
</div>

src/CmsEngine.Ui/Areas/Cms/Views/Page/CreateEdit.cshtml

+13-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
}
88

99
@section Breadcrumb {
10-
<ol class="breadcrumb">
10+
<ol class="breadcrumb my-0">
1111
<li class="breadcrumb-item"><a href="~/cms">Dashboard</a></li>
1212
<li class="breadcrumb-item"><a href="~/cms/page">@ViewBag.PageTitle</a></li>
1313
<li class="breadcrumb-item active">@ViewBag.PageType</li>
@@ -29,36 +29,36 @@
2929

3030
<div class="row">
3131
<div class="col">
32-
<div class="form-group">
32+
<div class="form-group mb-3">
3333
<label asp-for="Title"></label>
3434
<input asp-for="Title" class="form-control slugify" />
3535
</div>
36-
<div class="form-group">
36+
<div class="form-group mb-3">
3737
<label asp-for="Slug"></label>
3838
<input asp-for="Slug" class="form-control slug" />
3939
</div>
40-
<div class="form-group">
40+
<div class="form-group mb-3">
4141
<label asp-for="Description"></label>
4242
<input asp-for="Description" class="form-control" />
4343
</div>
44-
<div class="form-group">
44+
<div class="form-group mb-3">
4545
<textarea asp-for="DocumentContent" class="form-control"></textarea>
4646
<div class="upload-bar float-right">
4747
<span class="btn btn-success fileinput-button">
48-
<i class="fas fa-upload"></i>
48+
<i class="cil-data-transfer-up"></i>
4949
<span>Upload images</span>
5050
<input id="uploadEditorImages" type="file" name="editorImage" multiple>
5151
</span>
5252
<span class="btn btn-success fileinput-button">
53-
<i class="fas fa-upload"></i>
53+
<i class="cil-data-transfer-up"></i>
5454
<span>Upload files</span>
5555
<input id="uploadEditorFiles" type="file" name="editorFile" multiple>
5656
</span>
5757
</div>
5858
</div>
5959
</div>
6060
<div class="col-xl-2">
61-
<div class="form-group">
61+
<div class="form-group mb-3">
6262
<h5>Header preview</h5>
6363
<div class="header-preview">
6464
@if (!string.IsNullOrWhiteSpace(Model.HeaderImage))
@@ -70,20 +70,20 @@
7070

7171
<div class="upload-bar">
7272
<span class="btn btn-success fileinput-button">
73-
<i class="fas fa-upload"></i> Upload
73+
<i class="cil-data-transfer-up"></i> Upload
7474
<input id="uploadHeadImage" type="file" name="files">
7575
</span>
76-
<button class="btn btn-outline-danger" id="removeHeadImage"><i class="fas fa-trash-alt"></i> Remove</button>
76+
<button class="btn btn-outline-danger" id="removeHeadImage"><i class="cil-trash"></i> Remove</button>
7777
<div id="progress">
7878
<div class="progress-bar" style="width: 0%;"></div>
7979
</div>
8080
</div>
8181
</div>
82-
<div class="form-group">
82+
<div class="form-group mb-3">
8383
<label asp-for="Status"></label>
8484
<select asp-for="Status" asp-items="Html.GetEnumSelectList<DocumentStatus>()" class="form-control"></select>
8585
</div>
86-
<div class="form-group">
86+
<div class="form-group mb-3">
8787
<label asp-for="PublishedOn"></label>
8888
@Html.EditorFor(m => m.PublishedOn, new { htmlAttributes = new { @class = "form-control", containerId = "published-on" } })
8989
</div>
@@ -92,7 +92,7 @@
9292
<div asp-validation-summary="All" class="text-danger"></div>
9393
</div>
9494
<div class="card-footer">
95-
<button type="submit" class="btn btn-primary"><i class="far fa-dot-circle"></i> Save</button>
95+
<button type="submit" class="btn btn-primary"><i class="cil-save"></i> Save</button>
9696
</div>
9797
</form>
9898
</div>

0 commit comments

Comments
 (0)