mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-18 17:31:35 +00:00
Turbo-Kompatibilität verbessern.
Hinzufügen von Prüfungen auf Vorhandensein von DOM-Elementen in mehreren Controllern sowie Optimierung der Form-Submit-Logik für bessere Turbo-Integration. Anpassung von Template-Elementen und JavaScript-Events zur Unterstützung von Turbo Morphing auf der Startseite.
This commit is contained in:
parent
66c905738d
commit
563d39ff2d
9 changed files with 104 additions and 35 deletions
|
|
@ -95,6 +95,14 @@
|
|||
<turbo-frame id="content" data-turbo-action="advance">
|
||||
{# Here will be the real content be injected#}
|
||||
|
||||
{# These empty divs are here to ensure that Turbo Morphing correctly removes homepage elements when navigating away #}
|
||||
<div id="homepage-search-container" class="d-none" data-turbo-temporary></div>
|
||||
<div id="homepage-banner-container" class="d-none" data-turbo-temporary></div>
|
||||
<div id="homepage-first-steps" class="d-none" data-turbo-temporary></div>
|
||||
<div id="homepage-license" class="d-none" data-turbo-temporary></div>
|
||||
<div id="homepage-last-activity-container" class="d-none" data-turbo-temporary></div>
|
||||
<div id="new-version-alert" class="d-none" data-turbo-temporary></div>
|
||||
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
{% macro new_version_alert(is_available, new_version, new_version_url) %}
|
||||
{% if is_available %}
|
||||
<div class="alert alert-success" role="alert">
|
||||
<div id="new-version-alert" class="alert alert-success" role="alert" data-turbo-temporary>
|
||||
<h5><i class="fa-solid fa-champagne-glasses"></i> {% trans %}update_manager.new_version_available.title{% endtrans %}</h5>
|
||||
{% trans %}update_manager.new_version_available.text{% endtrans %}: <b><a href="{{ new_version_url }}" class="alert-link link-external" target="_blank">{% trans %}version.caption{% endtrans %} {{ new_version }}</a></b>
|
||||
<br><small>{% trans %}update_manager.new_version_available.only_administrators_can_see{% endtrans %}</small>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
{% endmacro %}
|
||||
|
|
|
|||
|
|
@ -250,6 +250,8 @@
|
|||
data-initial-query="{{ searchFilter ? searchFilter.keyword : app.request.get('keyword') }}">
|
||||
|
||||
<input type="hidden" name="keyword" required {{ stimulus_target('elements/part_search', 'input') }} value="{{ searchFilter ? searchFilter.keyword : app.request.get('keyword') }}">
|
||||
{# Hidden submit button to allow form submission on enter, even if the real input is hidden/handled by JS #}
|
||||
<input type="submit" class="d-none" aria-hidden="true">
|
||||
</div>
|
||||
|
||||
{# And right in the standalone mode #}
|
||||
|
|
|
|||
|
|
@ -6,33 +6,37 @@
|
|||
|
||||
{% block item_search %}
|
||||
{% if is_granted('@parts.read') %}
|
||||
{{ search.search_form("standalone") }}
|
||||
<div id="homepage-search-container" data-turbo-temporary>
|
||||
{{ search.search_form("standalone") }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block item_banner %}
|
||||
<div class="rounded p-4 bg-body-secondary">
|
||||
<h1 class="display-3">{{ vars.partdb_title() }}</h1>
|
||||
{% if settings_instance('customization').showVersionOnHomepage %}
|
||||
<h4>
|
||||
{% trans %}version.caption{% endtrans %}: {{ shivas_app_version }}
|
||||
{% if git_branch is not empty or git_commit is not empty %}
|
||||
({{ git_branch ?? '' }}/{{ git_commit ?? '' }})
|
||||
{% endif %}
|
||||
</h4>
|
||||
{% endif %}
|
||||
{% if banner is not empty %}
|
||||
<hr>
|
||||
<div class="latex" data-controller="common--latex">
|
||||
<h5>{{ banner | format_markdown }}</h5>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div id="homepage-banner-container" class="container-fluid" data-turbo-temporary>
|
||||
<div id="homepage-banner" class="rounded p-4 bg-body-secondary">
|
||||
<h1 class="display-3">{{ vars.partdb_title() }}</h1>
|
||||
{% if settings_instance('customization').showVersionOnHomepage %}
|
||||
<h4>
|
||||
{% trans %}version.caption{% endtrans %}: {{ shivas_app_version }}
|
||||
{% if git_branch is not empty or git_commit is not empty %}
|
||||
({{ git_branch ?? '' }}/{{ git_commit ?? '' }})
|
||||
{% endif %}
|
||||
</h4>
|
||||
{% endif %}
|
||||
{% if banner is not empty %}
|
||||
<hr>
|
||||
<div class="latex" data-controller="common--latex">
|
||||
<h5>{{ banner | format_markdown }}</h5>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block item_first_steps %}
|
||||
{% if show_first_steps %}
|
||||
<div class="card border-info">
|
||||
<div id="homepage-first-steps" class="card border-info" data-turbo-temporary>
|
||||
<div class="card-header bg-info ">
|
||||
<h4><i class="fa fa-circle-play fa-fw " aria-hidden="true"></i> {% trans %}homepage.first_steps.title{% endtrans %}</h4>
|
||||
</div>
|
||||
|
|
@ -53,7 +57,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block item_license %}
|
||||
<div class="card border-primary">
|
||||
<div id="homepage-license" class="card border-primary" data-turbo-temporary>
|
||||
<div class="card-header bg-primary text-white">
|
||||
<h4><i class="fa fa-book fa-fw" aria-hidden="true"></i> {% trans %}homepage.license{% endtrans %}</h4>
|
||||
</div>
|
||||
|
|
@ -73,18 +77,19 @@
|
|||
|
||||
{% block item_last_activity %}
|
||||
{% if datatable is not null %}
|
||||
<div class="card">
|
||||
<div class="card-header"><i class="fas fa-fw fa-history"></i> {% trans %}homepage.last_activity{% endtrans %}</div>
|
||||
<div class="card-body">
|
||||
{% import "components/history_log_macros.html.twig" as log %}
|
||||
{{ log.last_activity_component(datatable) }}
|
||||
<div id="homepage-last-activity-container" class="container-fluid" data-turbo-temporary>
|
||||
<div id="homepage-last-activity" class="card">
|
||||
<div class="card-header"><i class="fas fa-fw fa-history"></i> {% trans %}homepage.last_activity{% endtrans %}</div>
|
||||
<div class="card-body">
|
||||
{% import "components/history_log_macros.html.twig" as log %}
|
||||
{{ log.last_activity_component(datatable) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if is_granted('@system.show_updates') %}
|
||||
{{ nv.new_version_alert(new_version_available, new_version, new_version_url) }}
|
||||
{% endif %}
|
||||
|
|
@ -99,5 +104,4 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue