-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathCommentFormPartial.cshtml
More file actions
57 lines (54 loc) · 2.5 KB
/
CommentFormPartial.cshtml
File metadata and controls
57 lines (54 loc) · 2.5 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
@model cloudscribe.SimpleContent.Web.ViewModels.BlogViewModel
@using cloudscribe.SimpleContent.Models
@using cloudscribe.SimpleContent.Web
@inject IStringLocalizer<SimpleContent> sr
@{
var path = Url.Action("AjaxPostComment", "Blog");
var isAuthenticated = Context.User.Identity.IsAuthenticated;
var showRecaptcha = (!string.IsNullOrWhiteSpace(Model.ProjectSettings.RecaptchaPublicKey)) && !isAuthenticated;
}
<form id="commentform" asp-antiforgery="true" class="form-horizontal" data-blog-path="@path">
<fieldset>
<legend>@sr["Post comment"]</legend>
<div class="mb-3 row">
<label for="commentname" class="control-label col-sm-2">@sr["Name"]</label>
<div class="col-sm-7">
<input id="commentname" class="form-control" type="text" placeholder="Name" required />
</div>
</div>
<div class="mb-3 row">
<label for="commentemail" class="control-label col-sm-2">@sr["Email"]</label>
<div class="col-sm-7">
<input id="commentemail" class="form-control" type="email" placeholder="Email" required />
</div>
</div>
<div class="mb-3 row">
<label for="commenturl" class="control-label col-sm-2">@sr["Website"]</label>
<div class="col-sm-7">
<input id="commenturl" class="form-control" type="url" placeholder="Website URL" />
</div>
</div>
<div class="mb-3 row">
<label for="commentcontent" class="control-label col-sm-2">@sr["Comment (no HTML allowed)"]</label>
<div class="col-sm-10">
<textarea id="commentcontent" class="form-control" rows="4" placeholder="Comment" required></textarea>
</div>
</div>
@if (showRecaptcha)
{
<div class="mb-3">
<div class="col-md-offset-2 col-md-10">
<div class="g-recaptcha" data-sitekey="@Model.ProjectSettings.RecaptchaPublicKey"></div>
@Html.ValidationMessage("recaptchaerror", new { @class = "text-danger" })
</div>
</div>
}
<div class="mb-3 row">
<div class="col-sm-offset-2 col-sm-10">
<input name="postId2" type="hidden" value="@Model.CurrentPost.Id" />
<button class="btn btn-primary">@sr["Post comment"]</button>
<span id="status" class="alert" role="status" aria-live="polite"></span>
</div>
</div>
</fieldset>
</form>