Fogo
This commit is contained in:
@ -2,49 +2,46 @@
|
||||
@{
|
||||
ViewData["Title"]=Model.Title;
|
||||
}
|
||||
@section header {
|
||||
@section scripts {
|
||||
|
||||
<script src="~/js/comment.js" asp-append-version="true"></script>
|
||||
<script>
|
||||
$.psc.blogcomment.prototype.options.lang = '@System.Globalization.CultureInfo.CurrentUICulture.Name';
|
||||
$.psc.blogcomment.prototype.options.apictrlr = '@ViewData["apicmtctlr"]';
|
||||
$.psc.blogcomment.prototype.options.apictrlr = '/api/blogcomments/PostComment';
|
||||
$.psc.blogcomment.prototype.options.authorId = '@User.GetUserId()';
|
||||
$.psc.blogcomment.prototype.options.authorName = '@User.GetUserName()';
|
||||
$(document).ready(function() {
|
||||
$('#cmtBtn').click(function() {
|
||||
var receiverid = $(this).data('receiverid');
|
||||
var comment = $('#Comment').val();
|
||||
var data = {
|
||||
Id:0,
|
||||
Content: comment,
|
||||
PostId: receiverid,
|
||||
AuthorId: '@User.GetUserId()',
|
||||
Visible:true
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
async: true,
|
||||
cache: false,
|
||||
type: 'POST',
|
||||
method: 'POST',
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(data),
|
||||
data: JSON.stringify({
|
||||
Content: $('#Comment').val(),
|
||||
ReceiverId: @Model.Id
|
||||
}),
|
||||
error: function(xhr,data) {
|
||||
if (xhr.status=400)
|
||||
{
|
||||
$('span.field-validation-valid[data-valmsg-for="Content"]').html(
|
||||
if (xhr.responseJSON)
|
||||
{
|
||||
$('#commentValidation').html(
|
||||
xhr.responseJSON.Content);
|
||||
} else {
|
||||
$('span.field-validation-valid[data-valmsg-for="Content"]').html(
|
||||
} else {
|
||||
$('#commentValidation').html(
|
||||
"Une erreur est survenue : "+xhr.status+"<br/>"+
|
||||
"<code><pre>"+xhr.responseText+"</pre></code>"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
var comment = $('#Comment').val();
|
||||
$('#Comment').val('');
|
||||
$('span.field-validation-valid[data-valmsg-for="Content"]').empty();
|
||||
$('#commentValidation').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>';
|
||||
|
||||
@ -83,10 +80,12 @@ $('span.field-validation-valid[data-valmsg-for="Content"]').html(
|
||||
@if (User.GetUserId()!=null) {
|
||||
<div class="form-horizontal">
|
||||
<div class="input-group" >
|
||||
<input id="Comment" class="form-control" placeholder="DoCommentPlaceHolder"]"/>
|
||||
<input name="Comment" id="Comment" class="form-control" placeholder="DoCommentPlaceHolder"]"/>
|
||||
<span class="input-group-btn">
|
||||
<span id="commentValidation"></span>
|
||||
|
||||
<input type="button" value="DoComment"]" class="btn btn-secondary"
|
||||
data-receiverid="@Model.Id" id="cmtBtn"
|
||||
data-receiverId="@Model.Id" id="cmtBtn"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -33,9 +33,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="PostId" class="col-md-2 control-label"></label>
|
||||
<label asp-for="ReceiverId" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<select asp-for="PostId" class ="form-control"></select>
|
||||
<select asp-for="ReceiverId" class ="form-control"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -34,10 +34,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="PostId" class="control-label col-md-2">PostId</label>
|
||||
<label asp-for="ReceiverId" class="control-label col-md-2">ReceiverId</label>
|
||||
<div class="col-md-10">
|
||||
<select asp-for="PostId" class="form-control" ></select>
|
||||
<span asp-validation-for="PostId" class="text-danger"></span>
|
||||
<select asp-for="ReceiverId" class="form-control" ></select>
|
||||
<span asp-validation-for="ReceiverId" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -7,11 +7,14 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
|
||||
<link rel="icon" type="image/x-icon" href="~/favicon.ico" asp-append-version="true"/>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="~/favicon.ico" asp-append-version="true"/>
|
||||
<link rel="stylesheet" href="~/lib/jquery-ui/jquery-ui.min.css">
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" asp-append-version="true"/>
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true"/>
|
||||
<!-- #region jQuery Slim
|
||||
<script src="~/lib/jquery/dist/jquery.slim.min.js"></script> -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||
|
||||
<script src="~/lib/jquery-ui/external/jquery/jquery.js"></script>
|
||||
<script src="~/lib/jquery-ui/jquery-ui.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
@await RenderSectionAsync("header", false)
|
||||
</head>
|
||||
<body>
|
||||
@ -41,9 +44,9 @@
|
||||
© 2024 - Yavsc - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
@await RenderSectionAsync("scripts", false)
|
||||
|
||||
|
||||
@await RenderSectionAsync("scripts", false)
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user