0.0.11
This commit is contained in:
@@ -39,9 +39,28 @@ function renderContent () {
|
||||
data: JSON.stringify(data),
|
||||
success: function(data){
|
||||
document.querySelector(".content").innerHTML = data.html
|
||||
replaceHrefOnOnclick()
|
||||
},
|
||||
error: function (data){
|
||||
alert(data)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function replaceHrefOnOnclick () {
|
||||
let elements = document.querySelectorAll('.section_btn')
|
||||
let i = 0
|
||||
elements.forEach(function (){
|
||||
let cur_el = elements[i]
|
||||
if (cur_el.attributes.hasOwnProperty("href")){
|
||||
let str = cur_el.outerHTML
|
||||
let str_f_replace = cur_el.href
|
||||
str_f_replace = str_f_replace.replace(`${window.location.origin}`,'')
|
||||
str_f_replace = `href="${str_f_replace}"`
|
||||
str = str.replace(str_f_replace,'')
|
||||
str = str.replace('"target="_blank""','')
|
||||
cur_el.outerHTML = str
|
||||
}
|
||||
i++
|
||||
})
|
||||
}
|
||||
32
templates/blocks/b_service.html
Normal file
32
templates/blocks/b_service.html
Normal file
@@ -0,0 +1,32 @@
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
<div class="services_block">
|
||||
{% for service in services %}
|
||||
<div class="service_container">
|
||||
{% if sub_serv.picture %}
|
||||
<div class="left_part_service">
|
||||
<img class="service_img" src="{{ MEDIA_URL }}{{ service.picture }}">
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="right_part_service {% if sub_serv.picture %}w_100{% endif %}">
|
||||
{{ service.name }}
|
||||
</div>
|
||||
{% if service.rel_children_for_service.all %}
|
||||
{% for sub_serv in service.rel_children_for_service.all %}
|
||||
<div class="services_block">
|
||||
<div class="service_container">
|
||||
{% if sub_serv.picture %}
|
||||
<div class="left_part_service">
|
||||
<img class="service_img" src="{{ MEDIA_URL }}{{ sub_serv.picture }}">
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="right_part_service {% if not sub_serv.picture %}w_100{% endif %}">
|
||||
{{ sub_serv.name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="container_sections_buttons">
|
||||
<div class="cut-width container_content_sections_buttons">
|
||||
{% for section in sections %}
|
||||
<a href="{% url 'section_page' section.url %}" class="section_btn {% if section == cur_section %}open{% else %}close{% endif %} standart_txt" data-url="{{ section.url }}">
|
||||
<a href="{% url 'section_page' section.url %}" target="_blank" class="section_btn {% if section == cur_section %}open{% else %}close{% endif %} standart_txt" data-url="{{ section.url }}">
|
||||
<div class="txt_section standart_txt">{{ section.name }}</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
{% include 'blocks/dynamic/b_sections_buttons.html' %}
|
||||
{% include 'blocks/b_service.html' %}
|
||||
Reference in New Issue
Block a user