Advertisement
max2201111

template/index.html

Jun 11th, 2024
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 7.38 KB | Science | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <title>Seznam slovníků</title>
  7.     <style>
  8.         .hidden { display: none; }
  9.         .collapsible { cursor: pointer; text-decoration: underline; color: blue; }
  10.         .container { display: flex; justify-content: space-between; }
  11.         .column { width: 45%; }
  12.     </style>
  13.     <script>
  14.         function toggleVisibility(id) {
  15.             var element = document.getElementById(id);
  16.             if (element.classList.contains('hidden')) {
  17.                 element.classList.remove('hidden');
  18.             } else {
  19.                 element.classList.add('hidden');
  20.             }
  21.         }
  22.     </script>
  23. </head>
  24. <body>
  25.     <h1>Seznam slovníků</h1>
  26.     <div class="container">
  27.         <div class="column">
  28.             <h2>Překlad z angličtiny do češtiny</h2>
  29.             <form method="post" action="/">
  30.                 <input type="hidden" name="direction" value="en_cz">
  31.                 <label for="term">Zadejte termín:</label>
  32.                 <input type="text" id="term" name="term">
  33.                 <button type="submit">Hledat</button>
  34.             </form>
  35.             {% if en_cz_translations %}
  36.                 <ul>
  37.                 {% for term, data in en_cz_translations %}
  38.                     <li>
  39.                         <span class="collapsible" onclick="toggleVisibility('en_cz_translations-{{ loop.index0 }}')">Výsledky pro "{{ term }}":</span>
  40.                         <div id="en_cz_translations-{{ loop.index0 }}" class="hidden">
  41.                             <ul>
  42.                             {% for item in data %}
  43.                                 <li>
  44.                                     <ul>
  45.                                     {% for sens in item %}
  46.                                         <li>
  47.                                             <h2 class="Box-header-title"><span>{{ sens.morf|default('Neznámý druh')|safe }}</span></h2>
  48.                                             <strong>{{ sens.desc|default('Bez popisu')|safe }}</strong> - {{ sens.note|default('')|safe }}
  49.                                             <ul>
  50.                                             {% if sens.trans %}
  51.                                                 <li><strong>Překlad:</strong> {{ sens.trans|join(', ')|safe }}</li>
  52.                                             {% endif %}
  53.                                             {% if sens.coll2 %}
  54.                                                 <li><strong>Kolokace:</strong>
  55.                                                     <ul>
  56.                                                     {% for coll in sens.coll2 %}
  57.                                                         <li>{{ coll|safe }}</li>
  58.                                                     {% endfor %}
  59.                                                     </ul>
  60.                                                 </li>
  61.                                             {% endif %}
  62.                                             {% if sens.samples %}
  63.                                                 <li><strong>Příklady:</strong>
  64.                                                     <ul>
  65.                                                     {% for sample in sens.samples %}
  66.                                                         <li>{{ sample|safe }}</li>
  67.                                                     {% endfor %}
  68.                                                     </ul>
  69.                                                 </li>
  70.                                             {% endif %}
  71.                                             </ul>
  72.                                         </li>
  73.                                     {% endfor %}
  74.                                     </ul>
  75.                                 </li>
  76.                             {% endfor %}
  77.                             </ul>
  78.                         </div>
  79.                     </li>
  80.                 {% endfor %}
  81.                 </ul>
  82.             {% endif %}
  83.         </div>
  84.  
  85.         <div class="column">
  86.             <h2>Překlad z češtiny do angličtiny</h2>
  87.             <form method="post" action="/">
  88.                 <input type="hidden" name="direction" value="cz_en">
  89.                 <label for="term">Zadejte termín:</label>
  90.                 <input type="text" id="term" name="term">
  91.                 <button type="submit">Hledat</button>
  92.             </form>
  93.             {% if cz_en_translations %}
  94.                 <ul>
  95.                 {% for term, data in cz_en_translations %}
  96.                     <li>
  97.                         <span class="collapsible" onclick="toggleVisibility('cz_en_translations-{{ loop.index0 }}')">Výsledky pro "{{ term }}":</span>
  98.                         <div id="cz_en_translations-{{ loop.index0 }}" class="hidden">
  99.                             <ul>
  100.                             {% for item in data %}
  101.                                 <li>
  102.                                     <ul>
  103.                                     {% for sens in item %}
  104.                                         <li>
  105.                                             <h2 class="Box-header-title"><span>{{ sens.morf|default('Neznámý druh')|safe }}</span></h2>
  106.                                             <strong>{{ sens.desc|default('Bez popisu')|safe }}</strong> - {{ sens.note|default('')|safe }}
  107.                                             <ul>
  108.                                             {% if sens.trans %}
  109.                                                 <li><strong>Překlad:</strong> {{ sens.trans|join(', ')|safe }}</li>
  110.                                             {% endif %}
  111.                                             {% if sens.coll2 %}
  112.                                                 <li><strong>Kolokace:</strong>
  113.                                                     <ul>
  114.                                                     {% for coll in sens.coll2 %}
  115.                                                         <li>{{ coll|safe }}</li>
  116.                                                     {% endfor %}
  117.                                                     </ul>
  118.                                                 </li>
  119.                                             {% endif %}
  120.                                             {% if sens.samples %}
  121.                                                 <li><strong>Příklady:</strong>
  122.                                                     <ul>
  123.                                                     {% for sample in sens.samples %}
  124.                                                         <li>{{ sample|safe }}</li>
  125.                                                     {% endfor %}
  126.                                                     </ul>
  127.                                                 </li>
  128.                                             {% endif %}
  129.                                             </ul>
  130.                                         </li>
  131.                                     {% endfor %}
  132.                                     </ul>
  133.                                 </li>
  134.                             {% endfor %}
  135.                             </ul>
  136.                         </div>
  137.                     </li>
  138.                 {% endfor %}
  139.                 </ul>
  140.             {% endif %}
  141.         </div>
  142.     </div>
  143.     {% if error %}
  144.         <p>{{ error }}</p>
  145.     {% endif %}
  146. </body>
  147. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement