ANN: Reordering of Pages


#1

Radiant Users,

I have just checked in the reorder extension [1]. It adds the ability
to reorder the children of a Page. This continues to address ticket
45 [2]. John L. has written 99% of the reordering code; I simply
made a couple of tests pass and made his work, as seen in this [3]
patch, an extension. There have been a few tags added to aid
navigation of Pages as well - more will come soon. The plan is to
eventually make this feature a part of core, but the extension can
help some of you today.

Please do view the README. Being mindful of interfaces, I hope that
the update:public task that you encounter can become better named in
the future.

Hoping you find this useful,

adam williams (aiwilliams)

[1] http://dev.radiantcms.org/svn/radiant/branches/mental/extensions/
reorder
[2] http://dev.radiantcms.org/radiant/ticket/45
[3] http://dev.radiantcms.org/radiant/attachment/ticket/45/
sortable_pages.mental.3.diff


#2

Hoorah! hoorah!

Thank you, thank you and thank you! to John and Adam.

This is going to make several things better for our particular use of
Radiant.

Loren


#3

Nice job John and Adam!

In my case, I think it’s going to make more sense for users to have
position be
the default order. So, I made the following change in standard_tags.rb
to set
default order by to use position in children:each:

#by = (attr[:by] || ‘published_at’).strip
by = (attr[:by] || ‘position’).strip

I’ll hope this change is incorporated into core in the future :slight_smile:

Todd

Quoting A. Williams removed_email_address@domain.invalid:


#4

On Feb 8, 2007, at 8:02 AM, Todd McGrath wrote:

In my case, I think it’s going to make more sense for users to have
position be
the default order. So, I made the following change in
standard_tags.rb to set
default order by to use position in children:each:

#by = (attr[:by] || ‘published_at’).strip
by = (attr[:by] || ‘position’).strip

I’ll hope this change is incorporated into core in the future :slight_smile:

Todd,

In the extension, and extensibly in the patch that may be used in the
future, the children association has been modified to be:

Page.reflections[:children].options[:order] = "position ASC"

I can see why you would want this in children_find_options as well.
Once a collection becomes an array, the position is the natural sort
order. On the other hand, part of the default behavior of
children_find_options is to only return children which are published.
This could be used to argue that published_at is a more appropriate
sort order.

It would be nice to hear from others on this matter. Please indicate
why one way is better than another.

adam williams