Re sorting and re parenting patch

I really wanted to see this functionality but I all saw was talk so I
scratched my own itch. Code wise it is pretty clean but the UI is
functional but ugly. All the movements are via the page index page
with a little ajax for #3 and #4. It works on the “styled blog” test
site.

http://dev.radiantcms.org:9007/radiant/ticket/179

This adds five movements to pages:
Sorts
#1 Sort up in container
#2 Sort down in container
Reparenting
#3 Become a child of one of my parents siblings
#4 Become a child of one of my siblings
#5 Become a sibling of my parent

Sorting is via a sort attribute. On creation each page is assigned a
sort_id from a bottomless pool. Changes in the sort are via swaping
sort_id’s with the next page in the proper direction. The original
order of the sort presently used is maintained to some degree as the
sort attribute is assigned sequentially over time with has the same
effect of the ASC timestamp sort.

Reparenting is constrained to those movements that make sense. The
root node can not be preparented. moves that there is no where to
move to are also blocked at the UI level

Steps needed to use this:

run migrate to add column and add sort table

set sort id’s for existing pages " update pages set sort_id = id;"

wroks on postgresql and maintains the orginal sorting order

set the sequence used by the sort table to the id after the last

assigned one in the pages table. OR for other DB file the sort table
to the same point as pages table # put the icons inplace.

Issues/future work
The icons I used are ugly.
Does not stop reparenting to virtual pages.
Moves could be made to display via AJAX without refreshing page.

I fixed a few errors. You need to specify a the by=“sort_id” ala
<r:children:each order=“ASC” by=“sort_id”> for the display to sort
correctly. Otherwise it defaults to the normal way.

Erik B. Ordway wrote:

I fixed a few errors. You need to specify a the by=“sort_id” ala
<r:children:each order=“ASC” by=“sort_id”> for the display to sort
correctly. Otherwise it defaults to the normal way.

Don’t you think it would be better to make sort_id the default column?


John L.
http://wiseheartdesign.com

Erik B. Ordway wrote:

I was trying to limit the effect of the change. For the most part
everything works like it did before the patch. I agree though that
changing the default to sort_id would make more sense.

Let’s change it.


John L.
http://wiseheartdesign.com

I was trying to limit the effect of the change. For the most part
everything works like it did before the patch. I agree though that
changing the default to sort_id would make more sense.

There is a patch in added to the ticket that should do it.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs