# Ordering of pages

**URL:** <https://www.ruby-forum.com/t/ordering-of-pages/83469>\
**Category:** Radiant CMS\
**Created:** [January 26, 2007, 1:15pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469 "2007-01-26T13:15:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 26, 2007, 1:15pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/1 "2007-01-26T13:15:03Z")

</div>

How can you order pages under a \<r:children:each\> ?

I can see the “by” parameter but what does that amount to?

I can see that it could be the title or the publication date, but what  
I’m  
trying to do is a a bit different that that.  
Let me express it as a general problem.

Can I do something like create a tab for each page under a parent, call  
it  
“sequence” and put a sequence number in it?

Can I do something like select the single item from a list of pages  
describing events that is the next one if there is a tab that has the  
date  
in it?

Can I control the order of menu items ?

/anton

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 26, 2007, 2:07pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/2 "2007-01-26T14:07:17Z")

</div>

You can order by any field on the ‘pages’ table/ Page model. Give the  
‘order’ attribute which direction you want to order it in (‘asc’/‘desc’)  
and the ‘by’ attribute the field you want to order on.

For your other situation, you’ll probably have to create your own tag  
definition (to order by something that’s in a part/tab). There has been  
some work in the past on adding an arbitrary ordering to Radiant with  
acts\_as\_list. If this is an increasingly requested feature and the  
implementation and case for it is solid, it might be added. However,  
features need to have a real pressing need before they are added,  
generally.

Sean

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 26, 2007, 2:38pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/3 "2007-01-26T14:38:24Z")

</div>

Sean C. said the following on 01/26/2007 08:08 AM:

> You can order by any field on the ‘pages’ table/ Page model.

Right.  
I see that in the documentation, but beyond ‘title’ and when it was  
published, what constitutes a “field”? I really don’t want to pour  
backwards and forwards though the code - this out to be documented!

Can the existence of a page part (the tab when editing like ‘sidebar’ or  
‘extended’) or its content be used? If I have one called ‘current’ can  
I  
percolate that to the top? If I have one called “order” in each of the  
pages can I use its content to sort?

> Give the  
> ‘order’ attribute which direction you want to order it in (‘asc’/‘desc’)  
> and the ‘by’ attribute the field you want to order on.

Yes, that asc/desc is clearly documented. But the ‘by’ remains  
confusing.

> For your other situation, you’ll probably have to create your own tag  
> definition (to order by something that’s in a part/tab).

In English, does that mean I have to write Ruby code to do this?

> There has been  
> some work in the past on adding an arbitrary ordering to Radiant with  
> acts\_as\_list.

I suspect you and I use the word ‘arbitrary’ slightly differently 🙂  
What I’m thinking of isn’t at all arbitrary, its quite strictly  
controlled.  
And I’m really surprised that better ordering of the children isn’t an  
issue.

Of course I may just be completely misunderstanding what you mean by  
‘field’. But as I say, it doesn’t grab me in the documentation or the  
code  
for \<r:children:each\>

I hope that there is something in there and Its just that I don’t  
understand  
what you mean by ‘field’.

> If this is an increasingly requested feature and the  
> implementation and case for it is solid, it might be added. However,  
> features need to have a real pressing need before they are added, generally.

I do understand about time and resource constraints! Oh boy, yes!

/a

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 26, 2007, 3:04pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/4 "2007-01-26T15:04:28Z")

</div>

Anton,

Even though Radiant has evolved fairly quickly, the fact is that it is  
a work in process which, in turn, means that many times people have to  
hack their work-arounds to get stuff working the way they want. So, if  
there’s a specific task that you cannot concieveably accomplish with  
existing tags, then you will HAVE TO write your own custom tags (i.e.  
Ruby coding).

By field is meant a database field. Fields can also be though as the  
columns in a database table. So, for example, you have a table with  
the following structure:

id|name|children|parent

where id, name, children and parent are fields (columns).

Now let’s say that you want to get all the list of children sorted  
alphabetically, descending by name, you would write something like  
(sql):

SELECT children FROM tablename ORDER BY name DESC;

or with the super easy Radius tags you would write something like

\<r:children by=“name” order=“DESC”\>  
#do stuff here … useful stuff preferably  
\</r:children\>

P.S.: someone please check this for accuracy as I have not slept a  
wink in the last couple of days/nights.

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 26, 2007, 2:50pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/5 "2007-01-26T14:50:26Z")

</div>

> Right.  
> I see that in the documentation, but beyond ‘title’ and when it was  
> published, what constitutes a “field”? I really don’t want to pour  
> backwards and forwards though the code - this out to be documented!

If you look in db/schema.rb or use a tool to inspect the database, you  
can  
see what fields are available in the database.

Here’s what my schema.rb says:

create\_table “pages”, :force =\> true do |t|  
t.column “title”, :string  
t.column “slug”, :string, :limit =\> 100  
t.column “breadcrumb”, :string, :limit =\> 160  
t.column “class\_name”, :string, :limit =\> 25  
t.column “status\_id”, :integer, :default =\> 1,  
:null =\> false  
t.column “parent\_id”, :integer  
t.column “layout\_id”, :integer  
t.column “created\_at”, :datetime  
t.column “updated\_at”, :datetime  
t.column “published\_at”, :datetime  
t.column “created\_by”, :integer  
t.column “updated\_by”, :integer  
t.column “virtual”, :boolean, :default =\>  
false,  
:null =\> false  
end  
Now some of those are fields that don’t make sense to order by – for  
example, class\_name or layout\_id or status\_id, and in the context of  
children, parent\_id is always going to be the same.

Can the existence of a page part (the tab when editing like ‘sidebar’ or

> ‘extended’) or its content be used? If I have one called ‘current’ can I  
> percolate that to the top? If I have one called “order” in each of the  
> pages can I use its content to sort?

Currently, I believe they are ordered by id inside the application,  
which  
basically means creation order.

In English, does that mean I have to write Ruby code to do this?

Yes. It’s not much, maybe about 15 lines. Since you can do practically  
anything Ruby inside the tag definition, sorting pages by one of their  
page  
parts should be relatively trivial.

I suspect you and I use the word ‘arbitrary’ slightly differently 🙂

> What I’m thinking of isn’t at all arbitrary, its quite strictly  
> controlled.  
> And I’m really surprised that better ordering of the children isn’t an  
> issue.

Yes. What I mean is an ordering that is orthogonal to the domain of the  
model, which is what acts\_as\_list does.

Of course I may just be completely misunderstanding what you mean by

> ‘field’. But as I say, it doesn’t grab me in the documentation or the  
> code  
> for \<r:children:each\>
> 
> I hope that there is something in there and Its just that I don’t  
> understand  
> what you mean by ‘field’.

Unfortunately, the documentation has been really poor in the past.  
However,  
it should get better as time goes on, especially with the tag reference  
UI/DSL that is now available in mental. Speaking of, I need to add  
Textile  
to that…

Sean

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 26, 2007, 3:41pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/6 "2007-01-26T15:41:38Z")

</div>

Todd McGrath said the following on 01/26/2007 09:18 AM:

> +1 on ordering.

What? only “1”?

> More about my need:  
> Creating a product catalog site. Using f:find, r:children:each throughout the  
> site to produce HTML and XML pages. Client really particular about ordering of  
> the Product pages. Unfortunately, product pages cannot use existing fields for  
> ordering, e.g. alphabetical on any field or date. Sure, I can add a position  
> field (which I believe acts\_as\_list does) and update by hand to create the  
> ordering they want, but this feels like a hack. I want them to be able to  
> reorder without calling me.

Same but different here.

> What I’m trying to do about it:  
> I’ve attempted to implement patch files from ticket 199 into mental. I’ve got  
> it to work, but it’s really slow. Haven’t had a chance to diagnose in more  
> detail yet. Also, that ticket’s patch files moves administration page display  
> to
> 
> - based rather than current table based, so it’s really off the path  
> of Mental (as I understand it). Not too keen on moving far off the path.

I’m not keen on it either - arbitrary patches, even if I had the time to  
learn Ruby, Rails. (Not that I don’t intend to, but its a matter of  
priorities. Only so much time.) Like you, Todd, I have to deal with  
the  
content and structure and presentation rather than the code. That’s why  
I’m  
using CMS. The client baulked - rightly so - at the complexity of  
Joomla  
and Drupal. Rightly so. TWiki was almost there, but its a huge  
footprint  
and as it has bloated it has slowed down. The content model of Radiant  
is  
nice and clear. The “programming” of the structure with the tags isn’t  
difficult. Textile scared them at first since they’d never heard of it,  
but  
once they say how much easier it was than HTML they were relieved. “Its  
almost like you’d write in e-mail”. Indeed.

I appreciate that Radiant is just at 0.5.x But the reality is that a  
lot of  
software at 2.x or 3.x still has problems. Its ALWAYS “work in  
progress”.  
As are out client sites ☹

/a

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 26, 2007, 4:35pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/7 "2007-01-26T16:35:49Z")

</div>

On 1/26/07, Anton J Aylward [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How can you order pages under a \<r:children:each\> ?

WhatI’ve done is to (ab)use the “slug” field and putting a number there.

Then by=“slug” order=“asc” does the sorting.

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 26, 2007, 3:19pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/8 "2007-01-26T15:19:31Z")

</div>

+1 on ordering.

More about my need:  
Creating a product catalog site. Using f:find, r:children:each  
throughout the  
site to produce HTML and XML pages. Client really particular about  
ordering of  
the Product pages. Unfortunately, product pages cannot use existing  
fields for  
ordering, e.g. alphabetical on any field or date. Sure, I can add a  
position  
field (which I believe acts\_as\_list does) and update by hand to create  
the  
ordering they want, but this feels like a hack. I want them to be able  
to  
reorder without calling me.

What I’m trying to do about it:  
I’ve attempted to implement patch files from ticket 199 into mental.  
I’ve got  
it to work, but it’s really slow. Haven’t had a chance to diagnose in  
more  
detail yet. Also, that ticket’s patch files moves administration page  
display  
to

- based rather than current table based, so it’s really off  
the path  
of Mental (as I understand it). Not too keen on moving far off the  
path.

Supposedly, the sortable code from Scriptaculous is able to work with  
tables if  
you use thead as the container, but I can’t verify.

I’m going to need to solve this eventually, because I’ll going to jab a  
pencil  
in my wrist if I receive many more, “Todd, can you move page x to right  
below  
page y” requests.

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

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 26, 2007, 5:11pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/9 "2007-01-26T17:11:57Z")

</div>

Would like to add my vote for this too, there have been a few cases  
where  
I’ve had to use the numbered slug workaround even though it produces  
ugly  
urls.

Kev

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 26, 2007, 7:38pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/10 "2007-01-26T19:38:31Z")

</div>

Loren J. wrote:

> I don’t currently feel qualified to work-up a new patch nor improve  
> the existing one, but I’ve got $$$ (seriously) for the first one to  
> do it well enough to get it included in a core release.

I have a client who wants to help foot the bill for this. Contact me  
directly if you want to help.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 26, 2007, 5:08pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/11 "2007-01-26T17:08:55Z")

</div>

This has got my fervent vote.

I’ll try and not go on and on… but…

For every of the 5 or 6 sites I’ve now put up in Radiant sorting was  
a requirement that I have had to work around not having. It seems  
like it’d be a very natural addition to what Radiant is.

Mostly the workarounds have entailed manually maintain navigation  
schemes where I otherwise would have just done a  
\<r:childeren:each … or written a tag to automate them. On the most  
complex site we have up, [www.diopa.org](http://www.diopa.org), all of the 2nd and 3rd level  
navigation items of which there are a fair amount, get created  
through an annoying set of snippets and \<r:if … \<r:unless …  
switches to bring in the right snippet of completely manually  
maintained navigation.

The worst part of this is that every time my client or designer wants  
content added in these sections (most of the site) I have to add it  
to the nav for them.

Also, one of Radiant’s more significant talents derived from it’s  
simplicity is that it’s a great tool for figuring-out the initial  
structure and content of a site. However, the pretty hierarchical  
page tree so central to Radiant admin is much diminished in this role  
without the ability to freely move pages around as you work away. So  
re-parenting is equally important to me in at least this respect.

I tried the patch long ago and found it to be cumbersome and slow and  
I really don’t want to worry about maintaining a patched environment.

I don’t currently feel qualified to work-up a new patch nor improve  
the existing one, but I’ve got $$$ (seriously) for the first one to  
do it well enough to get it included in a core release.

So much for not going on and on…

Loren  
[www.fn-group.com](http://www.fn-group.com)

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 30, 2007, 1:05pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/12 "2007-01-30T13:05:04Z")

</div>

Hi Adam,

A couple of thoughts-  
I think you described something similar to what acts\_as\_list does - adds  
a  
position int field.

Drag-n-drop-  
In mental, front-end drag can be accomplished by making two changes to  
views/admin/page/index.rhtml:

and anywhere at the bottom of the page:

\<%= sortable\_element ‘list’,  
:tag =\> ‘tr’,  
:update =\> ‘list-info’,  
:complete =\> visual\_effect(:highlight, ‘list’),  
:url =\> { :action =\> “children” } %\>

[http://wiki.script.aculo.us/scriptaculous/show/Sortable.create](http://wiki.script.aculo.us/scriptaculous/show/Sortable.create)

These ideas are just a potential starting point. I’ve verified the  
front-end  
javascript works in firefox 2.

If someone does these two things, they see some issues right way:

- the ajax action call to children doesn’t work. I’m just testing  
whether or  
not drag-n-drop will work with tables instead of lists. So far, so  
good. The  
server-side code still needs to be written.

- code would test for when a page has children. drap-n-drop gets funky  
when  
you move pages with children (possibly using the “only” option when  
setting up  
the sortable\_element. See wiki link above)

Well, I just wanted to share some things I’ve experienced so far. I’d  
love to  
get ordering of pages working.

Todd

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

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 30, 2007, 5:52am UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/13 "2007-01-30T05:52:56Z")

</div>

Just a suggestion on how it could be implemented…  
How about a concept of ‘weights’ for pages… ranging from -9 to +9,  
with the default being 0. It becomes easy to order pages using this  
method… just assign -1 to any pages you want above the default, +1  
to any below the default. Etc ad inspirum. (I just made that up -  
probably not real latin 🙂  
Note: This also means that you can still order alphabetically, for  
example, but page weights have priority.  
Drag and drop ordering sounds very difficult and complicated… this  
would work and be easy to implement in the short term.

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 30, 2007, 1:37pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/14 "2007-01-30T13:37:13Z")

</div>

Todd,  
You’re probably right, I haven’t investigated acts\_as\_list… I just  
thought that adding a single field with a primary and secondary value  
to sort by would be far easier than drag and drop (and maybe more  
intuitive, naturally people want pages ordered alphabetically, or by  
date, or whatever, but some pages are more important than others).

Drag and drop sounded like a fair amount of work, but as your reply  
has shown, I don’t know what I’m talking about. 🙂

Ps. I am constantly amazed by Rails: drag and drop sortable list with  
“1” line of code? Preposterous! The thought of trying to do this in  
PHP gives me cold sweats…

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 30, 2007, 2:06pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/15 "2007-01-30T14:06:26Z")

</div>

Adam S. said the following on 01/29/2007 11:51 PM:

> Just a suggestion on how it could be implemented…  
> How about a concept of ‘weights’ for pages… ranging from -9 to +9,  
> with the default being 0. It becomes easy to order pages using this  
> method… just assign -1 to any pages you want above the default, +1  
> to any below the default. Etc ad inspirum. (I just made that up -  
> probably not real latin 🙂  
> Note: This also means that you can still order alphabetically, for  
> example, but page weights have priority.  
> Drag and drop ordering sounds very difficult and complicated… this  
> would work and be easy to implement in the short term.

This is how I first thought the order by worked!  
I thought something along the lines of creating a new page part  
and you put the number in there.

That was its under the author/editor’s control, which is how it should  
be.

In my case I need to have a section like the blog postings that list  
events.  
However their titles are either calendar date - “February 7th 2005”,  
“December 10th 2006” - or the name of the Event “Annual General  
Meeting”,  
“Ladies Night” - and the order in which they are created doesn’t  
correspond  
to the order in which they will occur.

There is also a section on the staff and board of this society, so  
titles  
like “President, Vice President, Secretary, Treasurer, Event Secretary,  
Membership Secretary, …” have to be in an order that reflects the  
organization, not alphabetical or date the record was created.

Having a page-part labelled “order” which controls sorting by use of the  
ASCII ordering of the first lines offers a great deal of flexibility.

How difficult would it be to implement?

–  
Most people are not really free. They are confined by the niche in the  
world that they carve out for themselves. They limit themselves to  
fewer  
possibilities by the narrowness of their vision.  
–V. S. Naipaul

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 30, 2007, 6:40pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/16 "2007-01-30T18:40:28Z")

</div>

With all due respect, I agree with Jacob. Everything discussed so far  
sounds like a hack. Let’s bat around what the right solution is a  
little longer before worrying about how it’s going to be done. Here  
are the possible ways I see, in order of preference (see that’s an  
arbitrary ordering right there 😉

Option 1  
My opinion on how to do this “right” would be to have the nodes  
within the tree draggable. Ideally I could even drag between parents,  
auto-expanding of collapsed nodes as you drag the page over them. If  
that were fully implemented I can’t see that being confusing to  
anyone, it’s pretty standard GUI stuff these days.

However, I can see this being a volatile setup if the drag timings  
and indicators weren’t crystal clear and really worked-out. Even  
then, free dragging and dropping can easily create a messy accident.  
This could be solved with a confirmation popup a la “do you really  
want to delete this page part?” but with a more lengthy message  
something like:

* * *

Do you really want to move the Page and all it’s children:

Parent \> Child \> Child with a very Long Title \> Child

to

## Parent \> Child \> Another page ?

Option 2  
An alternative would be just a free drag within a set of children and  
then an explicit “Move Page Tree” link for re-parenting such that  
when it was clicked a flash message would appear up top saying  
“Select the new location of this Page (and it’s children).” …

I’d prefer this solution but I don’t like the idea of having another  
link on every item on the tree or having to come-up with a whole  
small set of feedback indicators for “selecting the new  
location” (see how picky I am, jeesh!).

Working through a mock-up of this second option might reveal how to  
simplify it further.

Option 3  
Finally, it should be mentioned that in Matt Mcray’s Comatose CMS  
Plugin which resembles Radiant much there is just a “Parent” drop  
down box revealed once you click the \<more…\> link on a page to  
reveal the slug, etc. The drop down has a text indented version of  
the page tree within it. Just select your new parent and save.

Reordering is handled by drag and drop after clicking a “reorder  
children” link on the parent node.

The combination of these two things works for me too. It’s simple and  
uncluttered and definately nothing is going to happen by accident.

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 30, 2007, 3:32pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/17 "2007-01-30T15:32:44Z")

</div>

Your proposals so far all sound like hacks to me.

There’s nothing wrong with a Hack. But if we want to solve this problem  
for good and check it in to Mental/Trunk. We should solve it the right  
way.

And the only thing that makes sense to me is to add an “order” column to  
the “pages” table.

This column should be the default order of everything, and should be  
auto-populated as you create new pages.

All of this is simple and straightforward.

The real question in my mind is how it should look from an interface  
perspective.

Should you be able to drag and drop pages from within the tree view?  
Sounds complicated and potentially confusing, but perhaps it could be  
done…

So, I think there would need to be a seperate page for ordering. Where  
somehow you say “I want to order all the children of this page”. And you  
go to a screen where you can drag-drop re-order them.

So, where should the magic “I want to order all the children of this  
page” button be? Should it be somewhere in the tree view, somewhere on  
the edit page screen? What should it look like? What should it be  
called?

Thoughts people? I could totally implement this…

John L., what’s your client’s budget for this feature? : )  
Would he want it added to Mental or to Trunk?

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 30, 2007, 7:16pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/18 "2007-01-30T19:16:38Z")

</div>

Ahh, attempting to implement 2 features at once? re-ordering as well as  
parent/hierarchy changing?

While we’re solving other problems at the same time, what about the  
problem of too many pages? The secondary screen we use for re-ordering,  
could also be the secondary screen we use to display the full list of  
pages under a particular parent when the number of children reaches a  
certain limit. (And we thus don’t show all child pages in the full tree  
view).

I’m a little worried, because I want my radiant users to be able to  
re-order things, but not to re-parent things. And having re-parenting  
through the same mechanism as re-ordering could make it more difficult  
to re-order, and could also make it a hassle to somehow permission  
things so that only re-ordering is allowed for certain user types…

I think it’s time for a mock-up…

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 30, 2007, 8:00pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/19 "2007-01-30T20:00:41Z")

</div>

While I agree 100% that it’s mock-up time, I must comment that your  
scenario below seems more likely a proprietary requirement than the  
inverse… Just a thought. I’d be pretty disappointed to not have  
the ability to re-parent pages in admin. I think the Comatose  
solution of putting a “hidden” drop down where you specify the parent  
of the page provides some of what you need as it makes reparenting a  
little bit obscure and out of the path of the ordinary content  
creator / editor.

As for “too many pages”, yes this probably needs to be addressed. The  
[www.diopa.org](http://www.diopa.org) site has quiet a few pages and things are still feeling  
ok to us. I’ve played-around with taking-out the page icon and  
shrinking the row height to make the listing shorter and more “all  
business”. This helped a lot. But as for the “right way” to do  
this… hmmm…

I don’t follow your scenario too well personally I’d love to see any  
mock-ups. I like thinking about a future Radiant would have a  
standard way of filling the page with just one node and all it’s  
children down … especially if it related in someway to a  
permissions system or build-in hooks for such a thing to be more  
easily extended in…

---

<div class="post-metadata">

**Author:** ![Anton\_J\_Aylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@Anton\_J\_Aylward](https://www.ruby-forum.com/u/Anton_J_Aylward)\
**Post date:** [January 30, 2007, 9:11pm UTC](https://www.ruby-forum.com/t/ordering-of-pages/83469/20 "2007-01-30T21:11:50Z")

</div>

Does anyone else appreciate the ability to re-parent nodes as a great  
asset for Radiant as a site planning tool (http://  
[www.sparrowstyle.com/blog/comments/radiant\_as\_a\_site\_planning\_tool](http://www.sparrowstyle.com/blog/comments/radiant_as_a_site_planning_tool) –  
not my article, but I agree).

I had used the patch initially and got so annoyed with the cumbersome  
icons and the unsatisfying “up 1”, “down 1” metaphor. It’s a set  
along the way and I’m sure many have put-up with it as-is to do thing  
with their sites otherwise not possible, but what’s next? What’s the  
best way to do this and get it in a release?

My vote is for:

A subtle drag handle/icon next to every node. A confirmation on the  
move if it’s a reparenting otherwise on a reorder it just does it,  
maybe with a little highlight effect feedback…

Skip “auto expand” as you drag around to re-parent unless it’s easy  
and isn’t jumpy (auto expanding can be annoying).

- It sounds to me like the ability to turn-off these options,  
especially re-parenting, would be desirable. But I don’t know how to  
approach that without talking about roles and permissions. If the  
target for the CMS remains to be a small team of trusted individuals  
then I think implementing the reparenting scheme such that it’s not  
easy/impossible to do by mistake is good enough security.

[Next page](https://www.ruby-forum.com/t/ordering-of-pages/83469.md?page=2)
