Add i18n, add IDPA target

This commit is contained in:
bogo
2024-09-18 22:56:30 +02:00
parent 3e9153dedf
commit bde8563748
19 changed files with 222 additions and 71 deletions

View File

@@ -26,9 +26,9 @@
</style>
</head>
<body class="bg-gray-100 font-sans">
<div class="max-w-4xl mx-auto p-6 bg-white shadow-md rounded-lg mt-10">
<div class="max-w-4xl mx-auto p-6 bg-white shadow-md rounded-lg mt-10">
<h1 class="text-2xl font-bold mb-6 text-center text-gray-700">Paper Challenge</h1>
<h2 class="my-10 mx-auto text-center font-bold text-xl">Wygeneruj tor {% block title %}{% endblock %}</h2>
<h2 class="my-10 mx-auto text-center font-bold text-xl">{% trans %}Generate stage for{% endtrans %} {% block title %}{% endblock %}</h2>
<div class="flex justify-center gap-6">
<a href="{{ url_for('index') }}"
class="{{ 'shadow-inner shadow-blue-900' if current_url == url_for('index') else '' }} bg-blue-500 text-white py-2 px-4 rounded-md hover:bg-blue-600 transition-colors">
@@ -40,10 +40,18 @@
</a>
<a href="{{ url_for('ipsc') }}"
class="{{ 'shadow-inner shadow-blue-900' if current_url == url_for('ipsc') else '' }} bg-blue-500 text-white py-2 px-4 rounded-md hover:bg-blue-600 transition-colors">
IPSC - El Presidente
El Presidente
</a>
</div>
<div class="flex justify-center mt-4">
<a href="https://buycoffee.to/bogson" target="_blank"
class="bg-green-500 text-white py-2 px-4 rounded-md hover:bg-green-600 transition-colors">
Wesprzyj projekt
</a>
</div>
{% block content %}{% endblock %}
</div>
</body>
</html>

View File

@@ -0,0 +1,7 @@
<div class="preview-target w-[{{preview_target_width}}cm] h-[{{preview_target_height}}cm]" style="left: {{(preview_margin + i * preview_gap)}}cm;">
<svg width="{{preview_target_width}}cm" height="{{preview_target_height}}cm" viewBox="0 0 460 780" xmlns="http://www.w3.org/2000/svg">
<path d="M145 0 315 0 315 150 385 150 460 225 460 650 385 780 75 780 0 650 0 225 75 150 145 150Z" fill="#CD9F61" stroke="#A97835"/>
<path d="M145 150 315 150 385 225 385 460 320 620 150 620 85 460 85 225 145 150Z" fill="#CD9F61" stroke="#A97835"/>
<path d="M230 192.5 A102.5 102.5 0 1 1 229.99 192.5Z" fill="#CD9F61" stroke="#A97835"/>
</svg>
</div>

5
templates/idpa_svg.html Normal file
View File

@@ -0,0 +1,5 @@
<svg style="display: block; margin: auto;" width="{{target_width}}cm" height="{{target_height}}cm" viewBox="0 0 460 780" xmlns="http://www.w3.org/2000/svg">
<path d="M145 0 315 0 315 150 385 150 460 225 460 650 385 780 75 780 0 650 0 225 75 150 145 150Z" fill="#CD9F61" stroke="#A97835"/>
<path d="M145 150 315 150 385 225 385 460 320 620 150 620 85 460 85 225 145 150Z" fill="#CD9F61" stroke="#A97835"/>
<path d="M230 192.5 A102.5 102.5 0 1 1 229.99 192.5Z" fill="#CD9F61" stroke="#A97835"/>
</svg>

After

Width:  |  Height:  |  Size: 511 B

View File

@@ -1,21 +1,35 @@
{% extends "base.html" %}
{% block title %}IPSC - El Presidente{% endblock %}
{% block title %}El Presidente{% endblock %}
{% block content %}
<form class="" action="/generate-pdf-ipsc" method="post">
{% include 'setup.html' %}
<div class="mb-6 max-w-2xl mx-auto">
<h2>IPSC - El Presidente</h2>
<h2>{%trans%}Select the stage{%endtrans%}</h2>
<div class="mb-6 max-w-2xl mx-auto mt-4">
<img class="mx-auto" src="{{ url_for('static', filename='images/el_presidente_preview.webp') }}" alt="IPSC - El Presidente">
<div id="stage" class="grid grid-cols-1 gap-4">
<div>
<label for="ipsc">
<p>IPSC</p>
<img src="{{ url_for('static', filename='images/ipsc_el_presidente.webp') }}" alt="IPSC">
<input type="radio" id="ipsc" name="target_type" value="ipsc" required>
</label>
</div>
<div>
<label for="idpa">
<p>IDPA</p>
<img src="{{ url_for('static', filename='images/idpa_el_presidente.webp') }}"
alt="IDPA">
<input type="radio" id="idpa" name="target_type" value="idpa">
</label>
</div>
</div>
</div>
<div class="text-center">
<button type="submit"
class="bg-green-500 text-white py-2 px-4 rounded-md hover:bg-green-600 transition-colors">
Generuj
{%trans%}Generate PDF{%endtrans%}
</button>
</div>
</form>

View File

@@ -0,0 +1,7 @@
<div class="preview-target w-[{{preview_target_width}}cm] h-[{{preview_target_height}}cm]" style="left: {{(preview_margin + i * preview_gap)}}cm;">
<svg width="{{preview_target_width}}cm" height="{{preview_target_height}}cm" viewBox="0 0 450 570" xmlns="http://www.w3.org/2000/svg">
<path d="M150 0 0 190 0 380 150 570 300 570 450 380 450 190 300 0Z" fill="#CD9F61" stroke="#A97835"/>
<path d="M150 0 75 190 75 335 175 450 275 450 375 335 375 190 300 0Z" fill="#CD9F61" stroke="#A97835"/>
<path d="M200 25 150 190 150 275 200 350 250 350 300 275 300 190 250 25Z" fill="#CD9F61" stroke="#A97835"/>
</svg>
</div>

5
templates/ipsc_svg.html Normal file
View File

@@ -0,0 +1,5 @@
<svg style="display: block; margin: auto;" width="{{target_width}}cm" height="{{target_height}}cm" viewBox="0 0 450 570" xmlns="http://www.w3.org/2000/svg">
<path d="M150 0 0 190 0 380 150 570 300 570 450 380 450 190 300 0Z" fill="#CD9F61" stroke="#A97835"/>
<path d="M150 0 75 190 75 335 175 450 275 450 375 335 375 190 300 0Z" fill="#CD9F61" stroke="#A97835"/>
<path d="M200 25 150 190 150 275 200 350 250 350 300 275 300 190 250 25Z" fill="#CD9F61" stroke="#A97835"/>
</svg>

After

Width:  |  Height:  |  Size: 489 B

View File

@@ -82,17 +82,15 @@
{% endfor %}
</div>
<p>Wymagana długość ściany: {{ wall_length/10 }}cm</p>
<p>Odległość od ściany: {{ distance|round(1,'ceil') }}cm</p>
<p>Przygotowanie toru:</p>
<p>{%trans%}Wall length required{%endtrans%}: {{ wall_length/10 }}cm</p>
<p>{%trans%}Distance from wall{%endtrans%}: {{ distance|round(1,'ceil') }}cm</p>
<p>{%trans%}Stage preparation{%endtrans%}:</p>
<ul>
<li>Umieść z lewej strony ściany pierwszy cel ze znacznikiem "punkt ZERO"</li>
<li>Wyznacz pole startowe {{ box_position }}cm od punktu "zero" (wzdłuż ściany) oraz w odległości {{distance}}cm od ściany</li>
<li>Upewnij się, że pole startowe znjaduje się w dogodnym miejscu, pomieszczenia, tak aby nic nie przeszkazdało
w swobodnym dobyciu i składaniu do celów na całej szerokości ściany
</li>
<li>W razie potrzeby dostosuj pierwszy cel wraz z punktem ZERO i powtórz dwa powyższe kroki</li>
<li>Umieść na ścianie pozostałe cele zgodnie z odległościami podanymi na znacznikach pozycji na dole każdego celu. Upewnij się, że wszystkie cele są umieszczone w jednej linii równoległej do podłoża</li>
<li>{%trans%}Place the first target with the 'ZERO point' marker on the left side of the wall{%endtrans%}</li>
<li>{%trans%}Set shooting box{%endtrans%} {{ box_position }}cm {%trans%}from 'ZERO' point (along the wall) and{%endtrans%} {{distance}}cm {%trans%}from the wall{%endtrans%}</li>
<li>{%trans%}Ensure that the starting field is positioned in a convenient location within the room, so that nothing obstructs the drawing and aiming at targets across the entire width of the wall{%endtrans%}</li>
<li>{%trans%}If necessary, adjust the first target along with the ZERO point and repeat the two previous steps{%endtrans%}</li>
<li>{%trans%}Place the remaining targets on the wall according to the distances indicated on the position markers at the bottom of each target. Ensure that all targets are aligned in a single line parallel to the ground{%endtrans%}</li>
</ul>
</div>
@@ -111,9 +109,9 @@
</div>
</div>
{% if target.target == 't1' %}
<div class="mounting-info">punkt ZERO ({{ stage.split('_') | map('capitalize') | join(' ') }})</div>
<div class="mounting-info">{%trans%}ZERO point{%endtrans%} ({{ stage.split('_') | map('capitalize') | join(' ') }})</div>
{% else %}
<div class="mounting-info">{{ target.position / 10 }}cm od punktu ZERO ({{ stage.split('_') | map('capitalize') | join(' ') }})</div>
<div class="mounting-info">{{ target.position / 10 }}cm {%trans%}from ZERO point{%endtrans%} ({{ stage.split('_') | map('capitalize') | join(' ') }})</div>
{% endif %}
<div class="mounting-point"></div>
</div>

View File

@@ -66,44 +66,44 @@
<h2>IPSC - El Presidente</h2>
<div class="preview">
{% for i in range(3) %}
<div class="preview-target w-[{{preview_target_width}}cm] h-[{{preview_target_height}}cm]" style="left: {{(preview_margin + i * preview_gap)}}cm;">
<svg width="{{preview_target_width}}cm" height="{{preview_target_height}}cm" viewBox="0 0 450 570" xmlns="http://www.w3.org/2000/svg">
<path d="M150 0 0 190 0 380 150 570 300 570 450 380 450 190 300 0Z" fill="#CD9F61" stroke="#A97835"/>
<path d="M150 0 75 190 75 335 175 450 275 450 375 335 375 190 300 0Z" fill="#CD9F61" stroke="#A97835"/>
<path d="M200 25 150 190 150 275 200 350 250 350 300 275 300 190 250 25Z" fill="#CD9F61" stroke="#A97835"/>
</svg>
</div>
{% with preview_target_width = preview_target_width, preview_target_height = preview_target_height, preview_margin = preview_margin, preview_gap = preview_gap %}
{%if target_type == 'ipsc' %}
{%include 'ipsc_preview_svg.html'%}
{%else%}
{%include 'idpa_preview_svg.html'%}
{%endif%}
{% endwith %}
{% endfor %}
</div>
<p>Wymagana długość ściany: {{ wall_length|round(1,'ceil') }}cm</p>
<p>Odległość od ściany: {{ distance|round(1,'ceil') }}cm</p>
<p>Przygotowanie toru:</p>
<p>{%trans%}Wall length required{%endtrans%}: {{ wall_length|round(1,'ceil') }}cm</p>
<p>{%trans%}Distance from wall{%endtrans%}: {{ distance|round(1,'ceil') }}cm</p>
<p>{%trans%}Stage preparation{%endtrans%}:</p>
<ul>
<li>Umieść z lewej lub prawej strony ściany pierwszy cel ze znacznikiem "punkt ZERO"</li>
<li>Wyznacz pole startowe {{ box_position|round(1,'ceil') }}cm od punktu "zero" (wzdłuż ściany) oraz w odległości {{distance}}cm od ściany</li>
<li>Upewnij się, że pole startowe znjaduje się w dogodnym miejscu, pomieszczenia, tak aby nic nie
przeszkazdało
w swobodnym dobyciu i składaniu do celów na całej szerokości ściany
</li>
<li>W razie potrzeby dostosuj pierwszy cel wraz z punktem ZERO i powtórz dwa powyższe kroki</li>
<li>Umieść na ścianie pozostałe cele zgodnie z odległościami podanymi na znacznikach pozycji na dole każdego
celu. Upewnij się, że wszystkie cele są umieszczone w jednej linii równoległej do podłoża</li>
<li>{%trans%}Place the first target with the 'ZERO point' marker on the left or right side of the wall{%endtrans%}</li>
<li>{%trans%}Set shooting box{%endtrans%} {{ box_position|round(1,'ceil') }}cm {%trans%}from 'ZERO' point (along the wall) and{%endtrans%} {{distance}}cm {%trans%}from the wall{%endtrans%}</li>
<li>{%trans%}Ensure that the starting field is positioned in a convenient location within the room, so that nothing obstructs the drawing and aiming at targets across the entire width of the wall{%endtrans%}</li>
<li>{%trans%}If necessary, adjust the first target along with the ZERO point and repeat the two previous steps{%endtrans%}</li>
<li>{%trans%}Place the remaining targets on the wall according to the distances indicated on the position markers at the bottom of each target. Ensure that all targets are aligned in a single line parallel to the ground{%endtrans%}</li>
</ul>
</div>
{% for i in range(3) %}
<div class="page-break">
<div class="content">
<svg style="display: block; margin: auto;" width="{{target_width}}cm" height="{{target_height}}cm" viewBox="0 0 450 570" xmlns="http://www.w3.org/2000/svg">
<path d="M150 0 0 190 0 380 150 570 300 570 450 380 450 190 300 0Z" fill="#CD9F61" stroke="#A97835"/>
<path d="M150 0 75 190 75 335 175 450 275 450 375 335 375 190 300 0Z" fill="#CD9F61" stroke="#A97835"/>
<path d="M200 25 150 190 150 275 200 350 250 350 300 275 300 190 250 25Z" fill="#CD9F61" stroke="#A97835"/>
</svg>
{% with target_width=target_width, target_height=target_height %}
{%if target_type == 'ipsc' %}
{%include 'ipsc_svg.html'%}
{%else%}
{%include 'idpa_svg.html'%}
{%endif%}
{% endwith %}
{% if i==0 %}
<div class="mounting-info">punkt ZERO (El Presidente)</div>
<div class="mounting-info">{%trans%}ZERO point{%endtrans%} (El Presidente)</div>
{% else %}
<div class="mounting-info">{{ i * gap|round(1,'ceil') }}cm od punktu ZERO (El Presidente)</div>
<div class="mounting-info">{{ i * gap|round(1,'ceil') }}cm {%trans%}from ZERO point{%endtrans%} (El Presidente)</div>
{% endif %}
<div class="mounting-point"></div>
</div>

View File

@@ -109,22 +109,16 @@
{% endif %}
{% endfor %}
</div>
<p>Wymagana długość ściany: {{ wall_length|round(1,'ceil') }}cm</p>
<p>Odległość od ściany: {{ distance|round(1,'ceil') }}cm</p>
<p>Przygotowanie toru:</p>
<p>{%trans%}Wall length required{%endtrans%}: {{ wall_length|round(1,'ceil') }}cm</p>
<p>{%trans%}Distance from wall{%endtrans%}: {{ distance|round(1,'ceil') }}cm</p>
<p>{%trans%}Stage preparation{%endtrans%}:</p>
<ul>
<li>Umieść z lewej lub prawej strony ściany pierwszy cel ze znacznikiem "punkt ZERO"</li>
<li>Wyznacz pole startowe {{ box_position|round(1,'ceil') }}cm od punktu "zero" (wzdłuż ściany) oraz w odległości {{distance}}cm od ściany</li>
<li>Upewnij się, że pole startowe znjaduje się w dogodnym miejscu, pomieszczenia, tak aby nic nie
przeszkazdało
w swobodnym dobyciu i składaniu do celów na całej szerokości ściany
</li>
<li>W razie potrzeby dostosuj pierwszy cel wraz z punktem ZERO i powtórz dwa powyższe kroki</li>
<li>Umieść na ścianie pozostałe cele zgodnie z odległościami podanymi na znacznikach pozycji na dole każdego
celu. Upewnij się, że wszystkie cele są umieszczone w jednej linii równoległej do podłoża</li>
<li>{%trans%}Place the first target with the 'ZERO point' marker on the left or right side of the wall{%endtrans%}</li>
<li>{%trans%}Set shooting box{%endtrans%} {{ box_position|round(1,'ceil') }}cm {%trans%}from 'ZERO' point (along the wall) and{%endtrans%} {{distance}}cm {%trans%}from the wall{%endtrans%}</li>
<li>{%trans%}Ensure that the starting field is positioned in a convenient location within the room, so that nothing obstructs the drawing and aiming at targets across the entire width of the wall{%endtrans%}</li>
<li>{%trans%}If necessary, adjust the first target along with the ZERO point and repeat the two previous steps{%endtrans%}</li>
<li>{%trans%}Place the remaining targets on the wall according to the distances indicated on the position markers at the bottom of each target. Ensure that all targets are aligned in a single line parallel to the ground{%endtrans%}</li>
</ul>
</div>
{% for i in range(target_count) %}
<div class="page-break">
@@ -158,9 +152,9 @@
{% endif %}
{% if i==0 %}
<div class="mounting-info">punkt ZERO (Shootoff)</div>
<div class="mounting-info">{%trans%}ZERO point{%endtrans%} (Shootoff)</div>
{% else %}
<div class="mounting-info">{{ i * gap|round(1,'ceil') }}cm od punktu ZERO (Shootoff)</div>
<div class="mounting-info">{{ i * gap|round(1,'ceil') }}cm {%trans%}from ZERO point{%endtrans%} (Shootoff)</div>
{% endif %}
<div class="mounting-point"></div>
</div>

View File

@@ -6,7 +6,7 @@
{% include 'setup.html' %}
<div class="mb-6 max-w-2xl mx-auto">
<h2>Tor</h2>
<h2>{%trans%}Select the stage{%endtrans%}</h2>
<div id="stage" class="grid grid-cols-1 gap-4">
<div>
<label for="five_to_go">
@@ -72,7 +72,7 @@
<div class="text-center">
<button type="submit"
class="bg-green-500 text-white py-2 px-4 rounded-md hover:bg-green-600 transition-colors">
Generuj
{%trans%}Generate PDF{%endtrans%}
</button>
</div>
</form>

View File

@@ -1,28 +1,28 @@
<div class="mb-6 max-w-2xl mx-auto mt-10">
<h2>Wybierz rodzaj kalkulacji ze względu na ograniczoną długość ściany lub ograniczoną odległość stanowiska od ściany</h2>
<h2>{%trans%}Select the type of calculation based on the limited wall length or the limited distance of the shooting box from the wall{%endtrans%}</h2>
<div class="flex gap-6 place-content-center">
<label for="floor"
class="cursor-pointer border-2 border-transparent rounded-lg overflow-hidden transition-all hover:border-blue-400">
<img src="{{ url_for('static', filename='images/floor.webp') }}" alt="Odległość od ściany"
<img src="{{ url_for('static', filename='images/floor.webp') }}" alt="{%trans%}Distance from wall{%endtrans%}"
class="w-40 h-auto">
<input type="radio" id="floor" name="distance_type" value="floor" required>
</label>
<label for="wall"
class="cursor-pointer border-2 border-transparent rounded-lg overflow-hidden transition-all hover:border-blue-400">
<img src="{{ url_for('static', filename='images/wall.webp') }}" alt="Długość ściany"
<img src="{{ url_for('static', filename='images/wall.webp') }}" alt="{%trans%}Wall length{%endtrans%}"
class="w-40 h-auto">
<input type="radio" id="wall" name="distance_type" value="wall" required>
</label>
</div>
<div class="mb-6 max-w-2xl mx-auto mt-4">
<h2>dystans [cm]</h2>
<h2>{%trans%}Distance{%endtrans%} [cm]</h2>
<input type="number" id="distance" name="distance" min="100" max="700" class="w-full p-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400" required>
</div>
</div>
<div class="mb-6 max-w-2xl mx-auto mt-10">
<h2>Format druku</h2>
<h2>{%trans%}Printing format{%endtrans%}</h2>
<div id="size" class="flex place-content-center">
<label for="a4"
class="cursor-pointer border-2 border-transparent rounded-lg overflow-hidden transition-all hover:border-blue-400">

View File

@@ -15,7 +15,7 @@
<div class="text-center">
<button type="submit"
class="bg-green-500 text-white py-2 px-4 rounded-md hover:bg-green-600 transition-colors">
Generuj
{%trans%}Generate PDF{%endtrans%}
</button>
</div>
</form>