2023-02-27 15:02:35 +00:00
|
|
|
{%- import 'util/macros.html' as macros with context -%}
|
|
|
|
|
2022-11-06 10:27:44 +00:00
|
|
|
{% macro toggle_section(title, id, name, flag, below_text, disabled) %}
|
2023-05-16 00:45:23 +00:00
|
|
|
<div id="{{id}}_toggle" class="d-lg-flex border-bottom">
|
2022-11-06 06:35:49 +00:00
|
|
|
<div class="title w-lg-25">
|
|
|
|
<label for="{{id}}">{{title}}</label>
|
|
|
|
</div>
|
|
|
|
<div class="body w-lg-100">
|
|
|
|
<div class="custom-control custom-switch">
|
2023-01-01 14:13:56 +00:00
|
|
|
<input autocomplete="off" type="checkbox" class="custom-control-input setting_switch" data-nonce="{{g.nonce}}" id="{{id}}" name="{{name}}"{% if flag %} checked{% endif %} {% if disabled %}disabled{% endif %}>
|
2022-11-06 06:35:49 +00:00
|
|
|
<label class="custom-control-label" for="{{id}}"></label>
|
|
|
|
</div>
|
|
|
|
{% if below_text %}
|
2022-11-06 10:27:44 +00:00
|
|
|
<span class="text-small text-muted">{{below_text|safe}}</span>
|
2022-11-06 06:35:49 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
2022-11-06 09:44:58 +00:00
|
|
|
|
|
|
|
{% macro color_section(id, form_action, form_name, section_title, current_color) %}
|
|
|
|
<div class="d-lg-flex border-bottom">
|
|
|
|
<div class="title w-lg-25">
|
|
|
|
<label for="{{id}}">{{section_title}}</label>
|
|
|
|
</div>
|
2022-11-30 15:23:31 +00:00
|
|
|
<div class="body w-lg-100 d-lg-flex">
|
2022-11-06 09:44:58 +00:00
|
|
|
<div class="d-flex">
|
|
|
|
<form action="{{form_action}}" id="{{id}}-form" method="post" class="color-picker" style="line-height: 0">
|
2023-01-24 05:10:16 +00:00
|
|
|
<input hidden name="formkey" value="{{v|formkey}}">
|
2022-11-06 09:44:58 +00:00
|
|
|
{% for themecolor in COLORS %}
|
2023-01-01 09:42:23 +00:00
|
|
|
<input autocomplete="off" type="radio" name="{{form_name}}" id="{{id}}-{{themecolor}}" value="{{themecolor}}" {% if current_color == themecolor %}checked{% endif %} data-nonce="{{g.nonce}}" onclick_submit>
|
2022-11-06 09:44:58 +00:00
|
|
|
<label class="color-radio" for="{{id}}-{{themecolor}}">
|
|
|
|
<span style="background-color: #{{themecolor}}">
|
2022-11-07 04:31:38 +00:00
|
|
|
{% if current_color and current_color.lower() == themecolor %}
|
2022-11-06 09:44:58 +00:00
|
|
|
<i class="fas fa-check text-white"></i>
|
|
|
|
{% else %}
|
|
|
|
|
|
|
|
{% endif %}
|
|
|
|
</span>
|
|
|
|
</label>
|
|
|
|
{% endfor %}
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<p class="text-small mb-2">Or type a color hex code:</p>
|
|
|
|
<div class="d-flex">
|
|
|
|
<form action="{{form_action}}" id="{{id}}-color-code-form" method="post">
|
2023-01-24 05:10:16 +00:00
|
|
|
<input hidden name="formkey" value="{{v|formkey}}">
|
2022-11-30 15:23:31 +00:00
|
|
|
<input autocomplete="off" class="form-control" type="text" name="{{form_name}}" id="{{id}}-color-code" minlength="6" maxlength="6" value="{% if current_color %}{{current_color}}{% endif %}">
|
2022-12-30 17:20:10 +00:00
|
|
|
<label class="btn btn-secondary text-capitalize mr-2 mt-2 mb-0">Update<input type="submit" for="{{id}}-color-code" hidden></label>
|
2022-11-06 09:44:58 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2023-07-30 05:55:07 +00:00
|
|
|
{% macro line_text_section(id, form_action, form_name, section_title, contents, below_text, placeholder_text, button_text, show_marseys, minlength, maxlength, pattern, disabled) %}
|
2022-11-06 09:44:58 +00:00
|
|
|
<div class="body d-lg-flex border-bottom">
|
|
|
|
<label class="text-black w-lg-25">{{section_title}}</label>
|
|
|
|
<div class="w-lg-100">
|
2023-08-11 21:50:23 +00:00
|
|
|
<form id="{{id}}-form" action="{{form_action}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHR(this)">
|
2023-01-24 05:10:16 +00:00
|
|
|
<input hidden name="formkey" value="{{v|formkey}}">
|
2022-11-22 23:47:32 +00:00
|
|
|
<input minlength={{minlength}} maxlength={{maxlength}} pattern="{{pattern}}" autocomplete="off" id="{{id}}-body" type="text" name="{{form_name}}" class="form-control" placeholder='{{placeholder_text}}' value="{% if contents %}{{contents}}{% endif %}" {% if disabled %}disabled{% endif %}>
|
2022-11-06 09:44:58 +00:00
|
|
|
<div class="d-flex mt-2">
|
|
|
|
{% if show_marseys %}
|
2023-02-27 15:02:35 +00:00
|
|
|
<div class="ml-2"><i class="btn btn-secondary format d-inline-block m-0 fas fa-smile-beam" data-nonce="{{g.nonce}}" data-onclick="loadEmojis('{{id}}-body')" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji"></i></div>
|
2022-11-06 09:44:58 +00:00
|
|
|
{% endif %}
|
2023-06-22 12:57:11 +00:00
|
|
|
<small class="ml-1">{{below_text}}</small>
|
2023-03-07 00:21:08 +00:00
|
|
|
<input autocomplete="off" class="btn btn-primary ml-auto" id="{{id}}-save" type="submit" value="{{button_text}}" {% if disabled %}disabled{% endif %}>
|
2022-11-06 09:44:58 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2023-07-30 05:55:07 +00:00
|
|
|
{% macro text_area_section(id, form_action, form_name, section_title, contents, below_text, placeholder_text, show_extras, show_file_upload, maxlength) %}
|
2023-01-01 11:36:20 +00:00
|
|
|
<div class="body d-lg-flex border-bottom">
|
2022-11-06 09:44:58 +00:00
|
|
|
<label class="text-black w-lg-25">{{section_title}}</label>
|
2023-01-01 11:36:20 +00:00
|
|
|
<div class="w-lg-100">
|
2023-08-11 21:50:23 +00:00
|
|
|
<form id="{{id}}-form" action="{{form_action}}" method="post" enctype="multipart/form-data" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHR(this)">
|
2023-01-24 05:10:16 +00:00
|
|
|
<input hidden name="formkey" value="{{v|formkey}}">
|
2023-02-27 15:02:35 +00:00
|
|
|
<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>
|
2022-11-06 09:44:58 +00:00
|
|
|
{% if show_extras %}
|
2022-12-27 06:30:33 +00:00
|
|
|
<div class="d-flex mt-2">
|
2022-12-30 12:14:18 +00:00
|
|
|
<button style="line-height:1" type="button" class="btn btn-secondary format d-inline-block m-0 font-weight-bolder text-uppercase" data-nonce="{{g.nonce}}" data-onclick="getGifs('{{id}}-text')" data-bs-toggle="modal" data-bs-target="#gifModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add GIF">GIF</button>
|
2023-02-27 15:02:35 +00:00
|
|
|
|
|
|
|
<button type="button" class="btn btn-secondary format d-inline-block m-0 fas fa-smile-beam ml-2" data-nonce="{{g.nonce}}" data-onclick="loadEmojis('{{id}}-text')" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji"></button>
|
|
|
|
|
2022-12-05 00:02:29 +00:00
|
|
|
{% if show_file_upload %}
|
2023-03-18 06:27:41 +00:00
|
|
|
{{macros.file_input('file-upload-common', False)}}
|
2022-11-06 09:44:58 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
<div class="d-flex mt-1">
|
|
|
|
<small>{{below_text}}</small>
|
2023-03-07 00:21:08 +00:00
|
|
|
<input autocomplete="off" class="btn btn-primary ml-auto" id="{{id}}-save" type="submit" value="Save Changes">
|
2022-11-06 09:44:58 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|