# ANN: Reordering of Pages

**URL:** <https://www.ruby-forum.com/t/ann-reordering-of-pages/84861>\
**Category:** Radiant CMS\
**Created:** [February 8, 2007, 6:23am UTC](https://www.ruby-forum.com/t/ann-reordering-of-pages/84861 "2007-02-08T06:23:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hirodusk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/6f9a4e/32.png) [@hirodusk](https://www.ruby-forum.com/u/hirodusk)\
**Post date:** [February 8, 2007, 6:23am UTC](https://www.ruby-forum.com/t/ann-reordering-of-pages/84861/1 "2007-02-08T06:23:23Z")

</div>

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/](http://dev.radiantcms.org/svn/radiant/branches/mental/extensions/)  
reorder  
[2] [http://dev.radiantcms.org/radiant/ticket/45](http://dev.radiantcms.org/radiant/ticket/45)  
[3] [http://dev.radiantcms.org/radiant/attachment/ticket/45/](http://dev.radiantcms.org/radiant/attachment/ticket/45/)  
sortable\_pages.mental.3.diff

---

<div class="post-metadata">

**Author:** ![hirodusk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/6f9a4e/32.png) [@hirodusk](https://www.ruby-forum.com/u/hirodusk)\
**Post date:** [February 8, 2007, 7:54am UTC](https://www.ruby-forum.com/t/ann-reordering-of-pages/84861/2 "2007-02-08T07:54:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hirodusk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/6f9a4e/32.png) [@hirodusk](https://www.ruby-forum.com/u/hirodusk)\
**Post date:** [February 8, 2007, 2:03pm UTC](https://www.ruby-forum.com/t/ann-reordering-of-pages/84861/3 "2007-02-08T14:03:14Z")

</div>

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 🙂

Todd

Quoting A. Williams [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![hirodusk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/6f9a4e/32.png) [@hirodusk](https://www.ruby-forum.com/u/hirodusk)\
**Post date:** [February 8, 2007, 4:36pm UTC](https://www.ruby-forum.com/t/ann-reordering-of-pages/84861/4 "2007-02-08T16:36:31Z")

</div>

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 🙂

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
