templates/bundles/SonataTranslationBundle/standard_layout.html.twig line 1

Open in your IDE?
  1. {% extends '@!SonataTranslation/standard_layout.html.twig' %}
  2. {% block html_attributes %}{{ parent() }} lang="{{ app.request.locale }}" {% endblock %}
  3. {% set adminCode = '' %}
  4. {% if admin is defined %}
  5.     {% set adminCode = admin.getCode | pregreplace('/(.*)\\./', '') %}
  6.     {% set cssRoute = 'assets/admin/css/' ~ adminCode ~ '/specific.css' %}
  7.     {% set jsRoute = 'assets/admin/js/' ~ adminCode ~ '/specific.js' %}
  8. {% endif %}
  9. {% block stylesheets %}
  10.     <link rel="icon" type="image/x-icon" href="{{ asset('assets/img/favicon.png') }}">
  11.     {{ parent() }}
  12.     {# CSS para readmore con elipsis - solo primera línea #}
  13.     <style>
  14.         .sonata-readmore {
  15.             display: -webkit-box !important;
  16.             -webkit-line-clamp: 1 !important;
  17.             -webkit-box-orient: vertical !important;
  18.             overflow: hidden !important;
  19.             text-overflow: ellipsis !important;
  20.             cursor: help !important;
  21.             word-wrap: break-word !important;
  22.         }
  23.         @keyframes spin {
  24.             0% { transform: rotate(0deg); }
  25.             100% { transform: rotate(360deg); }
  26.         }
  27.     </style>
  28.     <link rel="stylesheet" href="{{ asset('assets/prometeo/css/list-action-toolbar-prometeo.css') }}">
  29.     <link rel="stylesheet" href="{{ asset('assets/prometeo/css/modal-nav-prometeo.css') }}">
  30.     <link rel="stylesheet" href="{{ asset('assets/prometeo/css/nav-filter-prometeo.css') }}">
  31.     <link rel="stylesheet" href="{{ asset('assets/prometeo/css/nav-prometeo.css') }}">
  32.     <link rel="stylesheet" href="{{ asset('assets/prometeo/css/model-list-type.css') }}">
  33.     <link rel="stylesheet" href="{{ asset('assets/prometeo/css/more-info.css') }}">
  34.     <link rel="stylesheet" href="{{ asset('assets/prometeo/css/table-card.css') }}">
  35.     <link rel="stylesheet" href="{{ asset('assets/plugins/bootstrap-dialog/css/bootstrap-dialog.min.css') }}">
  36.     <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
  37.     <link rel="stylesheet" href="{{ asset('assets/plugins/fontawesome-610/css/all.min.css') }}">
  38.     <link rel="stylesheet" href="{{ asset('assets/plugins/webfonts/uicons-solid-rounded.css') }}">
  39.     <link rel="stylesheet" href="{{ asset('assets/plugins/codemirror/lib/codemirror.css') }}">
  40.     {% if admin is defined and cssRoute is defined %}
  41.         <link rel="stylesheet" href="{{ asset(cssRoute) }}">
  42.     {% endif %}
  43. {% endblock %}
  44. {% block javascripts %}
  45.     {{ parent() }}
  46.     {% include 'JS/translations_js.html.twig' %}
  47.     {% include 'JS/env_js.html.twig' %}
  48.     {% include 'JS/routes_js.html.twig' %}
  49.     <script src="{{ asset("assets/plugins/bootstrap-dialog/js/bootstrap-dialog.min.js") }}"></script>
  50.     <script src="{{ asset("assets/plugins/codemirror/lib/codemirror.js") }}"></script>
  51.     <script src="{{ asset("assets/plugins/codemirror/lib/mode/javascript/javascript.js") }}"></script>
  52.     <script src="{{ asset("assets/plugins/codemirror/lib/mode/twig/twig.js") }}"></script>
  53.     <script src="{{ asset('assets/plugins/autonumeric/autonumeric.min.js') }}"></script>
  54.     <script src="{{ asset('assets/plugins/autonumeric/autonumeric.functions.js') }}"></script>
  55.     <script src="{{ asset("assets/prometeo/js/jquery.functions.js") }}"></script>
  56.     <script src="{{ asset("assets/prometeo/js/table-to-card.js") }}"></script>
  57.     <script src="{{ asset("assets/prometeo/js/nav-prometeo.js") }}"></script>
  58.     <script src="{{ asset("assets/js/nav-prometeo-perseo.js") }}"></script>
  59.     <script src="{{ asset("assets/prometeo/js/pre-load-image.js") }}"></script>
  60.     <script src="{{ asset("assets/prometeo/js/pre-load-file.js") }}"></script>
  61.     <script src="{{ asset("assets/prometeo/js/modal-view-image-original.js") }}"></script>
  62.     <script src="{{ asset("assets/prometeo/js/modal-view-file-original.js") }}"></script>
  63.     <script src="{{ asset("assets/prometeo/js/vichuploader-delete.js") }}"></script>
  64.     <script src="{{ asset("assets/prometeo/js/combos-anidados.js") }}"></script>
  65.     <script src="{{ asset("assets/prometeo/js/slider.js") }}"></script>
  66.     <script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  67.     <script src="{{ asset("assets/js/perseo.js") }}"></script>
  68.     {% if admin is defined and jsRoute is defined %}
  69.         <script src="{{ asset(jsRoute) }}"></script>
  70.     {% endif %}
  71.     <script type="text/javascript">
  72.         $(function(){
  73.             $("form").on("submit", function()
  74.             {
  75.                 $("form").find("input.numeric").getNumericValues();
  76.             });
  77.             $("input.percents").setPercent();
  78.             $("input.numerics").setNumeric();
  79.             $("input.currencies").setCurrency();
  80.             $("input.grams").setGram();
  81.             $(".codemirror-twig").each(function(index, value)
  82.             {
  83.                 CodeMirror.fromTextArea(value, {
  84.                     lineWrapping: true,
  85.                     fixedGutter: false,
  86.                     foldGutter: true,
  87.                     mode: "twig",
  88.                     theme: "darcula",
  89.                     lineNumbers: true,
  90.                     gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
  91.                 });
  92.             });
  93.             {#setInterval(function ()#}
  94.             {#{#}
  95.             {#    {% if object is defined %}#}
  96.             {#        let id = "{{ object.id }}";#}
  97.             {#        let action = id ? "edit":"create";#}
  98.             {#        let username = "{{ app.user.username }}";#}
  99.             {#        let admin = "{{ app.request.attributes.get('_sonata_admin') }}";#}
  100.             {#        let data = $("section.content form").serialize();#}
  101.             {#        // reescribir parte de error, para que no muestre nada.#}
  102.             {#        AjaxUtils.ajaxCall("{{ path('app_api_autosaveapi_autosave') }}", {#}
  103.             {#            user: username,#}
  104.             {#            admin: admin,#}
  105.             {#            action: action,#}
  106.             {#            id: id,#}
  107.             {#            data: data#}
  108.             {#        }, null, "POST");#}
  109.             {#    {% endif %}#}
  110.             {#}, {{ autoSaveTime }});#}
  111.         });
  112.     </script>
  113. {% endblock %}
  114. {% block admin_lte_skin_class %}
  115.     {{ parent() }}
  116.     {{ adminCode }}
  117. {% endblock %}
  118. {% block body_attributes %}
  119.     {{ parent() }}
  120.     {% if admin is defined %}id="{{ admin.code|replace({'.':'_' }) }}"{% endif %}
  121.     {% if admin is defined %}data-code="{{ admin.code }}"{% endif %}
  122. {% endblock %}
  123. {% block sonata_page_content_nav %}
  124.     {% if _navbar_title is not empty
  125.         or _tab_menu is not empty
  126.         or _actions is not empty
  127.         or _list_filters_actions is not empty
  128.         or (admin is defined and admin.hasRoute('export') and admin.hasAccess('export') and export_formats|default(admin.exportFormats) | length)
  129.     %}
  130.         <div class="content-header__title">
  131.             {% if _tab_menu is not empty %}
  132.                 <div class="navbar-left">
  133.                     {{ _tab_menu|raw }}
  134.                 </div>
  135.             {% endif %}
  136.         </div>
  137.         <nav id="navbar-prometeo" class="navbar navbar-default {% if action == 'list' %} action-list {% endif %}" role="navigation">
  138.             <div class="container-fluid">
  139.                 {% block tab_menu_navbar_header %}
  140.                     {% if _navbar_title is not empty %}
  141.                         <div class="navbar-header"></div>
  142.                     {% endif %}
  143.                 {% endblock %}
  144.                 <div class="navbar-collapse">
  145. {#                    {% if _tab_menu is not empty %}#}
  146. {#                        <div class="navbar-left">#}
  147. {#                            {{ _tab_menu|raw }}#}
  148. {#                        </div>#}
  149. {#                    {% endif %}#}
  150. {#                    {% if admin is defined and action is defined and action == 'list' and admin.listModes|length > 1 %}#}
  151. {#                        <div class="nav navbar-right btn-group">#}
  152. {#                            {% for mode, settings in admin.listModes %}#}
  153. {#                                <a href="{{ admin.generateUrl('list', app.request.query.all|merge({_list_mode: mode})) }}" class="btn btn-default navbar-btn btn-sm{% if admin.getListMode() == mode %} active{% endif %}"><i class="{{ settings.class }}"></i></a>#}
  154. {#                            {% endfor %}#}
  155. {#                        </div>#}
  156. {#                    {% endif %}#}
  157.                     {% block sonata_admin_content_actions_wrappers %}
  158. {#                        {% if _actions|replace({ '<li>': '', '</li>': '' })|trim is not empty %}#}
  159. {#                            <ul class="nav navbar-nav navbar-right">#}
  160. {#                                {% if _actions|split('</a>')|length > 2 %}#}
  161. {#                                    <li class="dropdown sonata-actions">#}
  162. {#                                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ 'link_actions'|trans({}, 'SonataAdminBundle') }} <b class="caret"></b></a>#}
  163. {#                                        <ul class="dropdown-menu" role="menu">#}
  164. {#                                            {{ _actions|raw }}#}
  165. {#                                        </ul>#}
  166. {#                                    </li>#}
  167. {#                                {% else %}#}
  168. {#                                    {{ _actions|raw }}#}
  169. {#                                {% endif %}#}
  170. {#                            </ul>#}
  171. {#                        {% endif %}#}
  172.                         {% if action == 'list' %}
  173.                             <form {# action="{{ app.request.pathinfo }}" method="GET" #}>
  174.                         {% endif %}
  175.                         <ul class="nav navbar-nav navbar-left">
  176.                             {% block navbar_actions_filters_prometeo_left %}
  177.                                 {% if action == 'list' %}
  178.                                     {% include 'navbar_actions_filters_prometeo_left_list.html.twig' %}
  179.                                 {% else %}
  180.                                     {% include 'navbar_actions_filters_prometeo_left_edit.html.twig' %}
  181.                                 {% endif %}
  182.                             {% endblock navbar_actions_filters_prometeo_left %}
  183.                         </ul>
  184.                         <ul class="nav navbar-nav navbar-right">
  185.                             {% block navbar_actions_filters_prometeo_right %}
  186.                                 {% if action == 'list' %}
  187.                                     {% include 'navbar_actions_filters_prometeo_right_list.html.twig' %}
  188.                                 {% else %}
  189.                                     {% include 'navbar_actions_filters_prometeo_right_edit.html.twig' %}
  190.                                 {% endif %}
  191.                             {% endblock navbar_actions_filters_prometeo_right %}
  192.                         </ul>
  193.                         {% if action == 'list' %}
  194.                             </form>
  195.                         {% endif %}
  196.                     {% endblock sonata_admin_content_actions_wrappers %}
  197. {#                    {% if _list_filters_actions is not empty %}#}
  198. {#                        {{ _list_filters_actions|raw }}#}
  199. {#                    {% endif %}#}
  200.                 </div>
  201.             </div>
  202.         </nav>
  203.     {% endif %}
  204. {% endblock sonata_page_content_nav %}
  205. {% block sonata_wrapper %}
  206.     <div id="loading-spinner" style="display:none; position:fixed; top:50%; left:50%; transform:translate(-50%, -50%); z-index:9999;">
  207.         <div style="border:4px solid #f3f3f3; border-top:4px solid #3498db; border-radius:50%; width:50px; height:50px; animation:spin 1s linear infinite;"></div>
  208.     </div>
  209.     {{ parent() }}
  210.     <script type="text/javascript">
  211.         loadNavPrometeo($("body"));
  212.         // Deshabilitar readmore completamente
  213.         if (window.Admin && window.Admin.setup_readmore_elements) {
  214.             window.Admin.setup_readmore_elements = function() {
  215.                 // No hacer nada - readmore deshabilitado
  216.             };
  217.         }
  218.         // Spinner de carga
  219.         $('#loading-spinner').css('display', 'flex');
  220.         $(window).on('load', function() {
  221.             $('#loading-spinner').fadeOut();
  222.         });
  223.         // Aplicar popover a elementos con clase sonata-readmore
  224.         $(document).ready(function() {
  225.             $('.sonata-readmore').each(function() {
  226.                 var $el = $(this);
  227.                 var fullText = $el.text();
  228.                 // Añadir popover con Bootstrap (el CSS ya está aplicado)
  229.                 $el.popover({
  230.                     trigger: 'hover',
  231.                     placement: 'top',
  232.                     container: 'body',
  233.                     html: true,
  234.                     content: '<div style="max-width: 400px; max-height: 300px; overflow-y: auto; white-space: pre-wrap;">' + fullText + '</div>'
  235.                 });
  236.             });
  237.         });
  238.         // $parent = $("body");
  239.         // if ($parent.find(".filter-to-navbar-left").html() !== undefined) {
  240.         //     if ($parent.find("#action-create").length === 1) {
  241.         //         $parent.find('#action-create').after('<li id="filter-search">' + $parent.find('.filter-to-navbar-left').html() + '</li>');
  242.         //     } else {
  243.         //         if($parent.find("nav.navbar form > ul.navbar-left").length) {
  244.         //             $parent.find("nav.navbar form > ul.navbar-left").prepend('<li id="filter-search" class="filter-search-margin-left">' + $parent.find('.filter-to-navbar-left').html() + '</li>');
  245.         //         }
  246.         //         else
  247.         //         {
  248.         //             $parent.find("#modal-navbar-prometeo form > ul.navbar-left").prepend('<li id="filter-search" class="filter-search-margin-left">' + $parent.find('.filter-to-navbar-left').html() + '</li>');
  249.         //         }
  250.         //     }
  251.         // }
  252.         //
  253.         // $parent.find('#filter-search > div.filter-field-busqueda').append('<span class="fa fa-search pull-right"></span>');
  254.         // $parent.find('.filter-to-navbar-left').remove();
  255.         //
  256.         // $parent.find('.filter-to-navbar-right').each(function (index, value) {
  257.         //     // Destruimos lo Select2
  258.         //     var $select = $(value).find('select');
  259.         //     $select.each(function (i, item) {
  260.         //         $(item).select2('destroy');
  261.         //     });
  262.         //
  263.         //     $parent.find('#action-export').before('<li id="' + $(value).data('id') + '" data-order="' + $(value).data('order') + '">' + $(value).html() + '</li>');
  264.         //     $(value).remove();
  265.         // });
  266.         //
  267.         // $parent.find('#action-export').attr('data-order', 999998);
  268.         // $parent.find('#show-filters').attr('data-order', 999999).find('span').removeClass('fa-caret-down').addClass('fa-chevron-down');
  269.         //
  270.         // $parent.find('nav ul.navbar-right').each(function () {
  271.         //     $(this).html($(this).children('li').sort(function (a, b) {
  272.         //         return ($(b).data('order')) < ($(a).data('order')) ? 1 : -1;
  273.         //     }));
  274.         // });
  275.         //
  276.         // $parent.find('.content-header__filters-container .prometeo-filters').each(function () {
  277.         //     $(this).html($(this).find('.filter').sort(function (a, b) {
  278.         //         return ($(b).data('order')) < ($(a).data('order')) ? 1 : -1;
  279.         //     }));
  280.         // });
  281.         //
  282.         // // Creamos los Select2
  283.         // $select = $parent.find("nav ul.navbar-right select");
  284.         // $select.each(function (i, item) {
  285.         //     $(item).select2();
  286.         // });
  287.         //
  288.         // var $select = $parent.find(".content-header__filters-container .prometeo-filters select");
  289.         // $select.each(function (i, item) {
  290.         //     $(item).select2("destroy");
  291.         // });
  292.         //
  293.         // $select = $parent.find(".content-header__filters-container .prometeo-filters select");
  294.         // $select.each(function (i, item) {
  295.         //     $(item).select2();
  296.         // });
  297.         //
  298.         // if ($parent.find(".prometeo-filters .filter:not(.no-filter-visible)").length === 1) {
  299.         //     $parent.find("#show-filters > a").attr("title", "No hay Filtros");
  300.         //     $parent.find("#show-filters").addClass("opacity5");
  301.         //     $parent.find(".content-header__filters-container").addClass("hide");
  302.         // }
  303.         //
  304.         // if ($parent.find('.prometeo-filters .filter:not(.no-filter-visible)').length > 1) {
  305.         //     $parent.find('#show-filters').on('click', function () {
  306.         //         if ($parent.find('.prometeo-filters .filter').length > 0) {
  307.         //             if ($(this).hasClass('open')) {
  308.         //                 $(this).removeClass('open');
  309.         //                 $parent.find('.sonata-filters-box').hide();
  310.         //                 $parent.find('.sonata-filters-box .prometeo-filters div').hide();
  311.         //             } else {
  312.         //                 $(this).addClass('open');
  313.         //                 $parent.find('.sonata-filters-box').show();
  314.         //                 $parent.find('.sonata-filters-box .prometeo-filters div').show();
  315.         //             }
  316.         //         }
  317.         //     });
  318.         // }
  319.         //
  320.         // $(".sonata-filters-box").hide();
  321.         // $parent.find(".prometeo-filters .filter:not(.button-filter-submit)").each(function(index, value)
  322.         // {
  323.         //     if($(value).css("display") !== "none")
  324.         //     {
  325.         //         $(".sonata-filters-box").show();
  326.         //         return false;
  327.         //     }
  328.         // });
  329.     </script>
  330. {% endblock sonata_wrapper %}
  331. {% block side_bar_after_nav_content %}
  332.     <a href="{{ path('app_logout') }}"><img id="icon-menu-user" class="icon-menu" title="Logout">{{ app.user.username }}</a>
  333. {% endblock %}