Skip to content

Commit

Permalink
Fix multicheckbox layout
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp committed Dec 18, 2021
1 parent 083b431 commit 4387429
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PlutoUI"
uuid = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
authors = ["Fons van der Plas <[email protected]>"]
version = "0.7.24"
version = "0.7.25"

[deps]
AbstractPlutoDingetjes = "6e696c72-6542-2067-7265-42206c756150"
Expand Down
12 changes: 6 additions & 6 deletions assets/multicheckbox.css
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
.multicheckbox-container {
plj-multi-checkbox {
display: flex;
flex-wrap: wrap;
/* max-height: 8em; */
}

.multicheckbox {
plj-multi-checkbox * {
display: flex;
}

div.multicheckbox {
plj-multi-checkbox > div {
margin: 0.1em 0.3em;
align-items: center;
}

label.multicheckbox,
input.multicheckbox {
plj-multi-checkbox label,
plj-multi-checkbox input {
cursor: pointer;
}

.select-all {
plj-multi-checkbox .select-all {
font-style: italic;
color: hsl(0, 0%, 25%, 0.7);
}
6 changes: 0 additions & 6 deletions assets/multicheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ for (let i = 0; i < labels.length; i++) {
const boxId = `${my_id}-box-${i}`;

const item = document.createElement("div");
item.classList.add("multicheckbox");

const checkbox = document.createElement("input");
checkbox.classList.add("multicheckbox");
checkbox.type = "checkbox";
checkbox.id = boxId;
checkbox.name = labels[i];
Expand All @@ -22,7 +20,6 @@ for (let i = 0; i < labels.length; i++) {
item.appendChild(checkbox);

const label = document.createElement("label");
label.classList.add("multicheckbox");
label.htmlFor = boxId;
label.innerText = labels[i];
item.appendChild(label);
Expand All @@ -44,19 +41,16 @@ function updateSelectAll() {}
if (includeSelectAll) {
// Add select-all checkbox.
const selectAllItem = document.createElement("div");
selectAllItem.classList.add("multicheckbox");
selectAllItem.classList.add(`select-all`);

const selectID = `${my_id}-select-all`

const selectAllInput = document.createElement("input");
selectAllInput.classList.add("multicheckbox");
selectAllInput.type = "checkbox";
selectAllInput.id = selectID;
selectAllItem.appendChild(selectAllInput);

const selectAllLabel = document.createElement("label");
selectAllLabel.classList.add("multicheckbox");
selectAllLabel.htmlFor = selectID;
selectAllLabel.innerText = "Select All";
selectAllItem.appendChild(selectAllLabel);
Expand Down
2 changes: 1 addition & 1 deletion src/MultiCheckBox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ begin
for (k,v) in mc.options]

show(io, m, @htl("""
<multi-checkbox class="mc-container" style="flex-direction: $(mc.orientation);"></multi-checkbox>
<plj-multi-checkbox style="flex-direction: $(mc.orientation);"></plj-multi-checkbox>
<script type="text/javascript">
const labels = $([string(v) for (k,v) in mc.options]);
const values = $(1:length(mc.options));
Expand Down

2 comments on commit 4387429

@fonsp
Copy link
Member Author

@fonsp fonsp commented on 4387429 Dec 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/50810

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.25 -m "<description of version>" 43874293486392870201da932621e0e6efca6e26
git push origin v0.7.25

Please sign in to comment.