Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable visibility of overflow in table-responsive #1159

Merged
merged 6 commits into from Feb 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 34 additions & 2 deletions scripts/pi-hole/js/groups-adlists.js
Expand Up @@ -89,7 +89,11 @@ function initTable() {
comment.on("change", editAdlist);

$("td:eq(3)", row).empty();
$("td:eq(3)", row).append('<select id="multiselect" multiple="multiple"></select>');
$("td:eq(3)", row).append(
'<div id="selectHome' +
data.id +
'"><select id="multiselect" multiple="multiple"></select></div>'
);
var sel = $("#multiselect", row);
// Add all known groups
for (var i = 0; i < groups.length; i++) {
Expand All @@ -108,7 +112,35 @@ function initTable() {
// Select assigned groups
sel.val(data.groups);
// Initialize multiselect
sel.multiselect({ includeSelectAllOption: true });
sel.multiselect({
includeSelectAllOption: true,
buttonContainer: '<div id="container' + data.id + '" class="btn-group"/>',
maxHeight: 200,
onDropdownShown: function() {
var el = $("#container" + data.id);
var top = el[0].getBoundingClientRect().top;
var bottom = $(window).height() - top - el.height();
if (bottom < 200) {
el.addClass("dropup");
}

if (bottom > 200) {
el.removeClass("dropup");
}

var offset = el.offset();
$("body").append(el);
el.css("position", "absolute");
el.css("top", offset.top + "px");
el.css("left", offset.left + "px");
},
onDropdownHide: function() {
var el = $("#container" + data.id);
var home = $("#selectHome" + data.id);
home.append(el);
el.removeAttr("style");
}
});
sel.on("change", editAdlist);

var button =
Expand Down
36 changes: 34 additions & 2 deletions scripts/pi-hole/js/groups-clients.js
Expand Up @@ -101,7 +101,11 @@ function initTable() {
$("td:eq(0)", row).html(ip_name);

$("td:eq(1)", row).empty();
$("td:eq(1)", row).append('<select id="multiselect" multiple="multiple"></select>');
$("td:eq(1)", row).append(
'<div id="selectHome' +
data.id +
'"><select id="multiselect" multiple="multiple"></select></div>'
);
var sel = $("#multiselect", row);
// Add all known groups
for (var i = 0; i < groups.length; i++) {
Expand All @@ -120,7 +124,35 @@ function initTable() {
// Select assigned groups
sel.val(data.groups);
// Initialize multiselect
sel.multiselect({ includeSelectAllOption: true });
sel.multiselect({
includeSelectAllOption: true,
buttonContainer: '<div id="container' + data.id + '" class="btn-group"/>',
maxHeight: 200,
onDropdownShown: function() {
var el = $("#container" + data.id);
var top = el[0].getBoundingClientRect().top;
var bottom = $(window).height() - top - el.height();
if (bottom < 200) {
el.addClass("dropup");
}

if (bottom > 200) {
el.removeClass("dropup");
}

var offset = el.offset();
$("body").append(el);
el.css("position", "absolute");
el.css("top", offset.top + "px");
el.css("left", offset.left + "px");
},
onDropdownHide: function() {
var el = $("#container" + data.id);
var home = $("#selectHome" + data.id);
home.append(el);
el.removeAttr("style");
}
});
sel.on("change", editClient);

var button =
Expand Down
36 changes: 34 additions & 2 deletions scripts/pi-hole/js/groups-domains.js
Expand Up @@ -133,7 +133,11 @@ function initTable() {
// Show group assignment field only if in full domain management mode
if (table.column(5).visible()) {
$("td:eq(4)", row).empty();
$("td:eq(4)", row).append('<select id="multiselect" multiple="multiple"></select>');
$("td:eq(4)", row).append(
'<div id="selectHome' +
data.id +
'"><select id="multiselect" multiple="multiple"></select></div>'
);
var sel = $("#multiselect", row);
// Add all known groups
for (var i = 0; i < groups.length; i++) {
Expand All @@ -152,7 +156,35 @@ function initTable() {
// Select assigned groups
sel.val(data.groups);
// Initialize multiselect
sel.multiselect({ includeSelectAllOption: true });
sel.multiselect({
includeSelectAllOption: true,
buttonContainer: '<div id="container' + data.id + '" class="btn-group"/>',
maxHeight: 200,
onDropdownShown: function() {
var el = $("#container" + data.id);
var top = el[0].getBoundingClientRect().top;
var bottom = $(window).height() - top - el.height();
if (bottom < 200) {
el.addClass("dropup");
}

if (bottom > 200) {
el.removeClass("dropup");
}

var offset = el.offset();
$("body").append(el);
el.css("position", "absolute");
el.css("top", offset.top + "px");
el.css("left", offset.left + "px");
},
onDropdownHide: function() {
var el = $("#container" + data.id);
var home = $("#selectHome" + data.id);
home.append(el);
el.removeAttr("style");
}
});
sel.on("change", editDomain);
}

Expand Down
2 changes: 1 addition & 1 deletion style/pi-hole.css
Expand Up @@ -260,4 +260,4 @@ code.breakall

.pointer {
cursor: pointer;
}
}