Forum: Radiant CMS hidden pages

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Todd McGrath (Guest)
on 2007-03-03 23:41
(Received via mailing list)
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
Sean C. (Guest)
on 2007-03-03 23:47
(Received via mailing list)
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
Jamie M. Wilkinson (Guest)
on 2007-03-04 01:31
(Received via mailing list)
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
Todd McGrath (Guest)
on 2007-03-04 19:32
(Received via mailing list)
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. <removed_email_address@domain.invalid>:
Sean C. (Guest)
on 2007-03-04 20:52
(Received via mailing list)
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
This topic is locked and can not be replied to.