[typo] Comment box hiding?
Dick Davies
rasputnik at gmail.com
Wed Sep 21 06:45:11 EDT 2005
On 20/09/05, Mike Purvis <mike at uwmike.com> wrote:
> Justus Pendleton wrote:
>
> ><% if @article.allow_comments? -%>
> > <%= render :partial => 'comment_box' %>
> ><% else -%>
> > <p>Comments are disabled</p>
> ><% end -%>
> Sorry, didn't quite make myself clear... That works okay, when the
> "allow_comments" flag is manually set. But as part of the spam-controls,
> I've also set it to reject comments on articles older than 30 days.
Doesn't help with the page caching, but
In lib/spam_protection.rb, there's a check made for age of an article.
The following *should* work in a view ( lifted from lib/spam_protection.rb -
haven't tested, see below):
> ><% if SpamProtection.new.article_closed?(@article) -%>
> > <%= render :partial => 'comment_box' %>
> ><% else -%>
> > <p>Comments are disabled</p>
> ><% end -%>
That's pretty ugly, but it should be straightforward to knock
up a helper to check both conditions and use that from the view.
I'd do it myself, but my 2 year old has poured blackcurrant squash
into my laptop (bless her) so I might take a day or two to come
up with a ticket.
Feel free to point out my idiocy, I have only glanced at typo so far.
--
Rasputin :: Jack of All Trades - Master of Nuns
More information about the Typo-list
mailing list