templates/default/index.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block metas %}
  3.     <meta name="description" content="Encuentra los mejores menús cerca de ti.">
  4.     <meta property="og:title" content="Menu del dia"/>
  5.     <meta property="og:url" content="{{ url(app.request.attributes.get("_route"), app.request.attributes.get("_route_params")) }}"/>
  6.     <meta property="og:description" content="Encuentra los mejores menús cerca de ti.">
  7.     <meta property="og:image" itemprop="image" content="https://menusdeldia.com/uploads/menu.jpg">
  8. {% endblock %}
  9. {% block stylesheets %}
  10.     {{ parent() }}
  11.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.3.1/css/ion.rangeSlider.min.css"/>
  12. {% endblock %}
  13. {% block javascripts %}
  14.     {{ parent() }}
  15.     <script src="https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.3.1/js/ion.rangeSlider.min.js"></script>
  16. {% endblock %}
  17. {% block title %}Menu del dia
  18. {% endblock %}
  19. {% block body %}
  20.     <div id="image-header" class="position-relative overflow-hidden p-3 p-md-5 text-center">
  21.         <div id="search-header" class="col-md-9 col-lg-8 col-xl-7 col-xxl-6 p-3 p-sm-5 mx-auto my-5 bg-white rounded">
  22.             <h1 class="fs-3 fw-normal">Encuentra tu menú del día</h1>
  23.             <p class="fw-lighter fst-italic">Menús actualizados de restaurantes cerca de tí.</p>
  24.             <div class="search">
  25.                 <i class="fa fa-search"></i>
  26.                 <form action="{{ path('menus') }}" method="post" role="form" enctype="multipart/form-data" class="w-100">
  27.                     <input id="input_address" type="text" class="form-control" placeholder="¿Donde deseas buscar Menú?">
  28.                     <button id="btn-search" class="btn">Ubicación Actual</button>
  29.                     <input id="input_lat" name="latActual" type="hidden">
  30.                     <input id="input_lng" name="lngActual" type="hidden">
  31.                 </form>
  32.             </div>
  33.         </div>
  34.     </div>
  35.     <div id="background-header" class="position-relative overflow-hidden p-3 p-lg-5 text-center">
  36.         <div class="row col-lg-9 col-xl-7 p-lg-2 mx-auto my-5">
  37.             <div class="col-sm-6 col-lg-7">
  38.                 <h2 class="fs-4 fw-bold">Encuentra tu menú preferido tambien desde el móvil</h2>
  39.                 <p class="fw-lighter fst-italic">Ya disponible la app de Menus del día para iOS y Android.</p>
  40.                 <div class="row col-12">
  41.                     <div class="col-6">
  42.                         <a href="#" title="Descargar App Menus del día">
  43.                             <img class="img-responsive" src="/img/app-ios-banner.png" alt="Iphone Android App Menus del día" width="80%">
  44.                         </a>
  45.                     </div>
  46.                     <div class="col-6">
  47.                         <a href="#" title="Descargar App Menus del día">
  48.                             <img class="img-responsive" src="/img/app-android-banner.png" alt="Iphone Android App Menus del día" width="80%">
  49.                         </a>
  50.                     </div>
  51.                 </div>
  52.             </div>
  53.             <div class="col-sm-6 col-lg-5 mt-5 m-sm-0">
  54.                 <a href="#" title="Descargar App Menus del día">
  55.                     <img class="img-responsive" src="/img/app-iphone-android.png" alt="Iphone Android App Menus del día" width="50%">
  56.                 </a>
  57.             </div>
  58.         </div>
  59.     </div>
  60. {% endblock %}
  61. {% block postjavascripts %}
  62.     {{ parent() }}
  63.     <script src="https://maps.googleapis.com/maps/api/js?key={{ google_key }}&libraries=places"></script>
  64.     <!-- parse-ignore-start -->
  65.     <script>
  66.         $(document).ready(function () {
  67.             $("#btn-search").click(function() {
  68.                 $("form").submit();
  69.             });  
  70.             
  71.             var placeSearch, autocomplete;
  72.             var componentForm = {
  73.                 street_number: 'short_name',
  74.                 route: 'long_name',
  75.                 locality: 'long_name',
  76.                 administrative_area_level_1: 'short_name',
  77.                 country: 'long_name',
  78.                 postal_code: 'short_name'
  79.             };
  80.             var element1 = $("[id*=_address]");
  81.             var element2 = $("[id*=_lat]");
  82.             var element3 = $("[id*=_lng]");
  83.             var input_direccion;
  84.             var input_lng;
  85.             var input_lat;
  86.             if (element1[0]) {
  87.                 input_direccion = element1[0].id;
  88.             }
  89.             if (element2[0]) {
  90.                 input_lat = element2[0].id;
  91.             }
  92.             if (element3[0]) {
  93.                 input_lng = element3[0].id;
  94.             }
  95.             if (input_direccion != null) {
  96.                 autocomplete = new google.maps.places.Autocomplete((document.getElementById(input_direccion)), {types: ['geocode']});
  97.                 autocomplete.addListener('place_changed', fillInAddress);
  98.                 autocomplete.addListener('place_changed', function () {                    
  99.                     var place = autocomplete.getPlace();
  100.                     if (!place.geometry) {
  101.                         window.alert("Autocomplete's returned place contains no geometry");
  102.                         return;
  103.                     }
  104.                     var address = '';
  105.                     if (place.address_components) {
  106.                         address = [
  107.                             (place.address_components[0] && place.address_components[0].short_name || ''),
  108.                             (place.address_components[1] && place.address_components[1].short_name || ''),
  109.                             (place.address_components[2] && place.address_components[2].short_name || '')
  110.                         ].join(' ');
  111.                     }
  112.                 });
  113.             }
  114.             function fillInAddress() {
  115.                 // Get the place details from the autocomplete object.
  116.                 var place = autocomplete.getPlace();
  117.                 document.getElementById(input_lat).value = place.geometry.location.lat();
  118.                 document.getElementById(input_lng).value = place.geometry.location.lng();
  119.                 $("form").submit();
  120.             }            
  121.         });
  122.     </script>
  123.     <!-- parse-ignore-end -->
  124. {% endblock %}