-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathPostDetailPartial.cshtml
More file actions
131 lines (129 loc) · 6.19 KB
/
PostDetailPartial.cshtml
File metadata and controls
131 lines (129 loc) · 6.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
@using cloudscribe.SimpleContent.Web
@using cloudscribe.SimpleContent.Models
@using Microsoft.AspNetCore.Mvc.ViewFeatures
@model cloudscribe.SimpleContent.Web.ViewModels.BlogViewModel
@using cloudscribe.SimpleContent.Web.Design
@using Microsoft.Extensions.Options
@using Microsoft.Extensions.Localization
@using System.Globalization
@inject IStringLocalizer<SimpleContent> sr
@inject ISimpleContentThemeHelper themeHelper
@{
var themeSettings = themeHelper.GetThemeSettings();
}
@functions{
public string GetPubDateClass()
{
if (Model.CurrentPost != null && Model.CurrentPost.PubDate > DateTime.UtcNow) return "lead text-danger";
return null;
}
}
<article class="post" data-id="@Model.CurrentPost.Id"
data-approve-comment-url="@Url.Action("AjaxApproveComment", "Blog")"
data-delete-comment-url="@Url.Action("AjaxDeleteComment", "Blog")"
itemscope itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
<partial name="DraftInfoPartial" model="@Model" />
<partial name="HistoryInfoPartial" model="@Model" />
<header class="jumbotron">
@if (Model.ProjectSettings.ShowTitle)
{
<h1 itemprop="headline name">@Model.CurrentPost.Title</h1>
}
else
{
<h1 itemprop="headline name">@Model.CurrentPost.Title</h1>
}
<div class="bh">
@{
DateTime? pubDate = Model.CurrentPost.PubDate;
if (!pubDate.HasValue) { pubDate = DateTime.UtcNow; }
}
<time class="@GetPubDateClass()" datetime='@pubDate.Value.ToString("s")' itemprop="datePublished">@Model.FormatDate(pubDate.Value)</time>
@if (Model.ShowComments)
{
<partial name="CommentLinkDetail" model="@Model" />
}
@if (Model.CurrentPost.Categories.Count > 0)
{
<ul class="categories">
<li><i class="@themeSettings.Icons.Tags"></i> @sr["Posted in:"] </li>
@foreach (string cat in Model.CurrentPost.Categories)
{
<li itemprop="articleSection">
<a asp-controller="Blog" asp-action="Category" asp-route-category="@cat">@cat</a>
</li>
}
</ul>
}
</div>
</header>
<partial name="NextPreviousPartial" model="@Model" />
<partial name="PostContentBodyPartial" model="@Model" />
@{
var imageUrl = Model.ExtractFirstImageUrl(Model.CurrentPost, Url);
var imageSize = Model.ExtractFirstImageDimensions(Model.CurrentPost);
}
@if (!string.IsNullOrEmpty(imageUrl))
{
<div class="collapse" aria-hidden="true" itemprop="image" itemscope itemtype="http://schema.org/ImageObject">
<schema-org-meta itemprop="url" content="@imageUrl"></schema-org-meta>
<schema-org-meta itemprop="width" content="@imageSize.Width"></schema-org-meta>
<schema-org-meta itemprop="height" content="@imageSize.Height"></schema-org-meta>
</div>
}
@if (!string.IsNullOrEmpty(Model.CurrentPost.Author))
{
<div class="collapse" aria-hidden="true" itemprop="author" itemscope itemtype="http://schema.org/Person">
<schema-org-meta itemprop="name" content="@Model.CurrentPost.Author"></schema-org-meta>
</div>
}
@if (!string.IsNullOrEmpty(Model.ProjectSettings.Publisher))
{
<div class="collapse" aria-hidden="true" itemprop="publisher" itemscope itemtype="http://schema.org/@Model.ProjectSettings.PublisherEntityType">
<schema-org-meta itemprop="name" content="@Model.ProjectSettings.Publisher"></schema-org-meta>
<div class="collapse" aria-hidden="true" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
<schema-org-meta itemprop="url" content="@Model.ProjectSettings.PublisherLogoUrl"></schema-org-meta>
<schema-org-meta itemprop="width" content="@Model.ProjectSettings.PublisherLogoWidth"></schema-org-meta>
<schema-org-meta itemprop="height" content="@Model.ProjectSettings.PublisherLogoHeight"></schema-org-meta>
</div>
</div>
}
@if (Model.CurrentPost.PubDate.HasValue)
{
<schema-org-meta itemprop="dateModified" content="@Model.CurrentPost.PubDate.Value.ToString("s", CultureInfo.InvariantCulture)"></schema-org-meta>
}
@if (Model.CurrentPost.IsPublished && !Model.ShowingDraft && !Model.HistoryId.HasValue)
{
@if (string.IsNullOrEmpty(Model.ProjectSettings.DisqusShortName))
{
<partial name="CommentWrapperPartial" model="@Model" />
}
else
{
<partial name="DisqusCommentsPartial" model="@Model" />
}
}
</article>
@if (Model.CurrentPost != null && Model.CanEdit && !Model.ShowingDeleted && !Model.ShowingDraft && !Model.HistoryId.HasValue && Model.CurrentPost.IsPublished)
{
<form id="unpubform" class="form-inline" asp-controller="Blog" asp-action="UnPublish" method="post">
<input name="id" value="@Model.CurrentPost.Id" type="hidden" />
<div class="modal fade" id="confirmUnpublishModal" tabindex="-1" role="dialog" aria-labelledby="confirmUnpublishHeading">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="confirmUnpublishHeading">@sr["Confirm Unpublish"]</h4>
<button type="button" data-bs-dismiss="modal" class="btn-close" aria-label='@sr["Close"]'></button>
</div>
<div class="modal-body">
@string.Format(sr["Are you sure you want to unpublish the post {0}?"], Model.CurrentPost.Title)
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">@sr["Cancel"]</button>
<input type="submit" value='@sr["Unpublish"]' class="btn btn-danger btn-ok" />
</div>
</div>
</div>
</div>
</form>
}