Alchemy 5 - ordering contents in the editor #2397
Replies: 3 comments 2 replies
-
They should be displayed in the order they're defined in the |
Beta Was this translation helpful? Give feedback.
-
I was expecting that to be the case... but no, that's not the order they are appearing. Do you have a handle to what part of the code enforces that ordering? I know we've had to monkey patch a few things along the years to get Alchemy working for our setup, so I'm wondering if this is one of those areas where we've overridden the ordering of loading that data somehow (I'm looking at https://github.com/AlchemyCMS/alchemy_cms/blob/5.0-stable/app/views/alchemy/admin/elements/_element.html.erb#L28 which seems to load |
Beta Was this translation helpful? Give feedback.
-
It's in https://github.com/AlchemyCMS/alchemy_cms/blob/5.1-stable/app/decorators/alchemy/element_editor.rb#L16-L20 - But that bit of code only appears in Alchemy 5.1. Be advised we probably won't be taking PRs for 5.0 at this point, can you try upgrading yet another version and see if that fixes the issue? |
Beta Was this translation helpful? Give feedback.
-
So we're working on an Alchemy 4.6 -> 5.0 upgrade, and dealing with the removal of all the
_editor.html.rb
filesBut the "default" editors being presented don't appear to have any ordering? Looking in the rails log, I can see:
Alchemy::Content Load (0.7ms) SELECT "alchemy_contents".* FROM "alchemy_contents" WHERE "alchemy_contents"."element_id" = $1 [["element_id", 141344]]
Which means all the fields (7 in this case) are being presented in a very random order, which given all seven fields are text fields, makes for a very confusing editing experience, whereas before we had a custom editor template to ensure they all appeared in the correct logical order
I note the alchemy_contents table does have a
position
column, although the 7 rows in the table seem to have values ranging from 1-4 in that column with some duplication. No quite sure how / when they are set, but also looking at the SQL above and searching through the code, I'm not sure what that's doing (nothing, I suspect)Rails 5.2.8.1
Alchemy 5.0.10 (upgrading from 4.6.5)
Beta Was this translation helpful? Give feedback.
All reactions