Hi,
I have a few result pages that should only render after a form
submission.
Thank you for you submission, blah, blah. The problem I’m having is how
to
classify these pages to not show up in <r:children:each>. It’s not an
option
to move these pages to an area of the tree that will not be picked up by
r:children:each.
Do you know what I mean? I feel like I’m missing something obvious.
If I set the pages to hidden, it won’t be found in <r:children:each>,
but it
also won’t be found outside of dev.host?
Confused,
Todd
You might consider adding a part, like the technique used in the
site-map idea, that you check for inside the <r:children:each> with a
<r:unless_content> tag.
Sean
Sean, excellent solution. I actually hacked a “hidden” bool onto Page
and then put a little checkbox in the admin UI. Would send along the
patch but Sean’s solution is much cleaner IMO
-jamie
Thank you, I see how this could work and appreciate the idea.
You know, I don’t really like to modify the code outside of extensions,
but
after a little code review, I guess a quick fix could also involve
updating the
page.rb published? method:
def published?
status == Status[:published] || Status[:hidden]
end
Or could I do this in an extension somehow?
Quoting Sean C. [email protected]:
You could do this in an extension, but my main question is… why?
Anyway, here’s how I would do it in an extension:
#…
def activate
Page.class_eval do
def published?
status == Status[:published] or status == Status[:hidden]
end
end
end
#…
Sean