diff --git a/assets/controllers/turbo/title_controller.js b/assets/controllers/turbo/title_controller.js new file mode 100644 index 00000000..b59c182d --- /dev/null +++ b/assets/controllers/turbo/title_controller.js @@ -0,0 +1,12 @@ +import { Controller } from '@hotwired/stimulus'; + +export default class extends Controller { + connect() { + //If we encounter an element with this, then change the title of our document according to data-title + this.changeTitle(this.element.dataset.title); + } + + changeTitle(title) { + document.title = title; + } +} \ No newline at end of file diff --git a/templates/_turbo_control.html.twig b/templates/_turbo_control.html.twig new file mode 100644 index 00000000..d2dd967a --- /dev/null +++ b/templates/_turbo_control.html.twig @@ -0,0 +1,18 @@ +{# Insert flashes #} +
+ {% for label, messages in app.flashes() %} + {% for message in messages %} + {{ include('_toast.html.twig', { + 'label': label, + 'message': message + }) }} + {% endfor %} + {% endfor %} +
+ +{# Allow pages to request a fully reload of everything #} +{% if global_reload_needed is defined and global_reload_needed %} +
+{% endif %} + +
\ No newline at end of file diff --git a/templates/base.html.twig b/templates/base.html.twig index 55ec0d6f..848e8408 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -25,6 +25,7 @@ {% apply trim %}{% block title %}{{ partdb_title}}{% endblock %}{% endapply %} + {% set page_title = block("title") %} {% block stylesheets %} {# Include the main bootstrap theme based on user/global setting #} @@ -58,13 +59,11 @@ {% include "_navbar.html.twig" %} -
- {% include "_toast_container.html.twig" %}