Add way to separate items in a menu

Created on 7 December 2023, 7 months ago
Updated 9 February 2024, 5 months ago

Problem/Motivation

Unfortuanately, weights are integers so there is no way to programatically insert a menu item between to other menu items that either have the same weight or a weight that only differs by 1. (This is why the Dewey decimal system was invented)

So it would be nice to point a method at a menu, that preserves all the order and hierarchy of the menu but makes sure that all weights on adjacent menu items differ by at least 2, so that a followup insertion can be certain of where it will be placed.

Example: In the menu below, where the letters represent a menu item id and the number is the weight, it is impossible to place a new menu item between `Aa:0` and `Ab:0` and be certain it does not end up above or below them both.

- A:-5
-- Aa:0
-- Ab:0
-- Ac:1
- B:-5
-- Ba:-12
-- Bb:0
-- Bc:48
- C:-4
- D:0
- E:0
- F:13

It would be nice to run a process on a menu tree that re-weights them and creates space between them. After the process the menu would look like

- A:0
-- Aa:0
-- Ab:5
-- Ac:10
- B:5
-- Ba:0
-- Bb:5
-- Bc:10
- C:10
- D:15
- E:20
- F:25

Spacing them 5 apart leaves gap to add items with certainty where it is landing.

Each parent branch could be handled by using the same function with recursion.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States swirt Florida

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024