mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Use stimulus for global reloading
This commit is contained in:
parent
390deca544
commit
ea6357c259
4 changed files with 22 additions and 14 deletions
8
assets/controllers/turbo/global_reload_controller.js
Normal file
8
assets/controllers/turbo/global_reload_controller.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { Controller } from '@hotwired/stimulus';
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
//If we encounter an element with global reload controller, then reload the whole page
|
||||
window.location.href = window.location.href;
|
||||
}
|
||||
}
|
|
@ -354,7 +354,7 @@ class UserSettingsController extends AbstractController
|
|||
'user' => $user,
|
||||
'settings_form' => $form,
|
||||
'pw_form' => $pw_form,
|
||||
'page_need_reload' => $page_need_reload,
|
||||
'global_reload_needed' => $page_need_reload,
|
||||
|
||||
'google_form' => $google_form,
|
||||
'backup_form' => $backup_form,
|
||||
|
|
|
@ -6,10 +6,6 @@
|
|||
{% trans %}user.settings.label{% endtrans %}{% endblock %}
|
||||
|
||||
{% block card_content %}
|
||||
{% if page_need_reload %}
|
||||
<script>window.location.href = window.location.href;</script>
|
||||
{% endif %}
|
||||
|
||||
{{ form_start(settings_form) }}
|
||||
|
||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
<link rel="icon" type="image/png" href="{{ asset('icon/favicon-16x16.png') }}" sizes="16x16">
|
||||
<link rel="mask-icon" href="{{ asset('icon/safari-pinned-tab.svg') }}" color="#5bbad5">
|
||||
|
||||
|
||||
<title>{% apply trim %}{% block title %}{{ partdb_title}}{% endblock %}{% endapply %}</title>
|
||||
{% block stylesheets %}
|
||||
{# Include the main bootstrap theme based on user/global setting #}
|
||||
|
@ -98,8 +97,13 @@
|
|||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</turbo-frame>
|
||||
|
||||
{# Allow pages to request a fully reload of everything #}
|
||||
{% if global_reload_needed is defined and global_reload_needed %}
|
||||
<div {{ stimulus_controller('turbo/global_reload') }}></div>
|
||||
{% endif %}
|
||||
|
||||
</turbo-frame>
|
||||
{% block scripts %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue