Load stimulus controllers properly

This commit is contained in:
Jan Böhmer 2022-03-04 20:59:08 +01:00
parent 5cc5c53853
commit f60ef33736
4 changed files with 18 additions and 41 deletions

View file

@ -1,12 +0,0 @@
/*
* Welcome to your app's main JavaScript file!
*
* We recommend including the built version of this JavaScript file
* (and its CSS file) in your base layout (base.html.twig).
*/
// any CSS you import will output into a single css file (app.css in this case)
import './styles/app.css';
// start the Stimulus application
import './bootstrap';

View file

@ -1,16 +0,0 @@
import { Controller } from 'stimulus';
/*
* This is an example Stimulus controller!
*
* Any element with a data-controller="hello" attribute will cause
* this controller to be executed. The name "hello" comes from the filename:
* hello_controller.js -> "hello"
*
* Delete this file or adapt it for your use!
*/
export default class extends Controller {
connect() {
this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
}
}

View file

@ -26,15 +26,16 @@
// any CSS you require will output into a single css file (app.css in this case)
require('../css/app.css');
// Main CSS files
import '../css/app.css';
// start the Stimulus application
import '../bootstrap';
// Need jQuery? Install it with "yarn add jquery", then uncomment to require it.
const $ = require('jquery');
//Only include javascript
import '@fortawesome/fontawesome-free/css/all.css'
import 'datatables.net-bs4/css/dataTables.bootstrap4.css'
@ -47,8 +48,10 @@ import "patternfly-bootstrap-treeview/src/css/bootstrap-treeview.css"
import "bootstrap-fileinput/css/fileinput.css"
require('bootstrap');
//import * as Turbo from "@hotwired/turbo"
require('bootstrap');
/**
//require( 'jszip' );
//#require( 'pdfmake' );
require( 'datatables.net-bs4' );
@ -97,9 +100,9 @@ import 'katex/dist/katex.css';
window.ClipboardJS = require('clipboard');
require('../ts_src/ajax_ui');
import {ajaxUI} from "../ts_src/ajax_ui";
//import {ajaxUI} from "../ts_src/ajax_ui";
window.ajaxUI = ajaxUI;
//window.ajaxUI = ajaxUI;
//Require all events;
require('../ts_src/event_listeners');
@ -125,8 +128,8 @@ try {
}
//Start AjaxUI AFTER all event has been registered
$(document).ready(ajaxUI.start());
//$(document).ready(ajaxUI.start());
*/
//console.log('Hello Webpack Encore! Edit me in assets/js/app.js');

View file

@ -47,6 +47,11 @@
{{ encore_entry_link_tags('app') }}
{% endblock %}
{% block javascripts %}
{{ encore_entry_script_tags('app') }}
{{ encore_entry_script_tags('ru2ftwofactor') }}
{% endblock %}
</head>
<body data-base-url="{{ url('homepage', {'_locale': app.request.locale}) }}">
{% block body %}
@ -119,9 +124,6 @@
{% endblock %}
{% block javascripts %}
{{ encore_entry_script_tags('app') }}
{{ encore_entry_script_tags('ru2ftwofactor') }}
{% endblock %}
</body>
</html>