diff --git a/src/Foundation.hs b/src/Foundation.hs index b5121435d..4efca5572 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -445,7 +445,6 @@ defaultMenuLayout menu widget = do $(widgetFile "default-layout") $(widgetFile "standalone/modal") $(widgetFile "standalone/showHide") - $(widgetFile "standalone/sortable") $(widgetFile "standalone/inputs") withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet") diff --git a/templates/home.hamlet b/templates/home.hamlet index 0ee62ec29..a0b39a8ef 100644 --- a/templates/home.hamlet +++ b/templates/home.hamlet @@ -26,43 +26,6 @@
| ID - | TH1 - | TH2 - | TH3 - |
|---|---|---|---|
| 0 - | NT2 - | CON2 - | 3 - |
| 1 - | 5 - | ONT2 - | 13 - |
| 2 - | CONT1 - | NT2 - | 43 - |
| 3 - | 43 - | T2C2 - | 35 - |
| 4 - | 73 - | CA62 - | 7
-
Funktionen zum Testen diff --git a/templates/standalone/sortable.hamlet b/templates/standalone/sortable.hamlet deleted file mode 100644 index 3c42cc911..000000000 --- a/templates/standalone/sortable.hamlet +++ /dev/null @@ -1 +0,0 @@ - diff --git a/templates/standalone/sortable.julius b/templates/standalone/sortable.julius deleted file mode 100644 index 4b988e487..000000000 --- a/templates/standalone/sortable.julius +++ /dev/null @@ -1,107 +0,0 @@ -/** - * delcare a table as sortable by adding class 'js-sortable' - */ - (function() { - 'use strict'; - - window.utils = window.utils || {}; - - window.utils.sortable = function(table) { - var ASC = 1; - var DESC = -1; - - var trs, ths, sortBy, sortDir, trContents; - - function setup() { - trs = table.querySelectorAll('tr'); - ths = table.querySelectorAll('th'); - sortBy = 0; - sortDir = ASC; - trContents = []; - - Array.from(trs).forEach(function(tr, rowIndex) { - if (rowIndex === 0) { - // register table headers as sort-listener - Array.from(tr.querySelectorAll('th')).forEach(function(th, thIndex) { - th.addEventListener('click', function(el) { - sortTableBy(thIndex); - }); - }); - } else { - // register table rows - trContents.push(Array.from(tr.querySelectorAll('td')).map(function(td) { - return td.innerHTML; - })); - } - }); - } - setup(); - - function updateThs(thIndex, sortOrder) { - Array.from(ths).forEach(function (th) { - th.classList.remove('sorted-asc', 'sorted-desc'); - }); - var suffix = sortOrder > 0 ? 'asc' : 'desc'; - ths[thIndex].classList.add('sorted-' + suffix); - } - - function sortTableBy(thIndex) { - var sortKey = thIndex; - var sortOrder = ASC; - if (sortBy === sortKey) { - sortOrder = sortDir === ASC ? DESC : ASC; - } - - trContents.sort(dynamicSortByType(sortKey, sortOrder)); - trContents.sort(dynamicSortByKey(sortKey, sortOrder)); - sortBy = thIndex; - sortDir = sortOrder; - updateThs(thIndex, sortOrder); - - Array.from(trs).forEach(function(tr, trIndex) { - if (trIndex > 0) { - Array.from(tr.querySelectorAll('td')).forEach(function (td, tdIndex) { - td.innerHTML = trContents[trIndex - 1][tdIndex]; - }); - } - }); - } - - function dynamicSortByKey(key, order) { - return function (a,b) { - var aVal = parseInt(a[key]); - var bVal = parseInt(b[key]); - if ((isNaN(aVal) && !isNaN(bVal)) || (!isNaN(aVal) && isNaN(bVal))) { - return 1; - } - aVal = isNaN(aVal) ? a[key] : aVal; - bVal = isNaN(bVal) ? b[key] : bVal; - var result = (aVal < bVal) ? -1 : (aVal > bVal) ? 1 : 0; - return result * order; - } - } - - function dynamicSortByType(key, order) { - return function (a,b) { - var aVal = parseInt(a[key]); - var bVal = parseInt(b[key]); - aVal = isNaN(aVal) ? a[key] : aVal; - bVal = isNaN(bVal) ? b[key] : bVal; - var res = (aVal < bVal ? -1 : aVal > bVal ? 1 : 0); - if (isNaN(aVal) && !isNaN(bVal)) { - res = -1; - } - if (!isNaN(aVal) && isNaN(bVal)) { - res = 1; - } - return res * order; - } - } - }; - })(); - -document.addEventListener('DOMContentLoaded', function() { - Array.from(document.querySelectorAll('.js-sortable')).forEach(function(table) { - utils.sortable(table); - }); -}); diff --git a/templates/standalone/sortable.lucius b/templates/standalone/sortable.lucius deleted file mode 100644 index 2afb76611..000000000 --- a/templates/standalone/sortable.lucius +++ /dev/null @@ -1,31 +0,0 @@ -table.js-sortable th { - cursor: pointer; - position: relative; - padding-right: 20px; -} - -table.js-sortable th.sorted-asc, -table.js-sortable th.sorted-desc { - color: var(--darkbase); -} - -table.js-sortable th.sorted-asc::after, -table.js-sortable th.sorted-desc::after { - content: ''; - position: absolute; - right: 0; - top: 15px; - width: 0; - height: 0; - transform: translateY(-100%); - border-left: 8px solid transparent; - border-right: 8px solid transparent; -} - -table.js-sortable th.sorted-asc::after { - border-top: 8px solid var(--lightbase); -} - -table.js-sortable th.sorted-desc::after { - border-bottom: 8px solid var(--lightbase); -} |