Skip to content

Commit 4c4771d

Browse files
authored
Merge pull request #615 from cloudscribe/feature/549
#549 altering the list links render to use bootstrap 5 styling and co…
2 parents a1550a0 + 92a78a0 commit 4c4771d

6 files changed

Lines changed: 43 additions & 65 deletions

File tree

src/cloudscribe.SimpleContent.ContentTemplates.Bootstrap5/Views/Shared/LinksRenderPartial.cshtml

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,48 @@
44
@using cloudscribe.SimpleContent.ContentTemplates.ViewModels
55
@inject IStringLocalizer<ContentTemplateResources> sr
66
@inject ILinkListOptionsProvider optionsProvider
7+
@inject IOptions<IconCssClasses> iconClassesAccessor
8+
79
@{
8-
10+
var icons = iconClassesAccessor.Value;
911
var sorted = Model.Items.OrderBy(x => x.Sort).ToList();
1012
var options = await optionsProvider.ResolveLinkListOptions(Context.Request.Host.Host, Context.Request.Path);
1113
var imageStyle = "height:" + options.ImageRenderMaxHeight.ToString() + "px;";
1214
}
1315
@functions {
14-
public string GetTarget(ListItemModel item)
15-
{
16-
if (item.OpensInNewWindow) { return "_blank"; }
17-
return null;
18-
}
16+
public string GetTarget(ListItemModel item)
17+
{
18+
if (item.OpensInNewWindow) { return "_blank"; }
19+
return null;
20+
}
1921
}
2022
<div class="content-top">
2123
@Html.Raw(Model.ContentAbove)
2224
</div>
23-
<div class="links-wrap">
25+
<ul class="list-group">
2426
@for (int i = 0; i < Model.Items.Count; i++)
2527
{
26-
<div class="clearfix linklist-item">
27-
<h2 class="h4"><a href="@sorted[i].LinkUrl" target="@GetTarget(sorted[i])">@sorted[i].Title</a></h2>
28-
29-
@if (!string.IsNullOrWhiteSpace(sorted[i].ResizedUrl))
30-
{
31-
<a target="@GetTarget(sorted[i])" href="@sorted[i].LinkUrl">
32-
<img class="float-start me-2" src="@sorted[i].ResizedUrl" style="@imageStyle" alt="@sorted[i].AltText" />
33-
</a>
34-
}
35-
<p class="linklist-item-description">@sorted[i].Description</p>
36-
</div>
28+
<li class="list-group-item d-flex justify-content-between align-items-start flex-column">
29+
<div>
30+
<h4 class="d-flex align-items-start"><a href="@sorted[i].LinkUrl" target="@GetTarget(sorted[i])">@sorted[i].Title</a>
31+
@if (GetTarget(sorted[i]) == "_blank")
32+
{
33+
<span class="@icons.OpenInNewWindow ms-2 fs-6" aria-hidden="true"></span>
34+
}
35+
</h4>
36+
</div>
37+
<div class="d-flex me-auto">
38+
@if (!string.IsNullOrWhiteSpace(sorted[i].ResizedUrl))
39+
{
40+
<a target="@GetTarget(sorted[i])" href="@sorted[i].LinkUrl">
41+
<img class="flex-start me-2" src="@sorted[i].ResizedUrl" style="@imageStyle" alt="@sorted[i].AltText" />
42+
</a>
43+
}
44+
<p class="list-group-item-description">@sorted[i].Description</p>
45+
</div>
46+
</li>
3747
}
38-
</div>
48+
</ul>
3949
<div class="mt-3 content-bottom">
4050
@Html.Raw(Model.ContentBelow)
4151
</div>

src/cloudscribe.SimpleContent.ContentTemplates.Bootstrap5/cloudscribe.SimpleContent.ContentTemplates.Bootstrap5.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<Description>A set of Content Templates for cloudscribe.SimpleContent using Bootstrap 5</Description>
5-
<Version>8.1.0</Version>
5+
<Version>8.1.1</Version>
66
<TargetFramework>net8.0</TargetFramework>
77
<Authors>Joe Audette</Authors>
88
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>

src/cloudscribe.SimpleContent.Web/Design/IconCssClasses.cs

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ public class IconCssClasses
2525

2626
public string Home { get; set; } = "glyphicons glyphicons-home";
2727

28-
//public string HideEditToolbar { get; set; } = "glyphicon glyphicon-chevron-right";
29-
3028
public string ShowEditToolbar { get; set; } = "glyphicon glyphicon-pencil";
3129

3230
public string NewItem { get; set; } = "glyphicon glyphicon-plus";
@@ -44,37 +42,6 @@ public class IconCssClasses
4442
public string Unpublish { get; set; } = "glyphicon glyphicon-eye-close";
4543

4644
public string RelatedPosts { get; set; } = "far fa-hand-point-right"; //"fas fa-asterisk";
47-
48-
//<i class="far fa-hand-point-right"></i>
49-
50-
51-
52-
// public string JustifyLeft { get; set; } = "glyphicon glyphicon-align-left";
53-
54-
//public string JustifyCenter { get; set; } = "glyphicon glyphicon-align-center";
55-
56-
//public string JustifyRight { get; set; } = "glyphicon glyphicon-align-right";
57-
58-
//public string JustifyFull { get; set; } = "glyphicon glyphicon-align-justify";
59-
60-
//public string UnorderedList { get; set; } = "glyphicon glyphicon-list";
61-
62-
//public string OrderedList { get; set; } = "glyphicon glyphicon-th-list";
63-
64-
//public string Outdent { get; set; } = "glyphicon glyphicon-indent-left";
65-
66-
//public string Indent { get; set; } = "glyphicon glyphicon-indent-right";
67-
68-
//public string Hyperlink { get; set; } = "glyphicon glyphicon-globe";
69-
70-
//public string RemoveHyperlink { get; set; } = "glyphicon glyphicon-remove";
71-
72-
//public string InsertImage { get; set; } = "glyphicon glyphicon-picture";
73-
74-
//public string ToggleSource { get; set; } = "glyphicon glyphicon-eye-open";
75-
76-
//public string ClearAllFormatting { get; set; } = "glyphicon glyphicon-fire";
77-
78-
45+
public string OpenInNewWindow { get; set; } = "fas fa-external-link-alt";
7946
}
8047
}

src/sourceDev.WebApp/appsettings.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
"SimpleContentIconConfig": {
166166
"DefaultSetId": "fontawesome5x",
167167
"IconSets": [
168-
{
168+
{
169169
"SetId": "fontawesome4x",
170170
"Previous": "fa fa-backward",
171171
"Next": "fa fa-forward",
@@ -185,10 +185,10 @@
185185
"SortAlpha": "fa fa-sort-alpha-asc",
186186
"Edit": "fa-pencil-square-o",
187187
"View": "fa fa-eye",
188-
"Delete": "fa fa-trash-o"
189-
190-
},
191-
{
188+
"Delete": "fa fa-trash-o",
189+
"OpenInNewWindow": "fa fa-external-link"
190+
},
191+
{
192192
"SetId": "fontawesome5x",
193193
"Previous": "fas fa-backward",
194194
"Next": "fas fa-forward",
@@ -209,9 +209,9 @@
209209
"Edit": "fas fa-pencil-alt",
210210
"View": "fas fa-eye",
211211
"Delete": "far fa-trash-alt",
212-
"Unpublish": "far fa-eye-slash"
213-
214-
},
212+
"Unpublish": "far fa-eye-slash",
213+
"OpenInNewWindow": "fas fa-external-link-alt"
214+
},
215215
{
216216
"SetId": "glyphicons",
217217
"Previous": "glyphicon glyphicon-backward",
@@ -233,8 +233,8 @@
233233
"Edit": "glyphicon glyphicon-edit",
234234
"View": "glyphicon glyphicon-eye-open",
235235
"Delete": "glyphicon glyphicon-trash",
236-
"Unpublish": "glyphicon glyphicon-eye-close"
237-
236+
"Unpublish": "glyphicon glyphicon-eye-close",
237+
"OpenInNewWindow": "glyphicon glyphicon-square-new-window"
238238
}
239239

240240
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Id":"list-of-links","ProjectId":"f83067b4-919d-4910-acd1-4b3b1c210ecf","ParentId":"0","ParentSlug":"","PageOrder":3,"Title":"list of links","Author":"Admin","Slug":"list-of-links","ExternalUrl":"","CorrelationKey":null,"MetaDescription":null,"MetaJson":null,"MetaHtml":null,"Content":"\r\n<div class=\"content-top\">\r\n \r\n</div>\r\n<ul class=\"list-group\">\r\n <li class=\"list-group-item d-flex justify-content-between align-items-start flex-column\">\r\n <div class=\"ms-2\">\r\n <h4 class=\"d-flex align-items-start\"><a href=\"https://www.google.com\" target=\"_blank\">link 1</a> \r\n <span class=\"fas fa-external-link-alt ms-2 fs-6\" aria-hidden=\"true\"></span>\r\n </h4>\r\n </div>\r\n <div class=\"ms-2 d-flex me-auto\">\r\n <a target=\"_blank\" href=\"https://www.google.com\">\r\n <img class=\"flex-start me-2\" src=\"/media/images/img_1150-ws.jpg\" style=\"height:150px;\" />\r\n </a>\r\n <p>google.com</p>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item d-flex justify-content-between align-items-start flex-column\">\r\n <div class=\"ms-2\">\r\n <h4 class=\"d-flex align-items-start\"><a href=\"https://www.bbc.co.cuk\">link 2</a> \r\n </h4>\r\n </div>\r\n <div class=\"ms-2 d-flex me-auto\">\r\n <p>bbc</p>\r\n </div>\r\n </li>\r\n</ul>\r\n<div class=\"mt-3 content-bottom\">\r\n \r\n</div>\r\n\r\n","PubDate":"2024-12-11T14:21:11.7769023Z","LastModified":"2024-12-11T15:56:20.243055Z","IsPublished":true,"MenuOnly":false,"ShowMenu":false,"ViewRoles":null,"Categories":[],"Comments":[],"ShowHeading":true,"ShowPubDate":false,"ShowLastModified":false,"ShowCategories":false,"ShowComments":false,"MenuFilters":null,"DisableEditor":false,"Resources":[],"ContentType":"html","CreatedUtc":"2024-12-11T14:19:46.3814172Z","CreatedByUser":"admin","LastModifiedByUser":"admin","DraftContent":null,"DraftAuthor":null,"DraftPubDate":null,"TemplateKey":"sct-ListOfLinks","SerializedModel":"{\"ContentAbove\":null,\"ContentBelow\":null,\"Items\":[{\"FullSizeUrl\":null,\"ResizedUrl\":\"/media/images/img_1150-ws.jpg\",\"ThumbnailUrl\":null,\"LinkUrl\":\"https://www.google.com\",\"Title\":\"link 1\",\"Description\":\"google.com\",\"AltText\":null,\"Sort\":1,\"OpensInNewWindow\":true},{\"FullSizeUrl\":null,\"ResizedUrl\":null,\"ThumbnailUrl\":null,\"LinkUrl\":\"https://www.bbc.co.cuk\",\"Title\":\"link 2\",\"Description\":\"bbc\",\"AltText\":null,\"Sort\":3,\"OpensInNewWindow\":false}]}","DraftSerializedModel":null,"Serializer":"Json","ShowCreatedBy":null,"ShowCreatedDate":null,"ShowLastModifiedBy":null,"ShowLastModifiedDate":null}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"AuthorBio":"","Comment":"","NormalizedEmail":"ADMIN@ADMIN.COM","NormalizedUserName":"ADMIN","EmailConfirmed":true,"EmailConfirmSentUtc":null,"AgreementAcceptedUtc":null,"LockoutEndDateUtc":null,"NewEmail":"","NewEmailApproved":false,"LastPasswordChangeUtc":"2024-06-03T14:17:55.2771124Z","MustChangePwd":false,"PasswordHash":"AQAAAAIAAYagAAAAEGVnALS6pFN3EERYv0nYhCQ4jy0t3WB+uYVRUM40L55rqYdKv3yw1MmjWvEYd6x2Pw==","CanAutoLockout":true,"AccessFailedCount":0,"RolesChanged":false,"SecurityStamp":"S7ZJ6RCVYLDHBWTECX2S2GQXJKWUXNSL","Signature":"","TwoFactorEnabled":false,"BrowserKey":"73126636-c1ad-47c8-8f1d-9f229911e67a","Id":"17595de8-d27a-4304-bded-76b61a16ad19","SiteId":"f83067b4-919d-4910-acd1-4b3b1c210ecf","Email":"admin@admin.com","UserName":"admin","DisplayName":"Admin","FirstName":"","LastName":"","AvatarUrl":"","DateOfBirth":null,"CreatedUtc":"2016-08-04T12:03:50.2175089Z","LastModifiedUtc":"2016-08-04T12:03:50.2175089Z","DisplayInMemberList":true,"Gender":"","IsLockedOut":false,"LastLoginUtc":"2024-12-13T08:41:39.832239Z","PhoneNumber":"","PhoneNumberConfirmed":false,"AccountApproved":true,"TimeZoneId":"","WebSiteUrl":""}
1+
{"AuthorBio":"","Comment":"","NormalizedEmail":"ADMIN@ADMIN.COM","NormalizedUserName":"ADMIN","EmailConfirmed":true,"EmailConfirmSentUtc":null,"AgreementAcceptedUtc":null,"LockoutEndDateUtc":null,"NewEmail":"","NewEmailApproved":false,"LastPasswordChangeUtc":"2024-06-03T14:17:55.2771124Z","MustChangePwd":false,"PasswordHash":"AQAAAAIAAYagAAAAEGVnALS6pFN3EERYv0nYhCQ4jy0t3WB+uYVRUM40L55rqYdKv3yw1MmjWvEYd6x2Pw==","CanAutoLockout":true,"AccessFailedCount":0,"RolesChanged":false,"SecurityStamp":"S7ZJ6RCVYLDHBWTECX2S2GQXJKWUXNSL","Signature":"","TwoFactorEnabled":false,"BrowserKey":"a1490bf5-7bc0-4c51-8781-50e43a7f2698","Id":"17595de8-d27a-4304-bded-76b61a16ad19","SiteId":"f83067b4-919d-4910-acd1-4b3b1c210ecf","Email":"admin@admin.com","UserName":"admin","DisplayName":"Admin","FirstName":"","LastName":"","AvatarUrl":"","DateOfBirth":null,"CreatedUtc":"2016-08-04T12:03:50.2175089Z","LastModifiedUtc":"2016-08-04T12:03:50.2175089Z","DisplayInMemberList":true,"Gender":"","IsLockedOut":false,"LastLoginUtc":"2024-12-11T14:19:23.5104068Z","PhoneNumber":"","PhoneNumberConfirmed":false,"AccountApproved":true,"TimeZoneId":"","WebSiteUrl":""}

0 commit comments

Comments
 (0)