diff --git a/static/aerbimJS.js b/static/aerbimJS.js index dc557fd..b9d1e91 100644 --- a/static/aerbimJS.js +++ b/static/aerbimJS.js @@ -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++ + }) +} \ No newline at end of file diff --git a/templates/blocks/b_service.html b/templates/blocks/b_service.html new file mode 100644 index 0000000..c0c6819 --- /dev/null +++ b/templates/blocks/b_service.html @@ -0,0 +1,32 @@ +{% load static %} +{% load i18n %} +
+ {% for service in services %} +
+ {% if sub_serv.picture %} +
+ +
+ {% endif %} +
+ {{ service.name }} +
+ {% if service.rel_children_for_service.all %} + {% for sub_serv in service.rel_children_for_service.all %} +
+
+ {% if sub_serv.picture %} +
+ +
+ {% endif %} +
+ {{ sub_serv.name }} +
+
+
+ {% endfor %} + {% endif %} +
+ {% endfor %} +
\ No newline at end of file diff --git a/templates/blocks/dynamic/b_sections_buttons.html b/templates/blocks/dynamic/b_sections_buttons.html index 19bc1da..17a48b6 100644 --- a/templates/blocks/dynamic/b_sections_buttons.html +++ b/templates/blocks/dynamic/b_sections_buttons.html @@ -2,7 +2,7 @@
{% for section in sections %} - +
{{ section.name }}
{% endfor %} diff --git a/templates/pages/content/c_projectiing_section.html b/templates/pages/content/c_projectiing_section.html index b6dc343..f0aef92 100644 --- a/templates/pages/content/c_projectiing_section.html +++ b/templates/pages/content/c_projectiing_section.html @@ -1 +1,2 @@ {% include 'blocks/dynamic/b_sections_buttons.html' %} +{% include 'blocks/b_service.html' %} \ No newline at end of file