Comments
This commit is contained in:
parent
6dcbfbe63e
commit
8a0539be4d
39 changed files with 28108 additions and 155 deletions
|
|
@ -1,84 +0,0 @@
|
|||
@model BlogPost
|
||||
@{
|
||||
ViewData["Title"]=Model.Title;
|
||||
}
|
||||
<!--
|
||||
@section scripts {
|
||||
<script src="~/js/comment.js" asp-append-version="true"></script>
|
||||
<script>
|
||||
$(document).ready() {
|
||||
var doComment = new function(ctrlr, receiverid, comment) {
|
||||
console.log('commentting:' + comment);
|
||||
$.post(ctrlr, { Content: comment, Receiver: @Model.Id })
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
}
|
||||
-->
|
||||
<div class="container">
|
||||
<h1 class="blogtitle" ismarkdown>@Model.Title</h1>
|
||||
<img class="blogphoto" alt="" src="@Model.Photo" >
|
||||
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
|
||||
<div class="blogpost">
|
||||
|
||||
<div markdown="@Model.Content" class="blog"></div>
|
||||
<hr/>
|
||||
|
||||
<div class="meta">
|
||||
@Html.DisplayFor(model => model.Author)
|
||||
|
||||
@Html.DisplayNameFor(model => model.DateModified) :
|
||||
|
||||
@Html.DisplayFor(model => model.DateModified)
|
||||
|
||||
@Html.DisplayNameFor(model => model.DateCreated) :
|
||||
|
||||
@Html.DisplayFor(model => model.DateCreated)
|
||||
|
||||
@Component.Invoke("Tagger",Model)
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="comments">
|
||||
<!-- @foreach (var comment in model=>model.Comments) {
|
||||
<div markdown="@Model.Content" class="blogcomment">
|
||||
</div>
|
||||
<div markdown="@Model.Content" class="commentauthor">
|
||||
@Html.Display("ApplicationUser",c.Author)
|
||||
</div>
|
||||
}
|
||||
|
||||
<form>
|
||||
<div class="form-horizontal">
|
||||
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
|
||||
<div class="input-group" >
|
||||
<input asp-for="Content" class="form-control" placeholder="@SR["DoCommentPlaceHolder"]"/>
|
||||
<span class="input-group-btn">
|
||||
<input type="button" value="@SR["DoComment"]" class="btn btn-secondary"
|
||||
onclick="doComment('@ViewData["apictlr"]',@Model.PostId,$('#Content').val())"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<span asp-validation-for="Content" class="text-danger" >
|
||||
</span>
|
||||
|
||||
<input type="hidden" name="PostId" value="@Model.PostId"/>
|
||||
<input type="hidden" name="Id" value="@Model.Id"/>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
@if (await AuthorizationService.AuthorizeAsync(User, Model, new EditRequirement())) {
|
||||
<a asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-link">@SR["Edit"]</a>
|
||||
}
|
||||
<a asp-action="Index" class="btn btn-link">@SR["Back to List"]</a>
|
||||
|
|
@ -4,10 +4,11 @@
|
|||
}
|
||||
@section header {
|
||||
<script>
|
||||
$.psc.blogcomment.prototype.options.lang = '@System.Globalization.CultureInfo.CurrentUICulture.Name';
|
||||
$.psc.blogcomment.prototype.options.apictrlr = '@ViewData["apicmtctlr"]';
|
||||
$(document).ready(function() {
|
||||
$('#cmtBtn').click(function() {
|
||||
var receiverid = $(this).data('receiverid');
|
||||
|
||||
var comment = $('#Comment').val();
|
||||
var data = {
|
||||
Id:0,
|
||||
|
|
@ -16,8 +17,6 @@
|
|||
UserCreated: '@User.GetUserId()',
|
||||
Visible:true
|
||||
};
|
||||
console.log('sending:');
|
||||
console.log(data);
|
||||
|
||||
$.ajax({
|
||||
async: true,
|
||||
|
|
@ -29,7 +28,6 @@
|
|||
error: function(xhr,data) {
|
||||
if (xhr.status=400)
|
||||
{
|
||||
console.log(xhr.responseJSON);
|
||||
$('span.field-validation-valid[data-valmsg-for="Content"]').html(
|
||||
xhr.responseJSON.Content);
|
||||
} else {
|
||||
|
|
@ -40,15 +38,25 @@ $('span.field-validation-valid[data-valmsg-for="Content"]').html(
|
|||
}
|
||||
|
||||
},
|
||||
success: function () {
|
||||
$('#Comment').val("");
|
||||
success: function (data) {
|
||||
var comment = $('#Comment').val();
|
||||
$('#Comment').val('');
|
||||
$('span.field-validation-valid[data-valmsg-for="Content"]').empty();
|
||||
var htmlcmt = htmlize(comment);
|
||||
var nnode = '<div data-type="blogcomment" data-id="'+data.Id+'" data-allow-edit="True" data-allow-moderate="@ViewData["moderatoFlag"]" data-date="'+data.DateCreated+'" data-username="@User.GetUserName()">'+htmlcmt+'</div>';
|
||||
|
||||
$('#comments').append($(nnode).blogcomment())
|
||||
},
|
||||
url:'@ViewData["apicmtctlr"]'
|
||||
});
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
.avatar, .commentmeta, .blogcomment p , .blogcomment {
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
<div class="container">
|
||||
<h1 class="blogtitle" ismarkdown>@Model.Title</h1>
|
||||
|
|
@ -71,21 +79,15 @@ $('span.field-validation-valid[data-valmsg-for="Content"]').html(
|
|||
|
||||
@Component.Invoke("Tagger",Model)
|
||||
</div>
|
||||
@if (Model.Comments.Count>0) {
|
||||
<div class="comments">
|
||||
@foreach (Comment comment in Model.Comments) {
|
||||
<div class="blogcomment" >
|
||||
|
||||
<div class="commentmeta" style="display: inline-block">
|
||||
@Html.DisplayFor(c=>c.Author,"ApplicationUserLink","cmtauth",comment)
|
||||
<div><i>@Html.DisplayFor(c=>c.DateCreated,null,"dteCmt",comment)</i></div>
|
||||
</div>
|
||||
<div markdown="@comment.Content" style="display: inline-block;">
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<form>
|
||||
<div id="comments">
|
||||
@if (Model.Comments.Count>0) { foreach (Comment comment in Model.Comments) {
|
||||
<div data-type="blogcomment" data-id="@comment.Id" data-allow-edit="@(User.GetUserId()==comment.UserCreated?"true":"false")" data-allow-moderate="@ViewData["moderatoFlag"]"
|
||||
data-date="@Html.Raw(comment.DateCreated)" data-username="@comment.Author.UserName" markdown="@comment.Content"
|
||||
>
|
||||
</div>
|
||||
} }
|
||||
</div>
|
||||
<div class="form-horizontal">
|
||||
<div class="input-group" >
|
||||
<input id="Comment" class="form-control" placeholder="@SR["DoCommentPlaceHolder"]"/>
|
||||
|
|
@ -95,12 +97,8 @@ $('span.field-validation-valid[data-valmsg-for="Content"]').html(
|
|||
/>
|
||||
</span>
|
||||
</div>
|
||||
<span asp-validation-for="Content" class="text-danger" >
|
||||
</span>
|
||||
<span asp-validation-for="Content" class="text-danger" ></span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@if (await AuthorizationService.AuthorizeAsync(User, Model, new EditRequirement())) {
|
||||
<a asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-link">@SR["Edit"]</a>
|
||||
|
|
|
|||
|
|
@ -34,9 +34,7 @@
|
|||
</style>
|
||||
<script src="~/js/dropzone.js"></script>
|
||||
<script src="~/js/quill.js"></script>
|
||||
<script src="~/js/showdown.js"></script>
|
||||
<script src="~/js/to-markdown.js"></script>
|
||||
<script src="~/js/md-helpers.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(".mdcoding").addClass('hidden');
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@
|
|||
.collapsed {
|
||||
height: 1em;
|
||||
}
|
||||
.sametitlegrip {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
.sametitle {
|
||||
overflow: hidden;
|
||||
transition: height 1s;
|
||||
|
|
@ -17,8 +21,8 @@
|
|||
td {
|
||||
transition: height 1s;
|
||||
}
|
||||
[class*="col-"] {
|
||||
border: solid 1px blue;
|
||||
div.row {
|
||||
border-bottom: dashed black 1px;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
|
@ -101,7 +105,8 @@
|
|||
long gcount = group.Count();
|
||||
@if (gcount>1) {
|
||||
<div class="sametitle">
|
||||
@(gcount-1) autre@(gcount>2?"s":"") au même titre:
|
||||
<div class="sametitlegrip">@(gcount-1) autre@(gcount>2?"s":"") au même titre:</div>
|
||||
|
||||
|
||||
@foreach (var item in group.Skip(1)) {
|
||||
trclass = ((item.Visible)?"visiblepost":"hiddenpost");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue