cache-busting parametr

master
Kowalski 2026-10-12 16:30:24 +02:00
parent 2e78499bf2
commit a53d9211b3
12 changed files with 49 additions and 11 deletions

15
app/Core/Konstanty.php Normal file
View File

@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace App\Core;
final class Konstanty
{
/**
* Verze aplikace.
* @var string
*/
public const verze = '1.1';
}

View File

@ -5,8 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" /> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
{* bootstrap: *} {* bootstrap: *}
<link href="{$basePath}/css/bootstrap.min.css" rel="stylesheet"> <link href="{$basePath}/css/bootstrap.min.css?v={$appVersion ?? '1.0'}" rel="stylesheet">
<script src="{$basePath}/js/bootstrap.bundle.min.js"></script> <script src="{$basePath}/js/bootstrap.bundle.min.js?v={$appVersion ?? '1.0'}"></script>
{* LeafLet: *} {* LeafLet: *}
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
@ -15,11 +15,11 @@
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script> crossorigin=""></script>
<script src="{$basePath}/js/mapove-podklady.js?v=1"></script> <script src="{$basePath}/js/mapove-podklady.js?v={$appVersion ?? '1.0'}"></script>
{* Locate-Control *} {* Locate-Control *}
<link rel="stylesheet" href="{$basePath}/locate/L.Control.Locate.min.css" /> <link rel="stylesheet" href="{$basePath}/locate/L.Control.Locate.min.css?v={$appVersion ?? '1.0'}" />
<script src="{$basePath}/locate/L.Control.Locate.min.js" charset="utf-8"></script> <script src="{$basePath}/locate/L.Control.Locate.min.js?v={$appVersion ?? '1.0'}" charset="utf-8"></script>
{* jquery *} {* jquery *}
<script <script
@ -29,7 +29,7 @@
</script> </script>
{* naše vlastní styly *} {* naše vlastní styly *}
<link href="{$basePath}/css/base.css?v=10" rel="stylesheet"> <link href="{$basePath}/css/base.css?v={$appVersion ?? '1.0'}" rel="stylesheet">
<title>{ifset title}{include title|stripHtml} | {/ifset}Obvody</title> <title>{ifset title}{include title|stripHtml} | {/ifset}Obvody</title>
</head> </head>

View File

@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Presentation; namespace App\Presentation;
use Nette; use Nette;
use App\Core\Konstanty;
abstract class BasePresenter extends Nette\Application\UI\Presenter abstract class BasePresenter extends Nette\Application\UI\Presenter
{ {
@ -17,4 +17,9 @@ abstract class BasePresenter extends Nette\Application\UI\Presenter
$this->redirect(':Sign:in', ['backlink' => $this->storeRequest()]); $this->redirect(':Sign:in', ['backlink' => $this->storeRequest()]);
} }
} }
public function beforeRender(): void
{
$this->template->appVersion = Konstanty::verze;
}
} }

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Presentation\Error\Error4xx; namespace App\Presentation\Error\Error4xx;
use App\Core\Konstanty;
use Nette; use Nette;
use Nette\Application\Attributes\Requires; use Nette\Application\Attributes\Requires;
@ -14,6 +15,11 @@ use Nette\Application\Attributes\Requires;
#[Requires(methods: '*', forward: true)] #[Requires(methods: '*', forward: true)]
final class Error4xxPresenter extends Nette\Application\UI\Presenter final class Error4xxPresenter extends Nette\Application\UI\Presenter
{ {
public function beforeRender(): void
{
$this->template->appVersion = Konstanty::verze;
}
public function renderDefault(Nette\Application\BadRequestException $exception): void public function renderDefault(Nette\Application\BadRequestException $exception): void
{ {
// renders the appropriate error template based on the HTTP status code // renders the appropriate error template based on the HTTP status code

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Presentation\Home; namespace App\Presentation\Home;
use App\Core\Konstanty;
use Nette; use Nette;
use Nette\Utils\Json; use Nette\Utils\Json;
use Nette\Utils\FileSystem; use Nette\Utils\FileSystem;
@ -17,6 +18,7 @@ final class HomePresenter extends Nette\Application\UI\Presenter
public function beforeRender(): void public function beforeRender(): void
{ {
$this->template->appVersion = Konstanty::verze;
if (!$this->getUser()->isLoggedIn()) { if (!$this->getUser()->isLoggedIn()) {
$this->template->navrat = $this->storeRequest(); $this->template->navrat = $this->storeRequest();
} }

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Presentation\Mapa; namespace App\Presentation\Mapa;
use App\Core\Konstanty;
use App\Model\ZaznamFacade; use App\Model\ZaznamFacade;
use Nette; use Nette;
use Nette\Utils\Json; use Nette\Utils\Json;
@ -24,6 +25,7 @@ final class MapaPresenter extends Nette\Application\UI\Presenter
public function beforeRender(): void public function beforeRender(): void
{ {
$this->template->appVersion = Konstanty::verze;
if (!$this->getUser()->isLoggedIn()) { if (!$this->getUser()->isLoggedIn()) {
$this->template->navrat = $this->storeRequest(); $this->template->navrat = $this->storeRequest();
} }

View File

@ -11,5 +11,5 @@
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.css" /> <link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.css" />
<script src="https://unpkg.com/leaflet.markercluster@1.5.3/dist/leaflet.markercluster.js"></script> <script src="https://unpkg.com/leaflet.markercluster@1.5.3/dist/leaflet.markercluster.js"></script>
<script type="application/json" id="stari-data">{$stariJson|noescape}</script> <script type="application/json" id="stari-data">{$stariJson|noescape}</script>
<script src="{$basePath}/js/stari.js?v=14"></script> <script src="{$basePath}/js/stari.js?v={$appVersion ?? '1.0'}"></script>
{/block} {/block}

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Presentation\Nastaveni; namespace App\Presentation\Nastaveni;
use App\Core\Konstanty;
use App\Core\MapovyPodklad; use App\Core\MapovyPodklad;
use Nette\Application\UI\Form; use Nette\Application\UI\Form;
use Nette\Application\UI\Presenter; use Nette\Application\UI\Presenter;
@ -14,6 +15,7 @@ final class NastaveniPresenter extends Presenter
{ {
public function beforeRender(): void public function beforeRender(): void
{ {
$this->template->appVersion = Konstanty::verze;
if (!$this->getUser()->isLoggedIn()) { if (!$this->getUser()->isLoggedIn()) {
$this->template->navrat = $this->storeRequest(); $this->template->navrat = $this->storeRequest();
} }

View File

@ -40,6 +40,7 @@ final class ObvodPresenter extends BasePresenter
public function beforeRender(): void public function beforeRender(): void
{ {
parent::beforeRender();
} }
public function actionList(?string $skupina = null, ?string $razeni = null): void public function actionList(?string $skupina = null, ?string $razeni = null): void

View File

@ -161,8 +161,8 @@
</div> </div>
<script type="application/json" id="zvestovatele-data">{$zvestovateleJson|noescape}</script> <script type="application/json" id="zvestovatele-data">{$zvestovateleJson|noescape}</script>
<script src="{$basePath}/js/obvod-nahled.js?v=3"></script> <script src="{$basePath}/js/obvod-nahled.js?v={$appVersion ?? '1.0'}"></script>
<script src="{$basePath}/js/naseptavac.js?v=3"></script> <script src="{$basePath}/js/naseptavac.js?v={$appVersion ?? '1.0'}"></script>
<script> <script>
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('.modal[data-show-errors="1"]').forEach(function (el) { document.querySelectorAll('.modal[data-show-errors="1"]').forEach(function (el) {

View File

@ -64,6 +64,11 @@ final class SignPresenter extends Nette\Application\UI\Presenter
} }
} }
public function beforeRender(): void
{
$this->template->appVersion = Konstanty::verze;
}
public function renderIn(): void public function renderIn(): void
{ {
$this->template->navrat = $this->backlink; $this->template->navrat = $this->backlink;

View File

@ -5,5 +5,5 @@
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.css" /> <link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.css" />
<script src="https://unpkg.com/leaflet.markercluster@1.5.3/dist/leaflet.markercluster.js"></script> <script src="https://unpkg.com/leaflet.markercluster@1.5.3/dist/leaflet.markercluster.js"></script>
<script type="application/json" id="stari-data">{$stariJson|noescape}</script> <script type="application/json" id="stari-data">{$stariJson|noescape}</script>
<script src="{$basePath}/js/stari.js?v=14"></script> <script src="{$basePath}/js/stari.js?v={$appVersion ?? '1.0'}"></script>
{/block} {/block}