83 lines
3.6 KiB
Smarty
83 lines
3.6 KiB
Smarty
{* Заголовок окна *}
|
||
<h5 class="mb-3 text-primary">{#POLL_ADD_COMMENT#}</h5>
|
||
|
||
<div id="poll_comment_wrapper">
|
||
{if $cancomment != 1}
|
||
<div class="alert alert-warning border-0 shadow-sm">
|
||
<i class="bi bi-exclamation-triangle me-2"></i>
|
||
{#POLL_COMMENT_ERROR#}
|
||
</div>
|
||
<div class="mt-4">
|
||
<button type="button" class="btn btn-secondary w-100" onclick="window.close();">
|
||
<i class="bi bi-x-lg me-1"></i> {#POLL_CLOSE_W#}
|
||
</button>
|
||
</div>
|
||
{else}
|
||
<form id="poll_form_ajax" method="post" action="index.php?module=poll&action=comment&pid={$smarty.request.pid|escape}">
|
||
{if $errors}
|
||
<div class="alert alert-danger">
|
||
<ul class="mb-0">
|
||
{foreach from=$errors item=error}<li>{$error|escape}</li>{/foreach}
|
||
</ul>
|
||
</div>
|
||
{/if}
|
||
|
||
<div class="mb-3">
|
||
<label for="comment_title" class="form-label fw-bold text-muted small uppercase">{#POLL_COMMENT_T#}</label>
|
||
<input name="comment_title" type="text" id="comment_title" class="form-control shadow-sm" value="{$title|escape}" placeholder="Введите заголовок...">
|
||
</div>
|
||
|
||
<div class="mb-3">
|
||
<label for="comment_text" class="form-label fw-bold text-muted small">{#POLL_COMMENT_M#}</label>
|
||
<textarea id="comment_text" name="comment_text" class="form-control shadow-sm" rows="6" maxlength="{$max_chars}">{$text}</textarea>
|
||
<div class="form-text text-end small">
|
||
{#POLL_CHARSET_LEFT#}: <span id="charsLeft_new" class="fw-bold text-primary">{$max_chars}</span>
|
||
</div>
|
||
</div>
|
||
|
||
{if $anti_spam == 1}
|
||
<div class="card bg-light border-0 mb-3 shadow-sm">
|
||
<div class="card-body p-2 text-center">
|
||
<label class="form-label d-block small mb-2">{#POLL_SECURE_CODE#}</label>
|
||
<img src="{$ABS_PATH}inc/captcha.php" alt="captcha" class="rounded mb-2 border" style="cursor:pointer" onclick="this.src=this.src+'?'+Math.random();">
|
||
<input name="securecode" type="text" id="securecode" class="form-control form-control-sm text-center mx-auto" style="max-width: 150px;" placeholder="{#POLL_ENTER_CODE#}">
|
||
</div>
|
||
</div>
|
||
{/if}
|
||
|
||
<div class="d-grid gap-2 d-md-flex justify-content-md-end mt-4">
|
||
<button type="reset" class="btn btn-light border">{#POLL_BUTTON_RESET#}</button>
|
||
<button type="submit" class="btn btn-primary px-4 shadow">
|
||
<i class="bi bi-send-fill me-1"></i> {#POLL_BUTTON_ADD_C#}
|
||
</button>
|
||
</div>
|
||
</form>
|
||
{/if}
|
||
</div>
|
||
|
||
<script>
|
||
$(document).ready(function() {
|
||
// Счетчик символов
|
||
$('#comment_text').on('input', function() {
|
||
var limit = {$max_chars};
|
||
var length = $(this).val().length;
|
||
$('#charsLeft_new').text(limit - length);
|
||
});
|
||
|
||
// Валидация
|
||
$('#poll_form_ajax').on('submit', function() {
|
||
if ($('#comment_title').val().trim() == '') {
|
||
alert("{#POLL_ENTER_TITLE#}");
|
||
$('#comment_title').focus();
|
||
return false;
|
||
}
|
||
if ($('#comment_text').val().trim().length < 10) {
|
||
alert("{#POLL_ENTER_TEXT#}");
|
||
$('#comment_text').focus();
|
||
return false;
|
||
}
|
||
return true;
|
||
});
|
||
});
|
||
</script>
|