diff --git a/static/css/styles(boris).css b/static/css/styles(boris).css index 9e553ca..93d2a21 100644 --- a/static/css/styles(boris).css +++ b/static/css/styles(boris).css @@ -1450,4 +1450,14 @@ .from_address_point_txt.find_route{ +} + +.button-find-more-routes{ + width: 220px; + height: 60px; + background: #FF613A; + color: #FFFFFF; + font-size: 18px; + font-weight: 600; + border-radius: 10px; } \ No newline at end of file diff --git a/static/js/dynamic_loading_routes.js b/static/js/dynamic_loading_routes.js new file mode 100644 index 0000000..a967b80 --- /dev/null +++ b/static/js/dynamic_loading_routes.js @@ -0,0 +1,47 @@ +let page_iterator = 2 + + +function load_routes (el) { + event.preventDefault() + // let el_parent = el.parentNode + // let new_el = el_parent.previousSibling.previousSibling + // let new_el_dataset = new_el.dataset + // if (new_el_dataset){ + // let number_last_route = new_el_dataset['numberOfRoute'] + let number_last_route = el.dataset['lastRoute'] + let data = { + 'from_el':parseInt(number_last_route) + 1, + 'to_el':parseInt(number_last_route) + 11 + } + $.ajax({ + headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, + url: '/ru/routes/find_routes/', + type: "POST", + // async: true, + cache: false, + processData: false, + contentType: false, + // enctype: 'json', + data: JSON.stringify(data), + success: function(data){ + // new_el.parentNode.insertBefore(data.html, new_el.nextSibling); + let url_insert = ".page_routes_" + page_iterator + document.querySelector(url_insert).innerHTML = data.html + let old_page_iterator = page_iterator + page_iterator++ + + let new_page_routes = document.createElement("div") + new_page_routes.classList.add("page_routes_" + page_iterator) + $(new_page_routes).insertAfter(".page_routes_" + old_page_iterator); + // document.querySelector(".info_profile").innerHTML = data.html; + + }, + error: function (data){ + + document.querySelector(".info_profile").innerHTML = data.responseJSON.html; + + } + }); + // } + +} \ No newline at end of file diff --git a/templates/pages/p_results_find_route.html b/templates/pages/p_results_find_route.html index f6afc44..f5579c7 100644 --- a/templates/pages/p_results_find_route.html +++ b/templates/pages/p_results_find_route.html @@ -12,6 +12,7 @@ {% include "connect_ws_js.html" %} + {% endblock %} @@ -52,7 +53,7 @@ minlength="3" name="from_address_point_txt" class="from_address_point_txt find_route first" - {% if form.fields.from_address_point.required %} required{% endif %} +{# {% if form.fields.from_address_point.required %} required{% endif %}#} id="id_from_address_point_txt" {% if form.initial.from_address_point_txt %}value="{{ form.initial.from_address_point_txt }}"{% endif %} /> @@ -88,7 +89,7 @@ autocomplete="off" type="text" name="to_address_point_txt" - {% if form.fields.to_address_point.required %} required{% endif %} +{# {% if form.fields.to_address_point.required %} required{% endif %}#} id="id_to_address_point_txt" class="to_address_point_txt find_route" {% if form.initial.to_address_point_txt %}value="{{ form.initial.to_address_point_txt}}"{% endif %}/> @@ -100,15 +101,15 @@