Mass.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. {{define "Mass"}}
  2. <script>
  3. // Список ссылок на материалы
  4. let m = ["Contract", "Schedule"];
  5. document.addEventListener("DOMContentLoaded", function(){
  6. VKKOWork.XHR.POST(function(result) {
  7. let Materials = document.querySelector(".main-article");
  8. if (Materials && "Materials" in result && result != null) {
  9. let articles = '';
  10. for (let m of result.Materials) {
  11. articles += '<article class="main-article">';
  12. {{if eq .IsAdmin true}}
  13. articles += '<div class="material-tool-group"><div class="edit-material-button tool-button" data-category="материал" data-link="'+m.Link+'"><i class="fas fa-pencil-alt"></i></div>';
  14. if (m.Active) {
  15. articles += '<div class="delete-material-button tool-button" data-active="true" data-link="'+m.Link+'"><i class="fas fa-times"></i></div></div>';
  16. } else {
  17. articles += '<div class="delete-material-button tool-button" data-active="false" data-link="'+m.Link+'"><i class="fas fa-redo-alt"></i></div></div><div style="margin: 20px;color: red;text-align: center;">Материал удалён</div>';
  18. }
  19. {{end}}
  20. articles += '<h1>' + m.Caption + '</h1>' + m.Content + '</article>';
  21. }
  22. Materials.outerHTML = articles;
  23. VKKO.MaterialEditor.initButton();
  24. }
  25. }, "/get-materials", {List: m});
  26. });
  27. </script>
  28. {{end}}