#199 trying to send comments from BNumPartial

This commit is contained in:
Hamid Reza Mohammadi 2021-09-04 20:22:52 +04:30
parent 06a8b6b403
commit 729c6997b3
5 changed files with 29 additions and 31 deletions

View File

@ -164,8 +164,8 @@
window.open(macagna, '_blank', 'width=600,height=700,scrollbars=yes,status=yes');
}
function postComment(parent) {
$("#commentform").unbind('submit').bind('submit', function (e) {
function postComment(parent, commentformSelector, commentErrorSelector) {
$(commentformSelector).unbind('submit').bind('submit', function (e) {
e.preventDefault(); // avoid to execute the actual submit of the form.
@ -180,7 +180,7 @@
data: form.serialize(), // serializes the form's elements.
success: function (data) {
$(data).appendTo(parent);
$("#commentform")[0].reset();
$(commentErrorSelector)[0].reset();
},
});

View File

@ -1,12 +1,27 @@
@model GanjooRazor.Pages._BNumPartialModel
@{
}
<div id="comments-block-@Model.CoupletIndex">
</div>
@if (Model.LoggedIn)
{
<form method="post" action="?handler=Comment">
<script src="/lib/tinymce/tinymce.min.js"></script>
<script>
tinymce.init({
selector: 'textarea.editor',
language: 'fa_IR',
menubar: false,
plugins: 'link paste',
toolbar: 'undo redo | alignleft aligncenter alignright alignjustify | outdent indent | link',
paste_auto_cleanup_on_paste: true,
paste_remove_styles: true,
paste_remove_styles_if_webkit: true,
paste_strip_class_attributes: true,
});
</script>
<form method="post" id="commentform-@Model.CoupletIndex" action="?handler=Comment">
<fieldset>
<legend>💬 دربارهٔ این پاراگراف/بیت/مصرع حاشیه‌بگذارید ...</legend>
<legend>💬 دربارهٔ این پاراگراف/بیت/مصرع حاشیه بگذارید ...</legend>
<table style="max-width:100%; width:100%; margin:0">
<tr>
<td>
@ -19,29 +34,16 @@
</tr>
<tr>
<td>
<button name="postcomment" class="inputSubmit" onclick="return postComment(document.getElementById('comments-block'));" style="width:100%">درج حاشیه</button>
<button name="postcomment" class="inputSubmit" onclick="return postComment(document.getElementById('comments-block-@Model.CoupletIndex'), '#commentform-@Model.CoupletIndex', '#comment-error-@Model.CoupletIndex');" style="width:100%">درج حاشیه</button>
</td>
</tr>
</table>
<div class="notice">
<p>
لطفاً توجه داشته باشید که حاشیه‌ها برای ثبت نظرات شما راجع به <strong>همین شعر</strong> در نظر گرفته شده‌اند. در صورتی که در متن ثبت شدهٔ شعر در گنجور تفاوتهایی غیر از موارد قابل ویرایش یافتید، در مورد این شعر نظر یا احساس خاصی دارید یا مطلب خاصی در مورد آن می‌دانید یا دوست دارید دربارهٔ آن از دیگران چیزی بپرسید یک حاشیه برای آن بنویسید. <span style="color:#f00">لطفاً از درج مطالب غیرمرتبط با متن این شعر خاص خودداری فرمایید</span> و حتی‌الامکان سعی کنید متن حاشیهٔ خود را با حروف فارسی درج کنید (حاشیه‌ها بازبینی خواهند شد و موارد غیرمرتبط و ناقض این نکات حذف می‌شوند).
</p>
<p>
<span style="color:#f00">بحثهای مذهبی و اعتقادی و ارجاع توهین‌آمیز نسبت به بزرگان ادیان و همینطور بحثهای قومیتی و توهین به فرهنگها و قومیتها و زبانها و بحثهای مرتبط با سیاست روز از مصادیق حاشیه‌های نامناسب محسوب می‌شوند.</span> لطفاً از هیچ قوم و مذهبی با صفات زننده صحبت نکنید و به خاطر داشته باشید که همهٔ اقوام (حتی ایرانی‌ها) در مقاطعی از تاریخ خود نسبت به اقوام دیگر بدوی محسوب می‌شده‌اند یا با تعدی به خاک همسایگان خود نسبت به آنها ستم روا داشته‌اند.
</p>
<p>
در خطاب قرار دادن کاربران دیگر -چه به شکل خاص و چه به شکل عمومی- فارغ از این که در حاشیه‌هایشان نظرات معقولی را عنوان کرده‌اند یا خیر، رعایت احترام را بفرمایید. بی‌احترامی به دیگر کاربران (و البته شخصیتهای دیگر از جمله هنرمندان و ...) از مصادیق حاشیه‌های نامناسب محسوب می‌شود و فارغ از ارزش محتوایی، حاشیهٔ فرد خاطی به محض دریافت گزارش تخلف حذف خواهد شد.
</p>
<p>
<span style="color:#0a0">لطفاً در صورتی که تفاوتها را با استناد به نسخه‌های چاپی یا خطی گزارش می‌کنید این مسئله را با ذکر منبع مطرح نمایید. اشتباهات تایپی و غلطهای املایی را از طریق دکمهٔ «ویرایش» تصحیح کنید.</span>
</p>
</div>
</fieldset>
</form>
<div class="item" id="comment-error-@Model.CoupletIndex">
</div>
}
else
{
@ -51,3 +53,4 @@ else
</p>
</div>
}

View File

@ -1,8 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace GanjooRazor.Pages

View File

@ -419,7 +419,7 @@
</tr>
<tr>
<td>
<button name="postcomment" id="postcomment" class="inputSubmit" onclick="return postComment(document.getElementById('comments-block'));" style="width:100%">درج حاشیه</button>
<button name="postcomment" id="postcomment" class="inputSubmit" onclick="return postComment(document.getElementById('comments-block'), '#commentform', '#comment-error');" style="width:100%">درج حاشیه</button>
</td>
</tr>
</table>

View File

@ -8,8 +8,8 @@
},
"AllowedHosts": "*",
"GoogleAnalyticsCode": "",
"APIRoot": "https://ganjgah.ir",
"GlobalAPIRoot": "https://ganjgah.ir",
"APIRoot": "http://localhost:3439",
"GlobalAPIRoot": "http://localhost:3439",
"SiteUrl": "http://localhost:33081",
"ReadOnlyMode": "False"
}