This commit is contained in:
SBD
2023-11-29 16:26:00 +03:00
parent 8e3b798bce
commit ac60b08f2d
4 changed files with 16 additions and 12 deletions

View File

@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
__author__ = 'SDE'
def get_paging_Dict(request, elements_count, elements_on_page, from_page, to_page=None):
def get_paging_Dict(request, elements_count, next_page_els_count, from_page, to_page=None):
pages_count = elements_count / elements_on_page
if elements_count % elements_on_page > 0:
pages_count = elements_count / next_page_els_count
if elements_count % next_page_els_count > 0:
pages_count = pages_count + 1
pages = []

View File

@@ -3,16 +3,16 @@ standart_page_iterator = 1
separator_iterator = 1
iterator_f_check = 1
function load_routes (el,news=null) {
function load_routes (el,news=null,incrase) {
let local_page_iterator = standart_page_iterator
if (!news){
local_page_iterator = page_iterator
}
let number_last_route = el.id
let incrase = 2
if (!news){
incrase = 10
}
// let incrase = 2
// if (!news){
// incrase = 10
// }
let data_d = {
'from_el':parseInt(number_last_route),
'to_el':parseInt(number_last_route) + incrase
@@ -58,6 +58,10 @@ function load_routes (el,news=null) {
//
//
if (data.next_page_els_count){
document.querySelector(".col_vo_els_f_load").innerHTML = data.next_page_els_count
}
let place_ins_parent = el.closest(".block_w_paging")
let place_ins = place_ins_parent.querySelector(`.page_paging_elements_${local_page_iterator}`)
//

View File

@@ -19,9 +19,9 @@
<div class="clear_both"></div>
{% if last_block == False %}
{% if last_block == False and next_page_els_count %}
<div class="text-align-center">
<button class="button-find-more-routes" id="{{ last_el }}" onclick="load_routes(this)">{% trans "Показать ещё 10" %}</button>
<button class="button-find-more-routes" id="{{ last_el }}" onclick="load_routes(this,null,{{ next_page_els_count }})">{% trans "Показать ещё" %}<span class="col_vo_els_f_load">{{ next_page_els_count }}</span></button>
<div class="width-100 text-align-center mb-10">
<img class="loader_f_loading_routes" src="{% static "img/svg/loader.svg" %}">
</div>

View File

@@ -36,10 +36,10 @@
{% include 'blocks/articles/b_news_elements_content.html' %}
{% endwith %}
{# boris edited #}
{% if last_block == False %}
{% if last_block == False and next_page_els_count %}
<div class="text-align-center">
{% csrf_token %}
<button class="button-find-more-routes" id="{{ last_el }}" onclick="load_routes(this,'news')">{% trans "Показать ещё 2" %}</button>
<button class="button-find-more-routes" id="{{ last_el }}" onclick="load_routes(this,'news',{{ next_page_els_count }})">{% trans "Показать ещё" %}<span class="col_vo_els_f_load">{{ next_page_els_count }}</span></button>
<div class="width-100 text-align-center mb-10">
<img class="loader_f_loading_routes" src="{% static "img/svg/loader.svg" %}">
</div>