-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathEdit.cshtml
More file actions
199 lines (178 loc) · 8.86 KB
/
Edit.cshtml
File metadata and controls
199 lines (178 loc) · 8.86 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
@model cloudscribe.SimpleContent.Web.ViewModels.PostEditViewModel
@inject IStringLocalizer<SimpleContent> sr
@inject IBlogRoutes blogRoutes
@{
var contentId = Model.Id;
if (string.IsNullOrWhiteSpace(contentId)) { contentId = "draft-post-" + DateTime.UtcNow.ToString("yyyy-MM-dd-hh"); }
}
@section Styles {
<partial name="EditStylesPartial" model="@Model" />
<link href="/cr/css/summernote-bs5.min.css" rel="stylesheet">
}
<h2>@ViewBag.Title</h2>
@if (!string.IsNullOrEmpty(Model.Id))
{
<a id="lnkHistory" href="@Url.RouteUrl(blogRoutes.PostHistoryRouteName, new { slug = Model.Slug })">@sr["Version History"]</a>
}
<partial name="EditHistoryInfoPartial" model="@Model" />
<form method="post" class="form-horizontal" role="form" asp-antiforgery="true" data-submit-once="true">
<input type="hidden" id="projectId" name="projectId" value="@Model.ProjectId" />
<input type="hidden" id="id" name="id" value="@Model.Id" />
<input type="hidden" asp-for="@Model.IsPublished" />
<input type="hidden" asp-for="@Model.HistoryId" />
<input type="hidden" asp-for="ContentType" />
@Html.ValidationMessage("postediterror", new { @class = "text-danger" })
<div class="mb-3">
<label asp-for="Title">@sr["Title"]</label>
<input asp-for="Title" class="form-control" />
<span asp-validation-for="Title" class="invalid-feedback"></span>
</div>
<partial name="EditCorrelationKeyPartial" model="@Model" />
<partial name="EditSlugPartial" model="@Model" />
<div class="mb-3">
<label asp-for="MetaDescription">@sr["Meta Description"]</label>
<input asp-for="MetaDescription" class="form-control" data-bs-toggle="tooltip" title='@sr["On public pages, meta description is very important to search engines. It should be no longer than 135 – 160 characters long (although Google has recently been testing longer snippets). Any longer and search engines will chop the end off, so make sure any important keywords are nearer the front."]' />
<span asp-validation-for="MetaDescription" class="invalid-feedback"></span>
</div>
<div class="mb-3">
<label asp-for="Content">@sr["Content"]</label>
@if (Model.ContentType == "markdown")
{
<partial name="EditContentMarkdownPartial" model="@Model" />
}
else
{
<partial name="EditContentHtmlPartial" model="@Model" />
}
<span asp-validation-for="Content" class="invalid-feedback"></span>
</div>
<div class="mb-3">
<label asp-for="Categories">@sr["Categories"]</label>
<input asp-for="Categories" class="form-control" />
<span asp-validation-for="Categories" class="invalid-feedback"></span>
</div>
<div class="mb-3">
<label asp-for="Author">@sr["Author"]</label>
<input asp-for="Author" class="form-control" />
<span asp-validation-for="Author" class="invalid-feedback"></span>
</div>
<partial name="EditImageUrlPartial" model="@Model" />
<div class="mb-3">
<div class="form-check">
<input asp-for="IsFeatured" class="form-check-input" />
<label asp-for="IsFeatured" class="form-check-label">@sr["Is Featured"]</label>
</div>
</div>
<div class="mb-3">
<div class="form-check">
<input asp-for="ShowComments" class="form-check-input" />
<label asp-for="ShowComments" class="form-check-label">@sr["Allow Comments"]</label>
</div>
</div>
@if (Model.TeasersEnabled)
{
if (Model.ContentType == "markdown")
{
<partial name="EditTeaserMarkdownPartial" model="@Model" />
}
else
{
<partial name="EditTeaserHtmlPartial" model="@Model" />
}
}
else
{
<partial name="EditTeaserDisabledPartial" />
}
<div class="row align-items-left">
<div class="mb-3 mt-1 col-3 w-auto">
<a class="btn btn-secondary" id="lnkCancel" href="@Model.CurrentPostUrl">@sr["Cancel"]</a>
@if (Model.IsPublished && Model.HasDraft)
{
<button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#confirmDeleteDraft">
@sr["Delete Draft"]
</button>
}
<button id="btnSaveDraft" name="SaveMode" value="@SaveMode.SaveDraft" type="submit" class="btn btn-primary" data-disabled-text='@sr["Working..."]' data-enabled-text='@sr["Save Draft"]'>@sr["Save Draft"]</button>
<button id="btnSavePublish" name="SaveMode" type="submit" value="@SaveMode.PublishNow" class="btn btn-primary" data-disabled-text='@sr["Working..."]' data-enabled-text='@sr["Publish Now"]'>@sr["Publish Now"]</button>
</div>
<div class="mb-3 mt-1 col-3 w-auto">
<div class="row align-items-left gx-1">
<div class="col-md-2 w-auto">
<button id="SaveMode" name="SaveMode" value="@SaveMode.PublishLater" type="submit" class="btn btn-primary" data-disabled-text='@sr["Working..."]' data-enabled-text='@sr["Publish at Date/Time:"]'>@sr["Publish at Date/Time:"]</button>
</div>
<div class="ms-0 col-md-3 w-auto">
<partial name="EditPubDate" model="@Model" />
</div>
</div>
</div>
<div class="mb-3 mt-1 col-3 w-auto">
@if (!string.IsNullOrEmpty(Model.Id))
{
<button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#confirmDeleteModal">
@sr["Delete"]
</button>
}
</div>
</div>
<div class="modal fade" id="confirmDeleteDraft" tabindex="-1" role="dialog" aria-labelledby="confirmDeleteDraftHeading" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="confirmDeleteDraftHeading">@sr["Confirm Delete Draft"]</h4>
<button type="button" data-bs-dismiss="modal" class="btn-close" aria-label='@sr["Close"]'></button>
</div>
<div class="modal-body">
@sr["Are you sure you want to delete the current draft version of this page?"]
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">@sr["Cancel"]</button>
<button id="btnDeleteCurrentDraft" name="SaveMode" value="@SaveMode.DeleteCurrentDraft" type="submit" class="btn btn-danger btn-ok" data-disabled-text='@sr["Working..."]' data-enabled-text='@sr["Delete Draft"]'>@sr["Delete Draft"]</button>
</div>
</div>
</div>
</div>
</form>
<partial name="EditDraftPubDatePartial" model="@Model" />
@if (!string.IsNullOrEmpty(Model.Id))
{
<form id="deleteform" class="form-inline" asp-route="@Model.DeletePostRouteName">
<input asp-for="Id" type="hidden" />
<div class="modal fade" id="confirmDeleteModal" tabindex="-1" role="dialog" aria-labelledby="confirmDeleteHeading">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="confirmDeleteHeading">@sr["Confirm Delete"]</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 delete the post {0}?"], Model.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["Delete"]' class="btn btn-danger btn-ok" />
</div>
</div>
</div>
</div>
</form>
}
<div class="modal fade" id="dateRequired" tabindex="-1" role="dialog" aria-labelledby="dateRequiredHeading">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="dateRequiredHeading">@sr["Date Required"]</h4>
<button type="button" data-bs-dismiss="modal" class="btn-close" aria-label='@sr["Close"]'></button>
</div>
<div class="modal-body">
@sr["To publish later you must enter a date."]
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">@sr["Ok"]</button>
</div>
</div>
</div>
</div>
@section Scripts {
<partial name="EditScriptsPartial" model="@Model" />
}