currently, the marking of new comments is done by adding
<span style="color: red;">*</span>
to an unread comments subject. this is bad mingling of code and layout, may mess up themes (imagine a red background!), messes up comments a la <!-- $subject --> (which becomes <!-- <span ...> -->, which is invalid html) and should really be moved to the theme.

why not just add a new field "$new" to $comment which can be evaluated by theme.comment()?

Comments

polaar@www.drop.org’s picture

Component: Code » Other

Why not a more general markup function in the theme, that can be used like this:

$theme->mark("this is a new comment")

This way, it can be used in other places too (number of new submissions, error messages etc...)kbd
The theme decides how to format "marked" text. To make this more flexible, a second argument should be added to indicate the type ("mark as..."), like this:

$theme->mark("this is a new comment","newcomment")
or
$theme->mark("this is an error message","error")

The theme could then decide whether to write:

this is a new comment<span style="color: red">*</span>
or
<span style="color: red">this is an error message</span>

or even just use the type as a css class like this:
<span class="newcomment">this is a new comment</span>

Any thoughts on this?

marco’s picture

This is fixed in the comment module in my sandbox. The comment object passed to themes has a $new attribute which is 1 if the comment is new. The theme then renders the comment as it wishes.

moshe weitzman’s picture

ax’s picture

Priority: Major » Normal