From b03c10f09810796f43d313dd17b15f5c39c8e5a3 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Wed, 8 Jan 2020 17:08:53 +0100 Subject: [PATCH] feat(hide-columns): opt-out on select columns --- frontend/src/utils/hide-columns/hide-columns.js | 3 ++- src/Handler/Utils/Table/Pagination.hs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/utils/hide-columns/hide-columns.js b/frontend/src/utils/hide-columns/hide-columns.js index fa7122228..71a70028b 100644 --- a/frontend/src/utils/hide-columns/hide-columns.js +++ b/frontend/src/utils/hide-columns/hide-columns.js @@ -5,6 +5,7 @@ import './hide-columns.sass'; const HIDE_COLUMNS_CONTAINER_IDENT = 'uw-hide-columns'; const TABLE_HEADER_IDENT = 'uw-hide-column-header'; const HIDE_COLUMNS_HIDER_LABEL = 'uw-hide-columns--hider-label'; +const HIDE_COLUMNS_NO_HIDE = 'uw-hide-columns--no-hide'; const TABLE_UTILS_ATTR = 'table-utils'; const TABLE_UTILS_CONTAINER_SELECTOR = `[${TABLE_UTILS_ATTR}]`; @@ -67,7 +68,7 @@ export class HideColumns { hideColumnsContainer.insertBefore(this._tableUtilContainer, tableContainer); } - this._element.querySelectorAll('th').forEach(th => this.setupHideButton(th)); + [...this._element.querySelectorAll('th')].filter(th => !th.hasAttribute(HIDE_COLUMNS_NO_HIDE)).forEach(th => this.setupHideButton(th)); } setupHideButton(th) { diff --git a/src/Handler/Utils/Table/Pagination.hs b/src/Handler/Utils/Table/Pagination.hs index 89a6eeec1..06164debb 100644 --- a/src/Handler/Utils/Table/Pagination.hs +++ b/src/Handler/Utils/Table/Pagination.hs @@ -1382,7 +1382,7 @@ dbSelect :: forall x h r i a. (Headedness h, Monoid' x) -> (DBRow r -> MForm (HandlerFor UniWorX) i) -> Colonnade h (DBRow r) (DBCell (MForm (HandlerFor UniWorX)) x) -- dbSelect resLens selLens genIndex = Colonnade.singleton (headednessPure $ i18nCell MsgSelectColumn) $ formCell resLens genIndex genForm -dbSelect resLens selLens genIndex = Colonnade.singleton (headednessPure $ mempty) $ formCell resLens genIndex genForm +dbSelect resLens selLens genIndex = Colonnade.singleton (headednessPure $ mempty & cellAttrs <>~ pure ("uw-hide-columns--no-hide","")) $ formCell resLens genIndex genForm where genForm _ mkUnique = do (selResult, selWidget) <- mreq checkBoxField (fsUniq mkUnique "select") (Just False)