Scaffold Symfony 8 app with Bootstrap/DataTables and Docker stack
- Symfony 8.1 webapp skeleton on PHP 8.5 (AssetMapper/importmap, no Node)
- Form-login gate: User entity, security.yaml, SecurityController,
app:user:create command, initial migration (user + messenger_messages)
- Bootstrap 5 + DataTables layout (base/login/home templates); any
table.datatable is auto-initialised
- trusted_proxies/headers wired for the shared Nginx Proxy Manager
- Docker (servers only): docker-compose.yml (php:8.5-fpm-alpine,
nginx:1.30-alpine, mariadb:12.3; host ports 8085/3310; external
docker_default network) + docker/{Dockerfile,php.ini,nginx,setup.sh,restart.sh}
- .env with CHANGEME placeholders (no secrets), .gitattributes enforces
LF so the deploy scripts stay runnable on Linux
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* dmtools front-end entrypoint (Symfony AssetMapper / importmap).
|
||||
* Loaded from base.html.twig via {{ importmap('app') }}.
|
||||
*/
|
||||
import './stimulus_bootstrap.js';
|
||||
|
||||
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
import 'datatables.net-bs5/css/dataTables.bootstrap5.min.css';
|
||||
import './styles/app.css';
|
||||
|
||||
import * as bootstrap from 'bootstrap';
|
||||
import DataTable from 'datatables.net-bs5';
|
||||
|
||||
window.bootstrap = bootstrap;
|
||||
|
||||
// Turn any <table class="datatable"> into a DataTable. Opt out per-table with
|
||||
// data-datatable="false"; pass options as a JSON object in data-datatable-options.
|
||||
function initDataTables(root = document) {
|
||||
root.querySelectorAll('table.datatable').forEach((table) => {
|
||||
if (table.dataset.datatable === 'false' || DataTable.isDataTable(table)) {
|
||||
return;
|
||||
}
|
||||
let options = { pageLength: 25, order: [] };
|
||||
if (table.dataset.datatableOptions) {
|
||||
try {
|
||||
options = { ...options, ...JSON.parse(table.dataset.datatableOptions) };
|
||||
} catch (e) {
|
||||
console.error('Invalid data-datatable-options on', table, e);
|
||||
}
|
||||
}
|
||||
new DataTable(table, options);
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => initDataTables());
|
||||
document.addEventListener('turbo:load', () => initDataTables());
|
||||
Reference in New Issue
Block a user