Skip to content

Commit 71d56e0

Browse files
Fix table view popups styling
1 parent 4dd836e commit 71d56e0

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

ckanext/iaea/assets/css/custom.css

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,4 +337,97 @@
337337
.popover .popover-body {
338338
padding: 9px 14px;
339339
color: #42526e;
340+
}
341+
342+
/* DataTables collection popups on the Table view — the "Toggle column
343+
visibility" (eye) menu and the "Filtered download" (CSV/TSV/JSON/XML) menu.
344+
The vendored bundle in ckanext/datatablesview/assets/vendor/DataTables is the
345+
Bootstrap 5 build (its banner reads
346+
datatables.net/download/#bs5/dt-1.12.1/b-2.2.3/b-colvis-2.2.3/...), so
347+
Buttons emits BS5 dropdown markup:
348+
<div class="dt-button-collection fixed">
349+
<div class="dropdown-menu" role="menu">
350+
<a class="dt-button buttons-columnVisibility dropdown-item active">…
351+
and hands the entries to Bootstrap: datatables.css styles only the outer
352+
white box (and deliberately blanks the inner .dropdown-menu), while each
353+
entry's block layout, padding, hover and "currently shown" state come from
354+
BS5's .dropdown-item. This theme ships Bootstrap 3 — whose menus are
355+
<li><a> and which defines no .dropdown-item at all — and core main.css is not
356+
loaded, so every entry renders as a bare inline link: no padding, no hover,
357+
no indication of which columns are visible, reflowing into ragged columns
358+
inside the popup. Port the missing item rules using BS3's dropdown values.
359+
These rules must out-specify datatables.css, which is registered after
360+
iaea-css on this page — hence the body.dt-view prefix (the view template sets
361+
that class on <body>). */
362+
363+
/* BS3's .dropdown-menu leaks float/offsets into the inner menu, which
364+
datatables.css re-purposes as a plain block wrapper. */
365+
body.dt-view div.dt-button-collection div.dropdown-menu {
366+
float: none;
367+
top: auto;
368+
left: auto;
369+
margin: 0;
370+
}
371+
372+
body.dt-view div.dt-button-collection .dt-button.dropdown-item {
373+
display: block;
374+
width: 100%;
375+
padding: 5px 12px 5px 28px;
376+
clear: both;
377+
border: 0;
378+
background: none;
379+
color: #333333;
380+
font-weight: normal;
381+
line-height: 1.42857143;
382+
text-align: left;
383+
text-decoration: none;
384+
white-space: normal;
385+
cursor: pointer;
386+
}
387+
body.dt-view div.dt-button-collection .dt-button.dropdown-item:hover,
388+
body.dt-view div.dt-button-collection .dt-button.dropdown-item:focus {
389+
background-color: #f5f5f5;
390+
color: #262626;
391+
text-decoration: none;
392+
outline: none;
393+
}
394+
395+
/* colvis flags the currently shown columns with .active. Bootstrap 5 fills
396+
those solid blue, which on a resource with 30+ mostly-visible columns is a
397+
wall of blue, so tick + tint them instead. The hidden tick placeholder on
398+
inactive entries keeps every label on the same left edge. */
399+
body.dt-view div.dt-button-collection .dt-button.dropdown-item::before {
400+
content: "\2713";
401+
display: inline-block;
402+
width: 12px;
403+
margin-left: -16px;
404+
margin-right: 4px;
405+
visibility: hidden;
406+
}
407+
body.dt-view div.dt-button-collection .dt-button.dropdown-item.active::before {
408+
visibility: visible;
409+
}
410+
body.dt-view div.dt-button-collection .dt-button.dropdown-item.active {
411+
background-color: #eaf3fa;
412+
color: #23527c;
413+
}
414+
415+
/* Separate the trailing actions (Restore visibility / Show all / Show none /
416+
Filtered) from the column entries above them. */
417+
body.dt-view div.dt-button-collection .dt-button.buttons-colvisRestore {
418+
margin-top: 5px;
419+
padding-top: 8px;
420+
border-top: 1px solid #e5e5e5;
421+
}
422+
423+
/* Block-level entries make the list far taller than the inline links they
424+
replace, so bound it. datatables_view.css pins the popup with
425+
"top: 50%; transform: translate(-65%, -20%)" and Buttons adds an inline
426+
margin-top of -height/2, which puts the top edge at 0.5H - 0.7h: once the
427+
popup is taller than ~70vh its top sits above the top of the (iframe)
428+
viewport, out of reach — a transform offset can't be scrolled back. Cap it
429+
just under that and let the inner menu scroll; datatables.css already sets
430+
overflow: auto on this element. */
431+
body.dt-view div.dt-button-collection.fixed > :last-child {
432+
max-height: calc(70vh - 1rem);
340433
}

0 commit comments

Comments
 (0)