summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-04-18 02:38:35 +0200
committerMax Magorsch <arzano@gentoo.org>2020-04-18 02:50:54 +0200
commit35a41e63ebd5f6cf9d17419c150eb53a005d2e87 (patch)
treee0bcc21bbb1e7e200857cfbd52acb82b008a3a6d /web/packs/src/javascript/drafts.js
parentDisplay version and last update in the footer (diff)
downloadglsamaker-35a41e63ebd5f6cf9d17419c150eb53a005d2e87.tar.gz
glsamaker-35a41e63ebd5f6cf9d17419c150eb53a005d2e87.tar.bz2
glsamaker-35a41e63ebd5f6cf9d17419c150eb53a005d2e87.zip
Add the initial version of the rewritten glsamaker
The glsamaker has been completly rewritten in go. It is using postgres instead of mysql now. The look and feel is based on tyrian. Signed-off-by: Max Magorsch <arzano@gentoo.org>
Diffstat (limited to 'web/packs/src/javascript/drafts.js')
-rw-r--r--web/packs/src/javascript/drafts.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/web/packs/src/javascript/drafts.js b/web/packs/src/javascript/drafts.js
new file mode 100644
index 0000000..0430b15
--- /dev/null
+++ b/web/packs/src/javascript/drafts.js
@@ -0,0 +1,38 @@
+
+
+function initDatatable(){
+ if (window.DraftsDataTables.length === 0 && $('.drafts-data-table').length !== 0) {
+ $('.drafts-data-table').each((_, element) => {
+
+ var table = $(element).DataTable( {
+ "order": [[ 0, "desc" ]],
+ "paging": true,
+ "ordering": true,
+ "searching": true,
+ "info": true,
+ "lengthChange": false,
+ "language": {
+ "emptyTable": "Currently there are no drafts available. -- Start with creating one."
+ }
+ });
+
+ window.DraftsDataTables.push(table);
+
+ // Add event listener for opening and closing details
+ $('#table_id tbody').on('click', 'td', function () {
+ var tr = $(this).closest('tr');
+ var row = table.row( tr );
+ Turbolinks.visit("/glsa/" + row.data()[0]);
+ } );
+
+ });
+ }
+}
+
+function destroyDatatable(){
+ while (window.DraftsDataTables.length !== 0) {
+ window.DraftsDataTables.pop().destroy();
+ }
+}
+
+export default {initDatatable, destroyDatatable}