Skip to content

Added feature to make languages sortable in the language admin page - #489

Merged
ddon merged 3 commits into
BeamLabEU:devfrom
alexdont:dev
Apr 13, 2026
Merged

Added feature to make languages sortable in the language admin page#489
ddon merged 3 commits into
BeamLabEU:devfrom
alexdont:dev

Conversation

@alexdont

Copy link
Copy Markdown
Contributor

No description provided.

Alexander Donand others added 3 commits April 13, 2026 18:44
Add reorder mode toggle to the languages settings page that enables
drag-and-drop reordering of enabled languages using the DraggableList
component. Hide the SortableJS fallback clone at the initial position
to prevent a ghost chip visual artifact during drag.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move the CSS fix for hiding the SortableJS fallback clone from the
languages template into the SortableGrid hook so any draggable_list
with hide_source={true} gets the behavior automatically.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ddon added a commit that referenced this pull request Apr 13, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ddon

ddon commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Posted a review at dev_docs/pull_requests/2026/489-sortable-languages/CLAUDE_REVIEW.md.

TL;DR — approve with minor suggestions. Small, focused PR that reuses existing DraggableList + SortableGrid infrastructure and persists order through the existing JSON settings path. Clean diff.

Suggested polish before merge:

  • Move the inline <style>wiggle keyframes out of languages.html.heex into the CSS pipeline; wrap with prefers-reduced-motion: reduce (infinite animation otherwise).
  • Add a unit test for Languages.reorder_languages/1 (pure data transform — covers subset, unknown codes, empty list, dup codes).
  • Tiny perf: MapSet.new(ordered_codes) for the remaining filter to avoid the O(n²) in check.

Non-blocking:

  • Reorder mode hides per-language Set-Default / Disable actions — confirm that's intentional (reads like it is).
  • setTimeout(0) + body > .sortable-fallback workaround is brittle but correctly scoped — a short link to the underlying SortableJS behavior in the comment would help future maintainers.
  • Flash strings aren't gettext-wrapped, but consistent with the rest of the file — follow-up sweep, not a blocker.

Nice contrast to #488 — this is what a focused feature PR looks like.

@ddon
ddon merged commit 36cbf46 into BeamLabEU:devApr 13, 2026
ddon added a commit that referenced this pull request Apr 13, 2026
- Move wiggle keyframes from inline <style> in heex into phoenix_kit.js
and phoenix_kit_sortable.js injectStyles(); rename class to
pk-sortable-wiggle and respect prefers-reduced-motion.
- Dedup ordered_codes in Languages.reorder_languages/1 (Enum.uniq)
and use MapSet for the remaining filter.
- Add reorder_languages/1 integration tests covering reorder, partial
list, unknown codes, empty list, and duplicate codes.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ddonddon mentioned this pull request Apr 20, 2026
3 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@alexdont@ddon