lower userpage admin tools as a macro

master
justcool393 2022-10-07 00:41:59 -07:00
parent 26fbf726a4
commit 9874470065
2 changed files with 110 additions and 205 deletions

View File

@ -29,6 +29,8 @@
<meta name="twitter:url" content="{{u.url}}">
{% endblock %}
{% import 'userpage_admintools_lower.html' as userpage_admintools_lower %}
{% block desktopUserBanner %}
<div class="row d-none d-md-block">
@ -269,110 +271,9 @@
{% if FEATURES['USERS_PROFILE_SONG'] and u.song and v and (v.id == u.id or v.mute and not u.unmutable) %}
<a class="btn btn-secondary" role="button" onclick="toggle()">Toggle anthem</a>
{% endif %}
{{ userpage_admintools_lower.userAdminToolsLower('desktop') }}
{% if v and v.id != u.id and v.admin_level >= PERMS['USER_MODERATION_TOOLS_VISIBLE'] %}
<br><br>
<div class="body d-lg-flex border-bottom">
{% if v.admin_level >= PERMS['USER_TITLE_CHANGE'] %}
<div class="w-lg-100">
<form action="/admin/title_change/{{u.id}}" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input maxlength=100 autocomplete="off" id="customtitlebody" type="text" name="title" class="form-control" placeholder='Enter a flair here' value="{% if u.customtitleplain %}{{u.customtitleplain}}{% endif %}">
<div class="d-flex mt-2">
<a class="format" role="button"><i class="btn btn-secondary format d-inline-block m-0 fas fa-smile-beam" onclick="loadEmojis('customtitlebody')" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji"></i></a>
&nbsp;&nbsp;&nbsp;
<div class="custom-control custom-checkbox">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="locked" name="locked" {% if u.flairchanged %}checked{% endif %}>
<label class="custom-control-label" for="locked">locked</label>
</div>
&nbsp;&nbsp;&nbsp;
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" onclick="disable(this)" value="Change Flair">
</div>
</form>
</div>
{% endif %}
</div>
<pre></pre>
<pre></pre>
{% if v.admin_level >= PERMS['USER_BAN'] %}
{% if u.is_suspended %}
<form action="/unban_user/{{u.id}}" method="post" action="">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="redir" value="true">
<input type="submit" onclick="disable(this)" class="btn btn-success" value="Unban user">
</form>
{% else %}
<form action="/ban_user/{{u.id}}" method="post" action="">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="redir" value="true">
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Ban Reason" oninput="document.getElementById('user-ban-submit').disabled=false" required>
<input autocomplete="off" style="font-size:11px" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
<div class="custom-control custom-checkbox mb-1">
<input autocomplete="off" type="checkbox" id="alts-2-desktop" class="custom-control-input" name="alts" value="1">
<label class="custom-control-label" for="alts-2-desktop">Include alts</label>
</div>
<input autocomplete="off" id="user-ban-submit" type="submit" onclick="disable(this)" class="btn btn-danger" value="Ban user" disabled>
</form>
{% endif %}
{% endif %}
<pre></pre>
<pre></pre>
{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %}
{% if u.shadowbanned %}
<form action="/unshadowban/{{u.id}}" method="post" action="">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="submit" onclick="disable(this)" class="btn btn-success" value="Unshadowban user">
</form>
{% else %}
<form action="/shadowban/{{u.id}}" method="post" action="">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Shadowban Reason" oninput="document.getElementById('user-shadowban-submit').disabled=false" required>
<div class="custom-control custom-checkbox mb-1">
<input autocomplete="off" type="checkbox" id="shadowban-alts-2-desktop" class="custom-control-input" name="alts" value="1">
<label class="custom-control-label" for="shadowban-alts-2-desktop">Include alts</label>
</div>
<input autocomplete="off" id="user-shadowban-submit" type="submit" onclick="disable(this)" class="btn btn-danger" value="Shadowban user" disabled>
</form>
{% endif %}
{% endif %}
<pre></pre>
<pre></pre>
{% if v and v.admin_level >= PERMS['USER_AGENDAPOSTER'] %}
<form id="agendaposter1" class="{% if u.agendaposter %}d-none{% endif %}" action="/agendaposter/{{u.id}}" method="post">
<input type="hidden" name="formkey", value="{{v.formkey}}">
<input autocomplete="off" type="number" step="any" name="days" class="form-control" placeholder="Days (0 or blank = permanent)">
<input type="submit" onclick="disable(this)" class="btn btn-danger" value="Lock Chud Theme">
</form>
<pre></pre>
<a id="unagendaposter" class="{% if not u.agendaposter %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast(this,'/unagendaposter/{{u.id}}','agendaposter1','unagendaposter','d-none')">Disable Chud Theme</a>
{% endif %}
<pre></pre>
{% if v and v.admin_level >= PERMS['USER_BAN'] %}
<a id="mute-user" class="{% if u.is_muted %}d-none{% endif %} btn btn-danger" role="button" onclick="post_toast(this,'/mute_user/{{u.id}}/1','mute-user','unmute-user','d-none')">Mute</a>
<a id="unmute-user" class="{% if not u.is_muted %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast(this,'/mute_user/{{u.id}}/0','mute-user','unmute-user','d-none')">Unmute</a>
{% endif %}
<pre></pre>
{% if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
<form action="/admin/unnuke_user" method="post">
<input type="hidden" name="formkey", value="{{v.formkey}}">
<input type="hidden" name="user" value="{{u.username}}">
<input type="submit" onclick="disable(this)" class="btn btn-success" value="Approve User's Content">
</form>
<pre></pre>
<form action="/admin/nuke_user" method="post">
<input type="hidden" name="formkey", value="{{v.formkey}}">
<input type="hidden" name="user" value="{{u.username}}">
<input type="submit" onclick="disable(this)" class="btn btn-danger" value="Remove User's Content">
</form>
{% endif %}
{% if FEATURES['COUNTRY_CLUB'] and v and v.admin_level >= PERMS['USER_CLUB_ALLOW_BAN'] %}
<pre></pre>
<button id="grant2" class="{% if u.paid_dues %}d-none{% endif %} btn btn-success" onclick="post_toast(this,'/@{{u.username}}/club_allow','grant2','bar2','d-none')">Grant club access</button>
<button id="bar2" class="{% if u.club_allowed == False %}d-none{% endif %} btn btn-danger" onclick="post_toast(this,'/@{{u.username}}/club_ban','grant2','bar2','d-none')">Bar from club</button>
{% endif %}
{% endif %}
<pre></pre>
<div id="profile--info">
<p id="profile--info--id">User ID: {{u.id}}</p>
@ -632,108 +533,8 @@
<button class="btn btn-primary mt-2 mb-3" onclick="transferBux(true)">Gift</button>
</div>
{% if v and v.admin_level >= PERMS['USER_MODERATION_TOOLS_VISIBLE'] %}
{% if FEATURES['COUNTRY_CLUB'] and v.admin_level >= PERMS['USER_CLUB_ALLOW_BAN'] -%}
<button id="grant" class="{% if u.paid_dues %}d-none{% endif %} btn btn-success" onclick="post_toast(this,'/@{{u.username}}/club_allow','grant','bar','d-none')">Grant club access</button>
<button id="bar" class="{% if u.club_allowed == False %}d-none{% endif %} btn btn-danger" onclick="post_toast(this,'/@{{u.username}}/club_ban','grant','bar','d-none')">Bar from club</button>
{%- endif %}
<br><br>
<div class="body d-lg-flex border-bottom">
{% if v.admin_level >= PERMS['USER_TITLE_CHANGE'] %}
<div class="w-lg-100">
<form action="/admin/title_change/{{u.id}}" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input maxlength=100 autocomplete="off" id="customtitlebody-mobile" type="text" name="title" class="form-control" placeholder='Enter a flair here' value="{% if u.customtitleplain %}{{u.customtitleplain}}{% endif %}">
<div class="d-flex mt-2">
<a class="format" role="button"><i class="btn btn-secondary format d-inline-block m-0 fas fa-smile-beam" onclick="loadEmojis('customtitlebody-mobile')" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji"></i></a>
&nbsp;&nbsp;&nbsp;
<div class="custom-control custom-checkbox">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="locked-mobile" name="locked" {% if u.flairchanged %}checked{% endif %}>
<label class="custom-control-label" for="locked-mobile">locked</label>
</div>
&nbsp;&nbsp;&nbsp;
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" onclick="disable(this)" value="Change Flair">
</div>
</form>
</div>
{% endif %}
</div>
<pre></pre>
<pre></pre>
{% if v.admin_level >= PERMS['USER_BAN'] %}
{% if u.is_suspended %}
<form action="/unban_user/{{u.id}}" method="post">
<input type="hidden" name="formkey", value="{{v.formkey}}">
<input type="hidden" name="redir" value="true">
<input type="submit" onclick="disable(this)" class="btn btn-success" value="Unban user">
</form>
{% else %}
<form action="/ban_user/{{u.id}}" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="redir" value="true">
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Ban Reason" oninput="document.getElementById('user-ban-submit2').disabled=false" required>
<input autocomplete="off" style="font-size:11px" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
<div class="custom-control custom-checkbox mb-1">
<input autocomplete="off" type="checkbox" id="alts-2-mobile" class="custom-control-input" name="alts" value="1">
<label class="custom-control-label" for="alts-2-mobile">Include alts</label>
</div>
<input autocomplete="off" id="user-ban-submit2" type="submit" onclick="disable(this)" class="btn btn-danger" value="Ban user" disabled>
</form>
{% endif %}
{% endif %}
<pre></pre>
<pre></pre>
{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %}
{% if u.shadowbanned %}
<form action="/unshadowban/{{u.id}}" method="post">
<input type="hidden" name="formkey", value="{{v.formkey}}">
<input type="submit" onclick="disable(this)" class="btn btn-success" value="Unshadowban user">
</form>
{% else %}
<form action="/shadowban/{{u.id}}" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Shadowban Reason" oninput="document.getElementById('user-shadowban-submit2').disabled=false" required>
<div class="custom-control custom-checkbox mb-1">
<input autocomplete="off" type="checkbox" id="shadowban-alts-2-mobile" class="custom-control-input" name="alts" value="1">
<label class="custom-control-label" for="shadowban-alts-2-mobile">Include alts</label>
</div>
<input autocomplete="off" id="user-shadowban-submit2" type="submit" onclick="disable(this)" class="btn btn-danger" value="Shadowban user" disabled>
</form>
{% endif %}
{% endif %}
<pre></pre>
<pre></pre>
{% if v.admin_level >= PERMS['USER_AGENDAPOSTER'] %}
<form id="agendaposter2" class="{% if u.agendaposter %}d-none{% endif %}" action="/agendaposter/{{u.id}}" method="post">
<input type="hidden" name="formkey", value="{{v.formkey}}">
<input autocomplete="off" type="number" step="any" name="days" class="form-control" placeholder="Days (0 or blank = permanent)">
<input type="submit" onclick="disable(this)" class="btn btn-danger" value="Lock Chud Theme">
</form>
<pre></pre>
<a id="unagendaposter2" class="{% if not u.agendaposter %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast(this,'/unagendaposter/{{u.id}}','agendaposter2','unagendaposter2','d-none')">Disable Chud Theme</a>
<pre></pre>
{% endif %}
{% if v.admin_level >= PERMS['USER_BAN'] %}
<a id="mute-user2" class="{% if u.is_muted %}d-none{% endif %} btn btn-danger" role="button" onclick="post_toast(this,'/mute_user/{{u.id}}/1','mute-user2','unmute-user2','d-none')">Mute</a>
<a id="unmute-user2" class="{% if not u.is_muted %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast(this,'/mute_user/{{u.id}}/0','mute-user2','unmute-user2','d-none')">Unmute</a>
{% endif %}
<pre></pre>
{% if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
<form action="/admin/unnuke_user" method="post">
<input type="hidden" name="formkey", value="{{v.formkey}}">
<input type="hidden" name="user" value="{{u.username}}">
<input type="submit" onclick="disable(this)" class="btn btn-success" value="Approve User's Content">
</form>
<pre></pre>
<form action="/admin/nuke_user" method="post">
<input type="hidden" name="formkey", value="{{v.formkey}}">
<input type="hidden" name="user" value="{{u.username}}">
<input type="submit" onclick="disable(this)" class="btn btn-danger" value="Remove User's Content">
</form>
{% endif %}
{% endif %}
{{ userpage_admintools_lower.userAdminToolsLower('mobile') }}
{% endif %}
<pre></pre>
<div id="profile-mobile--info">

View File

@ -0,0 +1,104 @@
{% macro userAdminToolsLower(deviceType) -%}
{% if v and v.id != u.id and v.admin_level >= PERMS['USER_MODERATION_TOOLS_VISIBLE'] %}
<div class="admintools-lower-{{deviceType}}">
<br><br>
{% if v.admin_level >= PERMS['USER_TITLE_CHANGE'] %}
<div class="body d-lg-flex border-bottom">
<div class="w-lg-100">
<form action="/admin/title_change/{{u.id}}" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input maxlength=100 autocomplete="off" id="customtitlebody-{{deviceType}}" type="text" name="title" class="form-control" placeholder='Enter a flair here' value="{% if u.customtitleplain %}{{u.customtitleplain}}{% endif %}">
<div class="d-flex mt-2">
<a class="format" role="button"><i class="btn btn-secondary format d-inline-block m-0 fas fa-smile-beam" onclick="loadEmojis('customtitlebody-{{deviceType}}')" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji"></i></a>
&nbsp;&nbsp;&nbsp;
<div class="custom-control custom-checkbox">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="locked" name="locked" {% if u.flairchanged %}checked{% endif %}>
<label class="custom-control-label" for="locked">locked</label>
</div>
&nbsp;&nbsp;&nbsp;
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" onclick="disable(this)" value="Change Flair">
</div>
</form>
</div>
</div>
<pre></pre>
<pre></pre>
{% endif %}
{% if v.admin_level >= PERMS['USER_BAN'] %}
{% if u.is_suspended %}
<form action="/unban_user/{{u.id}}" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="redir" value="true">
<input type="submit" onclick="disable(this)" class="btn btn-success" value="Unban user">
</form>
{% else %}
<form action="/ban_user/{{u.id}}" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="redir" value="true">
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Ban Reason" oninput="document.getElementById('user-ban-submit').disabled=false" required>
<input autocomplete="off" style="font-size:11px" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
<div class="custom-control custom-checkbox mb-1">
<input autocomplete="off" type="checkbox" id="alts-2-{{deviceType}}" class="custom-control-input" name="alts" value="1">
<label class="custom-control-label" for="alts-2-{{deviceType}}">Include alts</label>
</div>
<input autocomplete="off" id="user-ban-submit" type="submit" onclick="disable(this)" class="btn btn-danger" value="Ban user" disabled>
</form>
{% endif %}
<pre></pre>
<pre></pre>
{% endif %}
{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %}
{% if u.shadowbanned %}
<form action="/unshadowban/{{u.id}}" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="submit" onclick="disable(this)" class="btn btn-success" value="Unshadowban user">
</form>
{% else %}
<form action="/shadowban/{{u.id}}" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Shadowban Reason" oninput="document.getElementById('user-shadowban-submit').disabled=false" required>
<div class="custom-control custom-checkbox mb-1">
<input autocomplete="off" type="checkbox" id="shadowban-alts-2-{{deviceType}}" class="custom-control-input" name="alts" value="1">
<label class="custom-control-label" for="shadowban-alts-2-{{deviceType}}">Include alts</label>
</div>
<input autocomplete="off" id="user-shadowban-submit" type="submit" onclick="disable(this)" class="btn btn-danger" value="Shadowban user" disabled>
</form>
{% endif %}
<pre></pre>
<pre></pre>
{% endif %}
{% if v.admin_level >= PERMS['USER_AGENDAPOSTER'] %}
<form id="agendaposter-{{deviceType}}" class="{% if u.agendaposter %}d-none{% endif %}" action="/agendaposter/{{u.id}}" method="post">
<input type="hidden" name="formkey", value="{{v.formkey}}">
<input autocomplete="off" type="number" step="any" name="days" class="form-control" placeholder="Days (0 or blank = permanent)">
<input type="submit" onclick="disable(this)" class="btn btn-danger" value="Lock Chud Theme">
</form>
<pre></pre>
<a id="unagendaposter-{{deviceType}}" class="{% if not u.agendaposter %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast(this,'/unagendaposter/{{u.id}}','agendaposter1','unagendaposter','d-none')">Disable Chud Theme</a>
{% endif %}
{% if v.admin_level >= PERMS['USER_BAN'] %}
<a id="mute-user-{{deviceType}}" class="{% if u.is_muted %}d-none{% endif %} btn btn-danger" role="button" onclick="post_toast(this,'/mute_user/{{u.id}}/1','mute-user','unmute-user','d-none')">Mute</a>
<a id="unmute-user-{{deviceType}}" class="{% if not u.is_muted %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast(this,'/mute_user/{{u.id}}/0','mute-user','unmute-user','d-none')">Unmute</a>
<pre></pre>
{% endif %}
{% if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
<form action="/admin/unnuke_user" method="post">
<input type="hidden" name="formkey", value="{{v.formkey}}">
<input type="hidden" name="user" value="{{u.username}}">
<input type="submit" onclick="disable(this)" class="btn btn-success" value="Approve User's Content">
</form>
<pre></pre>
<form action="/admin/nuke_user" method="post">
<input type="hidden" name="formkey", value="{{v.formkey}}">
<input type="hidden" name="user" value="{{u.username}}">
<input type="submit" onclick="disable(this)" class="btn btn-danger" value="Remove User's Content">
</form>
{% endif %}
{% if FEATURES['COUNTRY_CLUB'] and v and v.admin_level >= PERMS['USER_CLUB_ALLOW_BAN'] %}
<pre></pre>
<button id="grant-{{device}}" class="{% if u.paid_dues %}d-none{% endif %} btn btn-success" onclick="post_toast(this,'/@{{u.username}}/club_allow','grant2','bar2','d-none')">Grant club access</button>
<button id="bar-{{device}}" class="{% if u.club_allowed == False %}d-none{% endif %} btn btn-danger" onclick="post_toast(this,'/@{{u.username}}/club_ban','grant2','bar2','d-none')">Bar from club</button>
{% endif %}
</div>
{% endif %}
{%- endmacro %}