Wall: Move input TextArea to separate file

Fixes #44
This commit is contained in:
Celestora 2021-10-12 14:16:39 +03:00
parent ec4757f356
commit 2e15de74fc
5 changed files with 50 additions and 113 deletions

View file

@ -18,22 +18,7 @@
<div class="content_title_expanded" onclick="hidePanel(this);"> <div class="content_title_expanded" onclick="hidePanel(this);">
{_"publish_post"} {_"publish_post"}
</div> </div>
<div style="margin: 0 5px;"><br> {include "../components/textArea.xml", route => "/wall" . $thisUser->getId() . "/makePost"}
<form action="/wall{$thisUser->getId()}/makePost" method="POST" enctype="multipart/form-data" style="margin:0;">
<textarea id="wall-post-input" name="text" style="width: 100%;resize: none;"></textarea>
<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}" />
<div></div>
<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> </div>
<br/> <br/>

View file

@ -15,52 +15,8 @@
{block content} {block content}
<div class="content_divider"> <div class="content_divider">
<div> <div>
<!-- TODO: Move the creating post form to dedicated file -->
<div n:if="$canPost" class="content_subtitle"> <div n:if="$canPost" class="content_subtitle">
<div id="write" style="padding: 5px 0;" > {include "../components/textArea.xml", route => "/wall$owner/makePost"}
<form action="/wall{$owner}/makePost" method="post" enctype="multipart/form-data" style="margin:0;">
<textarea id="wall-post-input" placeholder="{_write}" name="text" style="width: 100%;resize: none;" class="expanded-textarea"></textarea>
<div>
<!-- padding to fix <br/> bug -->
</div>
<div id="post-buttons">
<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 class="content"> <div class="content">

View file

@ -1,13 +1,8 @@
<h4>{_"comments"} ({$count})</h4> <h4>{_"comments"} ({$count})</h4>
<div n:ifset="$thisUser"> <div n:ifset="$thisUser">
<form action="/al_comments.pl/create/{$model}/{$parent->getId()}" method="POST" style="margin-top: 2pt;"> {var commentsURL = "/al_comments.pl/create/$model/" . $parent->getId()}
<textarea name="text" style="width: 411px; margin: 0px; height: 53px; resize: none;"></textarea> {include "textArea.xml", route => $commentsURL, postOpts => false}
<br/>
<input type="hidden" value="{$csrfToken}" name="hash" />
<br/>
<input type="submit" value="{_'write'}" class="button" style="bottom-right: 50px;" />
</form>
</div> </div>
{if sizeof($comments) > 0} {if sizeof($comments) > 0}

View file

@ -0,0 +1,44 @@
<div id="write" style="padding: 5px 0;" onfocusin="expand_wall_textarea();">
<form action="{$route}" method="post" enctype="multipart/form-data" style="margin:0;">
<textarea id="wall-post-input" placeholder="{_write}" name="text" style="width: 100%;resize: none;" class="small-textarea"></textarea>
<div>
<!-- padding to fix <br/> bug -->
</div>
<div id="post-buttons" style="display: none;">
<div class="post-upload">
Вложение: <span>(unknown)</span>
</div>
<div n:if="$postOpts ?? true" class="post-opts">
{if !is_null($thisUser) && !is_null($club) && $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)" /> {_"post_as_group"}
</label>
<label id="forceSignOpt" style="display: none;">
<input type="checkbox" name="force_sign" /> {_"add_signature"}
</label>
{/if}
<label>
<input type="checkbox" name="nsfw" /> {_"contains_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>

View file

@ -8,50 +8,7 @@
</div> </div>
<div> <div>
<div n:if="$canPost" class="content_subtitle"> <div n:if="$canPost" class="content_subtitle">
<div id="write" style="padding: 5px 0;" onfocusin="expand_wall_textarea();"> {include "../components/textArea.xml", route => "/wall$owner/makePost"}
<form action="/wall{$owner}/makePost" method="post" enctype="multipart/form-data" style="margin:0;">
<textarea id="wall-post-input" placeholder="{_write}" name="text" style="width: 100%;resize: none;" class="small-textarea"></textarea>
<div>
<!-- padding to fix <br/> bug -->
</div>
<div id="post-buttons" style="display: none;">
<div class="post-upload">
{_"attachment"}: <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)" /> {_"post_as_group"}
</label>
<label id="forceSignOpt" style="display: none;">
<input type="checkbox" name="force_sign" /> {_"add_signature"}
</label>
{/if}
<label>
<input type="checkbox" name="nsfw" /> {_"contains_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 class="content"> <div class="content">