[Radiant] Quick and Dirty Parent Change Hack
Ethan Winn
ebwebw+list+radiantcms at gmail.com
Fri Dec 8 19:14:19 CST 2006
It's surprisingly easy to add "Change Parent" functionality to Radiant
0.5.2(as requested in
http://dev.radiantcms.org/radiant/ticket/47). I just added these lines at
line 78 of views/page/new.rhtml:
<tr>
<td><label for="page_parent_id">Parent</label></td>
<td class="field"><%= select "page", "parent_id", (Page.find(:all,
:order => "title ASC").map { |s| [s.title, s.id] }) - [@page.title, at page.id]
%></td>
</tr>
This really isn't enough for release. Ideally the page list would be nested
and the order identical to that of the index. I'd like to clean this up and
make it a patch, but since I may never get around to it and so it's out
there here it is. If you want to be able to change parents quick without
going into the DB, this seems like a pretty straightforward solution. Any
ideas on how best to display the names nested? (I guess really this means
prefixing each name with a number of "-" characters equal to the number of
parents it has...)
Ethan
DIFF:
77a78,81
> <tr>
> <td><label for="page_parent_id">Parent</label></td>
> <td class="field"><%= select "page", "parent_id", (Page.find(:all,
:order => "title ASC").map { |s| [s.title, s.id] }) - [@page.title, at page.id]
%></td>
> </tr>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.radiantcms.org/pipermail/radiant/attachments/20061208/66cb8217/attachment.html
More information about the Radiant
mailing list