Skip to content

Commit

Permalink
Organize assets (js, css)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rayvented committed Nov 14, 2023
1 parent d2244d7 commit 98100a1
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 31 deletions.
34 changes: 4 additions & 30 deletions assets/app.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,9 @@
import './styles/tailmater.css';
import './styles/colors.css';
import './styles/data_tables.css';
import './styles/dataTablesTailwind.css';
import './styles/dataTablesApp.css';
import './styles/app.css';
import './scripts/tailmater.js';
import DataTable from "datatables.net-dt";
import './scripts/datatables.js';

Array.prototype.forEach.call(document.getElementsByClassName('dataTable'), function (element) {
new DataTable('#' + element.getAttribute('id'), {
dom: 'Bfrtip',
buttons: [
{
extend: 'csv',
exportOptions: {
columns: ':not(.hide-in-export)'
}
},
{
extend: 'excel',
exportOptions: {
columns: ':not(.hide-in-export)'
}
}
]
});
});

document.querySelectorAll('[data-href]').forEach(function (element) {
const link = element.getAttribute('data-href');
element.addEventListener('click', function() {
window.location.href = link;
})
});

document.getElementById('snackbar-trigger')?.click();
document.getElementById('snackbar-trigger')?.click();
28 changes: 28 additions & 0 deletions assets/scripts/datatables.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import DataTable from "datatables.net-dt";

Array.prototype.forEach.call(document.getElementsByClassName('dataTable'), function (element) {
new DataTable('#' + element.getAttribute('id'), {
dom: 'Bfrtip',
buttons: [
{
extend: 'csv',
exportOptions: {
columns: ':not(.hide-in-export)'
}
},
{
extend: 'excel',
exportOptions: {
columns: ':not(.hide-in-export)'
}
}
]
});
});

document.querySelectorAll('[data-href]').forEach(function (element) {
const link = element.getAttribute('data-href');
element.addEventListener('click', function() {
window.location.href = link;
})
});
File renamed without changes.
1 change: 1 addition & 0 deletions assets/styles/dataTablesTailwind.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion templates/base/__head.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
{% block stylesheets %}
{# todo: include local #}
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" rel="stylesheet" />
<link href="https://cdn.datatables.net/1.13.7/css/dataTables.tailwindcss.min.css" rel="stylesheet" />
{{ encore_entry_link_tags('app') }}
{% endblock %}

Expand Down

0 comments on commit 98100a1

Please sign in to comment.