From 5fa470bd9c49c2f9cecd7f66658761e680f9be74 Mon Sep 17 00:00:00 2001 From: borissedw Date: Thu, 5 Oct 2023 19:29:12 +0300 Subject: [PATCH] 0.0.276 --- static/js/dynamic_loading_routes.js | 25 +++++++++++++------ .../static_pages_blocks/b_news_elements.html | 3 ++- templates/pages/p_articles.html | 5 ++-- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/static/js/dynamic_loading_routes.js b/static/js/dynamic_loading_routes.js index b4b0825..65c747e 100644 --- a/static/js/dynamic_loading_routes.js +++ b/static/js/dynamic_loading_routes.js @@ -1,16 +1,21 @@ page_iterator = 2 separator_iterator = 1 -function load_routes (el) { +function load_routes (el,news=null) { let number_last_route = el.id let data_d = { 'from_el':parseInt(number_last_route) + 1, 'to_el':parseInt(number_last_route) + 11 } let get_url = "" - let list = forloop_func_form(data_d,"get",get_url) - data_d = list[0] - get_url = list[1] + let url_ajax = "get_articles_block/" + if (!news){ + let list = forloop_func_form(data_d,"get",get_url) + data_d = list[0] + get_url = list[1] + url_ajax = "routes/find_routes/" + } + let loader = document.querySelector(".loader_f_loading_routes") loader.classList.toggle("show") el.classList.toggle("hide") @@ -25,7 +30,7 @@ function load_routes (el) { $.ajax({ headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, - url: '/ru/routes/find_routes/', + url: `/ru/${url_ajax}`, type: "POST", // async: true, cache: false, @@ -36,8 +41,14 @@ function load_routes (el) { success: function(data){ // new_el.parentNode.insertBefore(data.html, new_el.nextSibling); - let url_insert = ".page_routes_" + page_iterator - let place_ins = document.querySelector(url_insert) + + // + // let url_insert = ".page_routes_" + pasge_iterator + // let place_ins = document.querySelector(url_insert) + // + + + let place_ins = el.parentNode.previousElementSibling.previousElementSibling place_ins.innerHTML = data.html let old_page_iterator = page_iterator page_iterator++ diff --git a/templates/blocks/static_pages_blocks/b_news_elements.html b/templates/blocks/static_pages_blocks/b_news_elements.html index 95eefe0..56370d8 100644 --- a/templates/blocks/static_pages_blocks/b_news_elements.html +++ b/templates/blocks/static_pages_blocks/b_news_elements.html @@ -18,4 +18,5 @@ {% endif %} {#
{{ art.text|safe }}
#} {% endfor %} - \ No newline at end of file + +
\ No newline at end of file diff --git a/templates/pages/p_articles.html b/templates/pages/p_articles.html index d61c22e..540beb8 100644 --- a/templates/pages/p_articles.html +++ b/templates/pages/p_articles.html @@ -37,12 +37,13 @@ {% if last_block == False %}
- + {% csrf_token %} +
{% endif %} - +{# boris edited end#} {% endblock %} \ No newline at end of file