templates/themesWebsite/blog_cpn/javascripts/page.html.twig line 1

Open in your IDE?
  1. {% if is_granted("ROLE_SUPER_ADMIN") %}
  2.     <script>
  3.         function displayEdit(state) {
  4.             $(".edit-spm").each(function(i) {
  5.                 $(this).css('display',state)
  6.             });
  7.             $(".edit-spmd").each(function(i) {
  8.                 $(this).css('display',state)
  9.             });
  10.             $(".edit-spmc").each(function(i) {
  11.                 $(this).css('display',state)
  12.             });
  13.             $(".edit-spmh").each(function(i) {
  14.                 $(this).css('display',state)
  15.             });
  16.         }
  17.         var isCtrl = false;$(document).keyup(function (e) {
  18.             if(e.which == 17) isCtrl=false;
  19.         }).keydown(function (e) {
  20.             if(e.which == 17) isCtrl=true;
  21.             if(e.which == 66 && isCtrl == true) {
  22.                 var editDisplay = $("#spm").attr('editspm');
  23.                 if(editDisplay == "1") {
  24.                     displayEdit("none");
  25.                     $("#spm").attr('editspm','0');
  26.                 } else {
  27.                     displayEdit("block");
  28.                     $("#spm").attr('editspm','1');
  29.                 }
  30.                 return false;
  31.             }
  32.         });
  33.         $('.edit-spm').click(function (data) {
  34.             $.get(Routing.generate('bo_pageshasblocks_components_edit_cover',{'page':$(this).attr('page'),'id':$(this).attr('item')})).done(function(data2) {
  35.                 $("#show_modal").html(data2);
  36.                 $("#modaldisplay").modal('show');
  37.             });
  38.         });
  39.         $('.edit-spmd').click(function (data) {
  40.             $.get(Routing.generate('bo_pageshasblocks_components_edit_classic',{'page':$(this).attr('page'),'id':$(this).attr('item')})).done(function(data2) {
  41.                 $("#show_modal").html(data2);
  42.                 $("#modaldisplay").modal('show');
  43.             });
  44.         });
  45.         $('.edit-spmh').click(function (data) {
  46.             $.get(Routing.generate('bo_pageshasblocks_components_edit_html',{'page':$(this).attr('page'),'id':$(this).attr('item')})).done(function(data2) {
  47.                 $("#show_modal").html(data2);
  48.                 $("#modaldisplay").modal('show');
  49.             });
  50.         });
  51.          document.getElementByClass('edit-spmh').addEventListener('click', function () {
  52.             // Display the modal
  53.             var modal = document.getElementById('myModal');
  54.             modal.style.display = 'block';
  55.             // Initialize CodeMirror
  56.             setTimeout(function() {
  57.                 var codeArea = document.getElementById('codeArea');
  58.                 CodeMirror.fromTextArea(codeArea, {
  59.                     lineNumbers: true,
  60.                     mode: "javascript"
  61.                 });
  62.             }, 100);
  63.         });
  64.         $('.edit-spmc').click(function (data) {
  65.             $.get(Routing.generate('bo_pageshasblocks_components_edit_custom',{'page':$(this).attr('page'),'id':$(this).attr('item')})).done(function(data2) {
  66.                 $("#show_modal").html(data2);
  67.                 $("#modaldisplay").modal('show');
  68.             });
  69.         });
  70.     </script>
  71. {% endif %}
  72.     {{ page.javascript|raw }}