templates/vitrine/components/javascripts/homepage.html.twig line 1

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