base.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <!DOCTYPE html>
  2. <html lang="{{ get_locale() }}">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta name="csrf-token" content="{{ csrf_token() }}">
  7. <meta name="description" content="{{ meta_description or _('SquidStats: panel de monitorización, estadísticas y administración para servidores proxy Squid.') }}">
  8. <title>{{ page_title or 'Dashboard Squid' }}</title>
  9. <!-- Dynamic favicon -->
  10. <link rel="icon" href="{{ url_for('static', filename=page_icon) }}" type="image/x-icon"/>
  11. <!-- Stylesheets -->
  12. <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}"/>
  13. <link rel="stylesheet" href="{{url_for('static',filename='dist/output.css')}}"/> <!-- Tailwind CSS -->
  14. <link rel="preload" href="{{ url_for('static', filename='webfonts/fa-solid-900.woff2') }}" as="font" type="font/woff2" crossorigin>
  15. <link rel="stylesheet" href="{{ url_for('static', filename='all.min.css') }}"/> <!-- Font Awesome -->
  16. <!-- Toastr CSS -->
  17. <link rel="stylesheet" href="{{ url_for('static', filename='css/toastr.min.css') }}"/>
  18. <!-- Toastr Custom CSS -->
  19. <link rel="stylesheet" href="{{ url_for('static', filename='css/toastr-custom.css') }}"/>
  20. <!-- Page-specific styles -->
  21. {% block styles %}{% endblock styles %}
  22. </head>
  23. <body class="overflow-x-hidden overflow-auto" style="visibility: hidden" onload="document.body.style.visibility='visible';">
  24. <!-- Common navigation bar -->
  25. <div class="relative">
  26. {% include 'components/navbar.html' %}
  27. <!-- Main content with MORE SPACE for the navbar -->
  28. <main class="min-h-screen pt-16 lg:pt-20 pb-20">
  29. <!-- UNIFIED MAIN CONTAINER -->
  30. <div class="w-full px-4 sm:px-6 lg:px-8">
  31. {% block header %}
  32. <!-- Default header - IMPROVED FOR RESPONSIVE -->
  33. <div class="max-w-7xl mx-auto flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4 mb-8">
  34. <!-- Title and subtitle -->
  35. <div class="flex items-center flex-shrink-0">
  36. {% if icon %}
  37. <i class="{{icon}} text-2xl sm:text-3xl text-blue-600 mr-3 sm:mr-4"></i>
  38. {% endif %}
  39. <div class="min-w-0">
  40. <h1 class="text-2xl sm:text-3xl font-bold text-gray-800 truncate">{{page_title}}</h1>
  41. <p class="text-gray-500 text-sm sm:text-base mt-1 line-clamp-2">
  42. {{subtitle}}
  43. </p>
  44. </div>
  45. </div>
  46. <!-- Header actions area - editable by pages -->
  47. <div class="flex items-center justify-start lg:justify-end flex-wrap gap-2 sm:gap-3 min-w-0">
  48. {% block header_actions %}
  49. <!-- Empty by default - pages can add content here -->
  50. {% endblock %}
  51. </div>
  52. </div>
  53. {% endblock %}
  54. <!-- Content area - editable by pages -->
  55. <div class="max-w-7xl mx-auto w-full">
  56. {% block content %}{% endblock %}
  57. </div>
  58. </div>
  59. </main>
  60. </div>
  61. <!-- Footer -->
  62. {% include 'components/footer.html' %}
  63. <!-- Socket.IO -->
  64. <script src="{{ url_for('static', filename='js/socket.io.min.js') }}"></script>
  65. <!-- Flowbite scripts (UI components) -->
  66. <script src="{{ url_for('static', filename='src/flowbite.min.js') }}"></script>
  67. <!-- jQuery (requerido por toastr) -->
  68. <script src="{{ url_for('static', filename='js/jquery-4.0.0.min.js') }}"></script>
  69. <!-- Toastr JS -->
  70. <script src="{{ url_for('static', filename='js/toastr.min.js') }}"></script>
  71. <!-- Configuración global de Toastr -->
  72. <script src="{{ url_for('static', filename='js/toastr-config.js') }}"></script>
  73. <!-- i18n translations for JavaScript -->
  74. <script>
  75. window._i18n = window._i18n || {};
  76. window._i18n.locale = "{{ get_locale() }}";
  77. window.__ = function(key) { return (window._i18n.translations && window._i18n.translations[key]) || key; };
  78. fetch("{{ url_for('i18n.get_translations') }}")
  79. .then(function(r) { return r.json(); })
  80. .then(function(data) { window._i18n.translations = data; })
  81. .catch(function() {});
  82. </script>
  83. <!-- Flash messages via toastr -->
  84. {% with messages = get_flashed_messages(with_categories=true) %}
  85. {% if messages %}
  86. <script>
  87. document.addEventListener('DOMContentLoaded', function () {
  88. {% for category, message in messages %}
  89. {% if category == 'success' %}
  90. toastr.success({{ message | tojson }});
  91. {% elif category == 'error' %}
  92. toastr.error({{ message | tojson }});
  93. {% elif category == 'warning' %}
  94. toastr.warning({{ message | tojson }});
  95. {% else %}
  96. toastr.info({{ message | tojson }});
  97. {% endif %}
  98. {% endfor %}
  99. });
  100. </script>
  101. {% endif %}
  102. {% endwith %}
  103. <!-- Page-specific scripts -->
  104. {% block scripts %}{% endblock scripts %}
  105. </body>
  106. </html>