remove ns. where it isnt needed

pull/211/head
Aevann 2023-09-29 04:52:14 +03:00
parent a96cd919dd
commit 14df8b5223
2 changed files with 20 additions and 22 deletions

View File

@ -1,47 +1,45 @@
<nav> <nav>
<ul class="pagination pagination-sm mb-0 mt-4 pl-1"> <ul class="pagination pagination-sm mb-0 mt-4 pl-1">
{% set ns = namespace() %}
{% if not size %} {% if not size %}
{% set size = PAGE_SIZE %} {% set size = PAGE_SIZE %}
{% endif %} {% endif %}
{% set num_pages = (total / size) | round(0, 'ceil') | int %} {% set num_pages = (total / size) | round(0, 'ceil') | int %}
{% set ns.start_point = page - 2 %} {% set start_point = page - 2 %}
{% if ns.start_point < 1 %} {% if start_point < 1 %}
{% set ns.start_point = 1 %} {% set start_point = 1 %}
{% endif %} {% endif %}
{% set end_point = ns.start_point+4 %} {% set end_point = start_point+4 %}
{% if end_point > num_pages %} {% if end_point > num_pages %}
{% set ns.start_point = ns.start_point-(end_point-num_pages) %} {% set start_point = start_point-(end_point-num_pages) %}
{% set end_point = num_pages %} {% set end_point = num_pages %}
{% endif %} {% endif %}
{% if ns.start_point < 1 %} {% if start_point < 1 %}
{% set ns.start_point = 1 %} {% set start_point = 1 %}
{% endif %} {% endif %}
{% if ns.start_point > 1 %} {% if start_point > 1 %}
<li class="page-item"> <li class="page-item">
<small><a class="page-link" href="{{'page'|change_arg(1, request.full_path)|safe}}">1</a></small> <small><a class="page-link" href="{{'page'|change_arg(1, request.full_path)|safe}}">1</a></small>
</li> </li>
{% if ns.start_point == 3 %} {% if start_point == 3 %}
<li class="page-item"> <li class="page-item">
<small><a class="page-link" href="{{'page'|change_arg(2, request.full_path)|safe}}">2</a></small> <small><a class="page-link" href="{{'page'|change_arg(2, request.full_path)|safe}}">2</a></small>
</li> </li>
{% elif ns.start_point != 2 %} {% elif start_point != 2 %}
<li class="page-item"> <li class="page-item">
<small class="page-link dots">...</small> <small class="page-link dots">...</small>
</li> </li>
{% set ns.start_point = ns.start_point + 1 %} {% set start_point = start_point + 1 %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% for x in range(ns.start_point, end_point+1) %} {% for x in range(start_point, end_point+1) %}
<li class="page-item"> <li class="page-item">
<small><a class="page-link {% if x == page %}active disabled{% endif %}" href="{{'page'|change_arg(x, request.full_path)|safe}}">{{x}}</a></small> <small><a class="page-link {% if x == page %}active disabled{% endif %}" href="{{'page'|change_arg(x, request.full_path)|safe}}">{{x}}</a></small>
</li> </li>

View File

@ -272,23 +272,23 @@
{% set ns = namespace(slurtext='Enable if you would like to automatically replace slurs.', profanitytext='Enable if you would like to automatically replace profanities.') %} {% set ns = namespace(slurtext='Enable if you would like to automatically replace slurs.', profanitytext='Enable if you would like to automatically replace profanities.') %}
{% if FEATURES['USERS_PERMANENT_WORD_FILTERS'] %} {% if FEATURES['USERS_PERMANENT_WORD_FILTERS'] %}
{% if v.slurreplacer == 0 %} {% if v.slurreplacer == 0 %}
{% set ns.slurtext = 'Enable if you would like to automatically replace slurs. <a hidden id="slurreplacer-perma-link" href="#" class="text-primary" data-bs-toggle="modal" data-bs-target="#modal-slurreplacer">Make filter permanent for a badge!</a>' %} {% set slurtext = 'Enable if you would like to automatically replace slurs. <a hidden id="slurreplacer-perma-link" href="#" class="text-primary" data-bs-toggle="modal" data-bs-target="#modal-slurreplacer">Make filter permanent for a badge!</a>' %}
{% elif v.slurreplacer == 1 %} {% elif v.slurreplacer == 1 %}
{% set ns.slurtext = 'Enable if you would like to automatically replace slurs. <a id="slurreplacer-perma-link" href="#" class="text-primary" data-bs-toggle="modal" data-bs-target="#modal-slurreplacer">Make filter permanent for a badge!</a>' %} {% set slurtext = 'Enable if you would like to automatically replace slurs. <a id="slurreplacer-perma-link" href="#" class="text-primary" data-bs-toggle="modal" data-bs-target="#modal-slurreplacer">Make filter permanent for a badge!</a>' %}
{% else %} {% else %}
{% set ns.slurtext = "You've enabled the slur replacer permanently! ✊🏿" %} {% set slurtext = "You've enabled the slur replacer permanently! ✊🏿" %}
{% endif %} {% endif %}
{% if v.profanityreplacer == 0 %} {% if v.profanityreplacer == 0 %}
{% set ns.profanitytext = 'Enable if you would like to automatically replace profanities. <a hidden id="profanityreplacer-perma-link" href="#" class="text-primary" data-bs-toggle="modal" data-bs-target="#modal-profanityreplacer">Make filter permanent for a badge!</a>' %} {% set profanitytext = 'Enable if you would like to automatically replace profanities. <a hidden id="profanityreplacer-perma-link" href="#" class="text-primary" data-bs-toggle="modal" data-bs-target="#modal-profanityreplacer">Make filter permanent for a badge!</a>' %}
{% elif v.profanityreplacer == 1 %} {% elif v.profanityreplacer == 1 %}
{% set ns.profanitytext = 'Enable if you would like to automatically replace profanities. <a id="profanityreplacer-perma-link" href="#" class="text-primary" data-bs-toggle="modal" data-bs-target="#modal-profanityreplacer">Make filter permanent for a badge!</a>' %} {% set profanitytext = 'Enable if you would like to automatically replace profanities. <a id="profanityreplacer-perma-link" href="#" class="text-primary" data-bs-toggle="modal" data-bs-target="#modal-profanityreplacer">Make filter permanent for a badge!</a>' %}
{% else %} {% else %}
{% set ns.profanitytext = "You've enabled the profanity replacer permanently! 😇" %} {% set profanitytext = "You've enabled the profanity replacer permanently! 😇" %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{{common.toggle_section("Slur Replacer", "slurreplacerswitch", 'slurreplacer', v.slurreplacer, ns.slurtext, FEATURES['USERS_PERMANENT_WORD_FILTERS'] and v.slurreplacer > 1)}} {{common.toggle_section("Slur Replacer", "slurreplacerswitch", 'slurreplacer', v.slurreplacer, slurtext, FEATURES['USERS_PERMANENT_WORD_FILTERS'] and v.slurreplacer > 1)}}
{{common.toggle_section("Profanity Replacer", "profanityreplacerswitch", 'profanityreplacer', v .profanityreplacer, ns.profanitytext, FEATURES['USERS_PERMANENT_WORD_FILTERS'] and v.profanityreplacer > 1)}} {{common.toggle_section("Profanity Replacer", "profanityreplacerswitch", 'profanityreplacer', v .profanityreplacer, profanitytext, FEATURES['USERS_PERMANENT_WORD_FILTERS'] and v.profanityreplacer > 1)}}
</div> </div>
</section> </section>
<section id="site-settings-referral-section" class="settings-section-section"> <section id="site-settings-referral-section" class="settings-section-section">