split macros.file_input into 3 in preparation for next commit

pull/211/head
Aevann 2023-10-05 13:57:32 +03:00
parent f03b88effb
commit 4274d1633f
7 changed files with 39 additions and 19 deletions

View File

@ -259,7 +259,9 @@
<div class="text-small font-weight-bold mt-1" id="charcount-edit-{{c.id}}" style="right: 1rem; bottom: 0.5rem; z-index: 3"></div>
{{macros.file_input('file-edit-reply-' ~ c.id, 'comment-edit-body-' ~ c.id)}}
{{macros.emoji_btn('comment-edit-reply-' ~ c.id)}}
{{macros.gif_btn('comment-edit-reply-' ~ c.id)}}
{{macros.file_btn('file-edit-reply-' ~ c.id)}}
<a class="text-small mt-3 d-inline-block" href="/formatting" {% if v and v.newtab %}data-target="t" target="_blank"{% endif %}>Formatting help</a>
@ -552,7 +554,9 @@
<input hidden name="formkey" value="{{v|formkey}}">
<textarea data-fullname="{{c.fullname}}" required autocomplete="off" minlength="1" maxlength="10000" name="body" form="reply-to-c_{{c.id}}" data-id="{{c.id}}" class="file-ta comment-box form-control rounded" id="reply-form-body-{{c.id}}" rows="3" data-preview="message-reply-{{c.id}}" data-nonce="{{g.nonce}}" data-oninput="markdown(this);handle_disabled(this)"></textarea>
{{macros.file_input('file-upload-reply-' ~ c.fullname, 'reply-form-body-' ~ c.id, not get_setting('dm_media'))}}
{{macros.emoji_btn('reply-form-body-' ~ c.id)}}
{{macros.gif_btn('reply-form-body-' ~ c.id)}}
{{macros.file_btn('file-upload-reply-' ~ c.fullname, not get_setting('dm_media'))}}
<div class="ml-auto">
<span id="upload-prog-{{c.fullname}}" class="d-none mt-1 mr-2">

View File

@ -9,8 +9,9 @@
<input hidden name="formkey" value="{{v|formkey}}">
<textarea autocomplete="off" maxlength="10000" id="input-message" form="contactform" name="message" class="file-ta form-control" required></textarea>
<div class="mt-1">
{{macros.file_input('file-upload', 'input-message')}}
{{macros.emoji_btn('input-message')}}
{{macros.gif_btn('input-message')}}
{{macros.file_btn('file-upload')}}
<input type="submit" value="Submit" class="btn btn-primary fl-r">
</div>
</form>

View File

@ -193,7 +193,9 @@
<div class="text-small font-weight-bold mt-1" id="charcount-post-edit" style="right: 1rem; bottom: 0.5rem; z-index: 3"></div>
{{macros.file_input('file-upload-edit-' ~ p.id, 'post-edit-box-' ~ p.id)}}
{{macros.emoji_btn('post-edit-box-' ~ p.id)}}
{{macros.gif_btn('post-edit-box-' ~ p.id)}}
{{macros.file_btn('file-upload-edit-' ~ p.id)}}
<a class="text-small mt-3 d-inline-block" href="/formatting" {% if v and v.newtab %}data-target="t" target="_blank"{% endif %}>Formatting help</a>
<button type="submit" form="post-edit-form-{{p.id}}" class="btn btn-primary ml-2 fl-r" data-nonce="{{g.nonce}}" data-onclick="remove_dialog()">Save Edit</button>

View File

@ -80,7 +80,9 @@
<textarea autocomplete="off" id="{{id}}-text" class="file-ta form-control rounded" placeholder="{{placeholder_text}}" rows="3" name="{{form_name}}" form="{{id}}-form" maxlength="{{maxlength}}">{% if contents %}{{contents}}{% endif %}</textarea>
{% if show_extras %}
{{macros.file_input('file-upload-common-' ~ id, id ~'-text')}}
{{macros.emoji_btn(id ~ '-text')}}
{{macros.gif_btn(id ~ '-text')}}
{{macros.file_btn('file-upload-common-' ~ id)}}
{% endif %}
<div class="d-flex mt-1">

View File

@ -54,7 +54,9 @@
<div class="ghostdiv" style="display:none"></div>
<div class="text-small font-weight-bold mt-1" id="character-count-submit-text-form" style="right: 1rem; bottom: 0.5rem; z-index: 3"></div>
{{macros.file_input('file-upload-submit', 'post-text')}}
{{macros.emoji_btn('post-text')}}
{{macros.gif_btn('post-text')}}
{{macros.file_btn('file-upload-submit')}}
<div id="preview" class="preview my-3"></div>
<div class="form-text text-small mt-1 mb-3"><a href="/formatting" {% if v and v.newtab %}data-target="t" target="_blank"{% endif %}>Formatting help</a></div>

View File

@ -193,7 +193,9 @@
<input hidden name="formkey" value="{{v|formkey}}">
<textarea autocomplete="off" id="input-message" form="message" name="message" rows="3" minlength="1" maxlength="10000" class="file-ta form-control b2 mt-1" data-preview="message-preview" data-nonce="{{g.nonce}}" data-oninput="markdown(this);handle_disabled(this)"></textarea>
{{macros.file_input('file-upload-macro', 'input-message', not get_setting('dm_media'))}}
{{macros.emoji_btn('input-message')}}
{{macros.gif_btn('input-message')}}
{{macros.file_btn('file-upload-macro', not get_setting('dm_media'))}}
<div class="d-flex">
<input type="submit" data-nonce="{{g.nonce}}" data-onclick="remove_dialog()" value="Submit" class="btn btn-primary ml-auto handle_disabled disabled" disabled>
@ -494,7 +496,9 @@
<input class="mt-1" hidden name="formkey" value="{{v|formkey}}">
<textarea autocomplete="off" id="input-message-mobile" form="message-mobile" name="message" rows="3" minlength="1" maxlength="10000" class="file-ta form-control" data-preview="message-preview-mobile" data-nonce="{{g.nonce}}" data-oninput="markdown(this);handle_disabled(this)" required></textarea>
{{macros.file_input('file-upload-mobile', 'input-message-mobile')}}
{{macros.emoji_btn('input-message-mobile')}}
{{macros.gif_btn('input-message-mobile')}}
{{macros.file_btn('file-upload-mobile')}}
<div class="d-flex">
<input type="submit" data-nonce="{{g.nonce}}" data-onclick="remove_dialog()" value="Submit" class="btn btn-primary ml-auto handle_disabled disabled" disabled>

View File

@ -107,17 +107,20 @@
{% endmacro %}
{% macro file_input(input_id, textarea_id, disabled) %}
<div class="comment-format">
<button type="button" class="btn btn-secondary format m-0 font-weight-bolder text-uppercase" data-nonce="{{g.nonce}}" data-onclick="getGifs('{{textarea_id}}')" data-bs-toggle="modal" data-bs-target="#gifModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add GIF">GIF</button>
<button type="button" class="btn btn-secondary format m-0 ml-2" data-nonce="{{g.nonce}}" data-onclick="loadEmojis('{{textarea_id}}')" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji"><i class="fas fa-smile-beam"></i></button>
{% macro emoji_btn(textarea_id) %}
<button type="button" class="btn btn-secondary format m-0 mr-1" data-nonce="{{g.nonce}}" data-onclick="loadEmojis('{{textarea_id}}')" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji"><i class="fas fa-smile-beam"></i></button>
{% endmacro %}
<label class="btn btn-secondary format m-0 ml-2" for="{{input_id}}" {% if g.is_tor or disabled %}disabled{% endif %}>
<i class="fas fa-{% if image_only %}image{% else %}file{% endif %}"></i>
<input autocomplete="off" id="{{input_id}}" accept="image/*{% if not image_only %}, video/*, audio/*{% endif %}" type="file" multiple="multiple" name="file" {% if g.is_tor or disabled %}disabled{% endif %} hidden>
</label>
</div>
{% macro gif_btn(textarea_id) %}
<button type="button" class="btn btn-secondary format m-0 mr-1 font-weight-bolder text-uppercase" data-nonce="{{g.nonce}}" data-onclick="getGifs('{{textarea_id}}')" data-bs-toggle="modal" data-bs-target="#gifModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add GIF">GIF</button>
{% endmacro %}
{% macro file_btn(input_id, disabled) %}
<label class="btn btn-secondary format m-0" for="{{input_id}}" {% if g.is_tor or disabled %}disabled{% endif %}>
<i class="fas fa-{% if image_only %}image{% else %}file{% endif %}"></i>
<input autocomplete="off" id="{{input_id}}" accept="image/*{% if not image_only %}, video/*, audio/*{% endif %}" type="file" multiple="multiple" name="file" {% if g.is_tor or disabled %}disabled{% endif %} hidden>
</label>
{% endmacro %}
{% macro comment_reply_box(target_fullname, html_id, wrapper_css_classes="", subwrapper_css_classes="", hide="", enable_cancel_button=true) %}
@ -130,7 +133,9 @@
<div class="text-small font-weight-bold mt-1" id="charcount-{{target_fullname}}" style="right: 1rem; bottom: 0.5rem; z-index: 3"></div>
{{file_input('file-upload-reply-' ~ target_fullname, 'reply-form-body-' ~ target_fullname, False)}}
{{emoji_btn('reply-form-body-' ~ target_fullname)}}
{{gif_btn('reply-form-body-' ~ target_fullname)}}
{{file_btn('file-upload-reply-' ~ target_fullname)}}
<button type="button" id="save-reply-to-{{target_fullname}}" form="reply-to-{{target_fullname}}" class="btn btn-primary text-whitebtn ml-auto fl-r handle_disabled disabled" disabled data-nonce="{{g.nonce}}" data-onclick="post_comment('{{target_fullname}}', '{{hide}}')">Comment</button>