Skip to content

Commit

Permalink
Add a better label to the move region dropdown...
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Oct 2, 2024
1 parent ca03e74 commit e76204c
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions content_editor/static/content_editor/content_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,22 +515,30 @@
}
}

if (regions.length < 2 && !/^_unknown_/.test($inline.data("region")))
const isCurrentUnknown = /^_unknown_/.test($inline.data("region"))

if (regions.length < 2 && !isCurrentUnknown) {
return
}

const select = buildDropdown(regions)
const select = buildDropdown(
regions,
isCurrentUnknown ? ContentEditor.messages.unknownRegion : "",
)
const regionInput = $inline.find(".order-machine-region")

select.className = "inline_move_to_region"
select.value = regionInput.val()
select.value = isCurrentUnknown ? "" : regionInput.val()
$inline.find("> h3 .inline_label").after(select)

select.addEventListener("change", () => {
$inline.attr("data-region", select.value)
regionInput.val(select.value)
hideInlinesFromOtherRegions()
setBiggestOrdering($inline)
reorderInlines()
if (select.value) {
$inline.attr("data-region", select.value)
regionInput.val(select.value)
hideInlinesFromOtherRegions()
setBiggestOrdering($inline)
reorderInlines()
}
})
}

Expand Down

0 comments on commit e76204c

Please sign in to comment.