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
U4-9025 - Add sortable to color picker prevalues #1504
Conversation
Hi Bjarne, Thanks for the PR. I have tested your changes and I am not able to get the reorder to work. It looks like the server has reset the sort order when the data comes back after save. Is this something you can look into? Thanks. |
Hi Mads Yes, that was the only thing I was missing. Often when using Even the order (indexes) was correct after sorting, on save it seems to change to order. Not sure if there is some other logic server side on this part? |
I have just tested the |
@madsrasmussen @Shazwazza maybe it is this that change order of the array?
I think it creates a new list, which is ordered by the value? As I remember I think black (#000000) was always re-ordered to this first item. |
I had a closer look at this yesterday and compared with multivalues prevalus editor for e.g. dropdownlist where sorting works. I noticed this get its model for "items" updated with id, value and sortorder from serverside. In ValueListPreValueEditor.cs is order by sortorder, which it doesn't in ColorListPreValueEditor.cs
Furthermore ValueListPreValueEditor.cs use this part:
In Angular controller for multivalues prevalue it furthermore has: Umbraco-CMS/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/multivalues.controller.js Lines 11 to 22 in 5397f2c
Maybe prevalue editor for color picker should be moved to prevalues folder in a major version, so e.g. package developers can use it - or other property editors. |
I reviewed more of the source code and how the multivalues prevalues works, which are used for dropdown, checkboxlist, radiobuttonlist.. In commit bbf3dff I have updated the model for colors, so it also has a id, value and sortOrder properties. I have also updated the property editor to use the new model. It could also set id and sortorder when appending new items to array client side - and before saving to server side - however it doesn't seem to be necessary and the multivalues prevalues doesn't do this either. |
After this PR has been solved/merged I can update PR #1503 so it is possible to use color prevalues in grid editor config. |
@Shazwazza can you check if the server side logic to sort the prevalues is correct? |
I think this is almost finish. @Shazwazza does the server side code look correct? :) |
Hey, |
Hi @zpqrtbnk I can have a look at it maybe tonight or one of the next day and update the branch with latest changes in I guess the other feature is part of |
@zpqrtbnk I have updated the branch with latest changed in On server side in I have also fixed a few other issues:
I also noticed I can't add two different colors with same Label value? It might also be worth to make the labels editable, e.g. by showing label in a textbox or toggle between label and text input. It looks like this at the moment, but needs some changes combined with the new Labels to preserve the sort order. |
Both the yellow and orange colors used to be a bit darker, but when more colors were introduced in 7.10.x, the two colors were made a bit lighter. So now the yellow warning icon is hard to see on a white background, but the orange color now looks just right ;)
Health Checks: the warning icon should be orange instead of yellow
…directive in order to ensure not to create a "state" property in the directive isolated scope.
After looking i found out that the problem was that the "position:relative;" was removed on the umb-group-builder__group class.
Made upload button only appear when media can be uploaded to the current folder. Also ensured acceptedMediatypes is always valid even in the root directory
… easier to digest for new contributors ref: umbraco/Issues.Community#2
Fixed typos in tours
# Conflicts: # docs/CONTRIBUTING_DETAILED.md # docs/README.md
U4 6946 - Existing template file is overwritten when creating a new template in the backoffice
…to select columns based on predicated instead of string values.
U4-11514 - Content Picker adds sortable options to restrict within container
U4-10849 [uDuf] fixed Umbraco user field "User Last updated" and "last locke…
…nto iofsauron-U4-10975
UDUF (U4-10975) Failed Logon Attempts resets to 0 after maximum number of attempts
- Fix tests
Added "Select" and "AndSelect" to "PetaPoco"
…dation has not been enabled in the settings
… into bjarnef-dev-v7-U4-9025 # Conflicts: # src/Umbraco.Web.UI.Client/src/less/property-editors.less
Hi @bjarnef - I've been trying to figure out how to make this one work, but the Currently there's a few problems: sort order is not sent to the server, when I do send the sort order it's not persisted, when I do persist it ( Maybe it would be better to start this one from scratch, what do you think? FYI I updated
And in
|
Ah crap, now I've messed it up! :-( I pushed my changes, but that also included the merge so now everything is changed. Yikes. Well, have a look at the current state and then if you could see if you can figure out how to include the |
@nul800sebastiaan indeed it is a bit of a mess now and Github only shows latest 250 commits, so I can't actually see what I committed two years ago 😬😀 |
@nul800sebastiaan I will close this PR since I have cleaned up this mess and I have opened this new PR instead #2775 🦄 |
Issue: http://issues.umbraco.org/issue/U4-9025
I have added sortable to color picker prevalues, like multivalues prevalue editor.
However it has some issues saving model.value after sorting ... ui-sortable require
ngModel
, but when I add this, thenui.item.index()
returns another value, than if it is not added.I have previously noticed some bugs in then current version - not sure if this is related to this issue:
angular-ui/ui-sortable#218
I have also updated multivalues prevalue editor, so you can't add same prevalue twice like in color picker prevalues - e.g. if you add "Test 1" and then "Test 1" again you will get an error on save anyway.