diff --git a/static/aerbimJS.js b/static/aerbimJS.js index 55f0954..a59d5d7 100644 --- a/static/aerbimJS.js +++ b/static/aerbimJS.js @@ -29,10 +29,14 @@ function sendWidthAjax () { return data } -function renderContent () { +function renderContent (el=null) { let data = sendWidthAjax() - let section_button = document.querySelector(".section_btn") - data['section_url'] = section_button.dataset['url'] + if (!el) { + let section_button = document.querySelector(".section_btn") + data['section_url'] = section_button.dataset['url'] + } else { + data['section_url'] = el.dataset['url'] + } $.ajax({ headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, url: '/get_content_for_section/', @@ -79,6 +83,7 @@ function replaceHrefOnOnclick () { str = str.replace(str_f_replace,'') str = str.replace('"target="_blank""','') cur_el.outerHTML = str + cur_el.setAttribute("onclick",`renderContent(this)`) } i++ }) diff --git a/templates/blocks/dynamic/b_sections_buttons.html b/templates/blocks/dynamic/b_sections_buttons.html index 2b86dcf..eced6b6 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 %}