new wall's textarea

This commit is contained in:
veselcraft 2020-12-25 17:57:44 -05:00
parent 522c221967
commit c07576188d
3 changed files with 68 additions and 57 deletions

View file

@ -1,59 +1,57 @@
<div class="content_divider"> <div class="content_divider">
<div class="content_title_expanded" onclick="hidePanel(this, {$count});"> <div class="content_title_expanded" onclick="hidePanel(this, {$count});">
{_"wall"} {_"wall"} <nobold>{tr("wall", $count)}</nobold>
</div> </div>
<div> <div>
<div class="content_subtitle"> <div class="content_subtitle">
{tr("wall", $count)} <div n:if="$canPost" id="write" style="padding: 5px 0;" onfocusin="expand_wall_textarea();">
<form action="/wall{$owner}/makePost" method="post" enctype="multipart/form-data" style="margin:0;">
<div n:if="$canPost" style="float: right;"> <textarea id="wall-post-input" placeholder="{_write}" name="text" style="width: 100%;resize: none;" class="small-textarea"></textarea>
<a n:ifset="$thisUser" onclick="show_write_textarea()">{_'write'}</a> <div>
<!-- padding to fix <br/> bug -->
</div>
<div id="post-buttons" style="display: none;">
<div class="post-upload">
Вложение: <span>(unknown)</span>
</div>
<div class="post-opts">
{if !is_null($thisUser) && $owner < 0 && $club->canBeModifiedBy($thisUser)}
<script>
function onWallAsGroupClick(el) {
_display = el.checked ? "block" : "none";
document.querySelector("#forceSignOpt").style.display = _display;
}
</script>
<label>
<input type="checkbox" name="as_group" onchange="onWallAsGroupClick(this)" /> От имени сообщества
</label>
<label id="forceSignOpt" style="display: none;">
<input type="checkbox" name="force_sign" /> Подпись автора
</label>
{/if}
{*
<label>
<input type="checkbox" name="nsfw" /> Содержит NSFW-контент
</label>
*}
</div>
<input type="file" name="_pic_attachment" accept="image/*" style="display:none;" />
<input type="hidden" name="type" value="1" />
<input type="hidden" name="hash" value="{$csrfToken}" />
<br/>
<input type="submit" value="{_'write'}" class="button" />
<div style="float: right;">
<a href="javascript:void(document.querySelector(`input[name=_pic_attachment]`).click());">
{_attach_photo}
</a>
</div>
</div>
</form>
</div> </div>
</div> </div>
<div n:if="$canPost" id="write" style="padding: 8px; display: none;">
<form action="/wall{$owner}/makePost" method="post" enctype="multipart/form-data" style="margin:0;">
<textarea id="wall-post-input" name="text" style="width: 100%;resize: none;"></textarea>
<div>
<!-- padding to fix <br/> bug -->
</div>
<div class="post-upload">
Вложение: <span>(unknown)</span>
</div>
<div class="post-opts">
{if !is_null($thisUser) && $owner < 0 && $club->canBeModifiedBy($thisUser)}
<script>
function onWallAsGroupClick(el) {
_display = el.checked ? "block" : "none";
document.querySelector("#forceSignOpt").style.display = _display;
}
</script>
<label>
<input type="checkbox" name="as_group" onchange="onWallAsGroupClick(this)" /> От имени сообщества
</label>
<label id="forceSignOpt" style="display: none;">
<input type="checkbox" name="force_sign" /> Подпись автора
</label>
{/if}
{*
<label>
<input type="checkbox" name="nsfw" /> Содержит NSFW-контент
</label>
*}
</div>
<input type="file" name="_pic_attachment" accept="image/*" style="display:none;" />
<input type="hidden" name="type" value="1" />
<input type="hidden" name="hash" value="{$csrfToken}" />
<br/>
<input type="submit" value="{_'write'}" class="button" />
<div style="float: right;">
<a href="javascript:void(document.querySelector(`input[name=_pic_attachment]`).click());">
{_attach_photo}
</a>
</div>
</form>
</div>
<div class="content"> <div class="content">
{if sizeof($posts) > 0} {if sizeof($posts) > 0}
{foreach $posts as $post} {foreach $posts as $post}

View file

@ -29,6 +29,10 @@ span {
color: gray; color: gray;
} }
nobold {
font-weight: normal;
}
a { a {
text-decoration: none; text-decoration: none;
color: #2B587A; color: #2B587A;
@ -533,6 +537,14 @@ h4 {
color: #bcbcbc; color: #bcbcbc;
} }
.small-textarea {
height: 24px;
}
.expanded-textarea {
min-height: 48px;
}
ul { ul {
list-style-type: square; list-style-type: square;
color: #a2a2a2; color: #a2a2a2;
@ -938,8 +950,9 @@ textarea {
font-family: unset; font-family: unset;
border: 1px solid #C0CAD5; border: 1px solid #C0CAD5;
font-size: 9pt; font-size: 9pt;
min-height: 42px; min-height: 24px;
width: 100%; width: 100%;
padding: 4px;
resize: none; resize: none;
} }

View file

@ -1,12 +1,12 @@
function show_write_textarea() { function expand_wall_textarea() {
var el = document.getElementById('write'); var el = document.getElementById('post-buttons');
if (el.style.display == "none") { var wi = document.getElementById('wall-post-input');
el.style.display = "block"; el.style.display = "block";
} else { wi.className = "expanded-textarea";
el.style.display = "none";
}
} }
function edit_post(id, wid) { function edit_post(id, wid) {