templates/back/product_page/add.html.twig line 1

Open in your IDE?
  1. {% extends 'base_back.html.twig' %}
  2. {% block title %}Edition {% endblock %}
  3. {% block body %}
  4.     <div class="content-header">
  5.         <div class="container-fluid">
  6.             <div class="row mb-2">
  7.                 <div class="col-sm-6">
  8.                     <h1 class="m-0">Pages produits</h1>
  9.                 </div><!-- /.col -->
  10.             </div><!-- /.row -->
  11.         </div><!-- /.container-fluid -->
  12.     </div>
  13.     <section class="content">
  14.         <div class="container-fluid">
  15.             <!-- Small boxes (Stat box) -->
  16.             <div class="row">
  17.                 <div class="col-12">
  18.                     <div class="card">
  19.                         <div class="card-header">
  20.                             <h3 class="card-title">Ajout d'une Page produit</h3>
  21.                         </div>
  22.                         <!-- /.card-header -->
  23.                         <div class="card-body">
  24.                             {{ include('back/product_page/_form.html.twig') }}
  25.                         </div>
  26.                     </div>
  27.                 </div>
  28.             </div>
  29.         </div>
  30.     </section>
  31. {% endblock %}
  32. {% block javascript %}
  33. {{ parent() }}
  34. <script>
  35. jQuery(document).ready(function () {
  36.     jQuery('.add-another-collection-widget').click(function (e) {
  37.         var list = jQuery(jQuery(this).attr('data-list-selector'));
  38.         // Try to find the counter of the list or use the length of the list
  39.         var counter = list.data('widget-counter') || list.children().length;
  40.         // grab the prototype template
  41.         var newWidget = list.attr('data-prototype');
  42.         // replace the "__name__" used in the id and name of the prototype
  43.         // with a number that's unique to your emails
  44.         // end name attribute looks like name="contact[emails][2]"
  45.         newWidget = newWidget.replace(/__name__/g, counter);
  46.         // Increase the counter
  47.         counter++;
  48.         // And store it, the length cannot be used if deleting widgets is allowed
  49.         list.data('widget-counter', counter);
  50.         // create a new list element and add it to the list
  51.         var newElem = jQuery(list.attr('data-widget-tags')).html(newWidget);
  52.         newElem.appendTo(list);
  53.         addTagFormDeleteLink(newElem);
  54.     });
  55.     function addTagFormDeleteLink($tagFormLi) {
  56.         var $removeItem = $('<button type="button" class="btn btn-danger">Supprimer</button>');
  57.         $tagFormLi.append($removeItem);
  58.         $removeItem.on('click', function(e) {
  59.             var $list = $tagFormLi.parent();
  60.             var count = $list.data('count') - 1;
  61.             e.preventDefault();
  62.             $list = $list.data('count', count);
  63.             $($list.data('counter-element')).text(count);
  64.             $tagFormLi.remove();
  65.             enableAddToTheList($($list.data('add-element')));
  66.         });
  67.     }
  68.     // Summernote
  69.     $('#product_page_description').summernote({
  70.         height: 150
  71.     });
  72.     $('#product_page_benefit').summernote({
  73.         height: 150
  74.     });
  75. });
  76. </script>
  77. {% endblock %}