feat(sort-table): add basic SortTable util stub

This commit is contained in:
Sarah Vaupel 2020-01-09 12:27:02 +01:00
parent 9a791562b6
commit 11c0bd07e9
4 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,27 @@
import { Utility } from '../../core/utility';
import { StorageManager, LOCATION } from '../../lib/storage-manager/storage-manager';
const SORT_TABLE_IDENT = 'uw-sort-table';
@Utility({
selector: `table[${SORT_TABLE_IDENT}]`,
})
export class SortTable {
_storageManager = new StorageManager('SORT_TABLE', '0.0.0', { location: LOCATION.LOCAL });
_element;
constructor(element) {
if (!element) {
throw new Error('Sort Table utility cannot be setup without an element!');
}
this._element = element;
}
destroy() {
console.log('TBD destroy SortTable');
}
}

View File

@ -13,6 +13,7 @@ import { CourseTeaser } from './course-teaser/course-teaser';
import { NavbarUtils } from './navbar/navbar';
import { HideColumns } from './hide-columns/hide-columns';
import { ExamCorrect } from './exam-correct/exam-correct';
import { SortTable } from './sort-table/sort-table';
export const Utils = [
Alerts,
@ -31,4 +32,5 @@ export const Utils = [
...NavbarUtils,
HideColumns,
ExamCorrect,
SortTable,
];

View File

@ -58,6 +58,8 @@ getECorrectR tid ssh csh examn = do
participantHeadTooltip = [whamlet| _{MsgExamCorrectHeadParticipantTooltip} |]
examCorrectIdent = intercalate "-" [toPathPiece tid, toPathPiece ssh, toPathPiece csh, toPathPiece examn]
siteLayoutMsg heading $ do
setTitleI heading
$(widgetFile "exam-correct")

View File

@ -2,7 +2,7 @@ $newline never
<section>
<div uw-hide-columns="exam-correct">
<table .table .table--striped uw-exam-correct=#{intercalate "-" [toPathPiece tid, toPathPiece ssh, toPathPiece csh, toPathPiece examn]}>
<table .table .table--striped uw-exam-correct=#{examCorrectIdent} uw-sort-table=#{examCorrectIdent}>
<thead>
<tr .table__row .table__row--head>
<th .table__th .sortable .sorted-desc uw-hide-column-header="date">