Opened 10 years ago

Last modified 9 years ago

#2385 new enhancement

AddComment Improvements

Reported by: adrian@… Owned by: osimons
Priority: normal Component: AddCommentMacro
Severity: normal Keywords:
Cc: leho@… Trac Release: 0.11


I like this macro.

Nice if possible to:

  • enfasize the comment itself instead of the text "Comment by..." ie: don't use bold on this text or chage the color to grey (like the one appears on this page at "Description Preview" box)
  • change date format to YYYY-MM-DD hh:mm:ss (hh = 24 formated time)
  • presentation could it be one of this ways:
    • <user> commented this on YYYY-MM-DD hh:mm:ss
    • Comment added on YYYY-MM-DD hh:mm:ss by <user> (this I guess would be preferable)
  • an user option to expand / collapse comments

Documentation improvements

  • Add an Installation section (could it be like this) Note: Instructions on how to install a plugin: [
    1. Install MacroPostPlugin
      1. Enable through WebAdmin panel (this line is because that other macro isn't clear)
      2. Restart server
    2. Install AddCommentMacro
      1. Enable through WebAdmin panel (this line is because this macro isn't also clear/explicit)
      2. Restart server
  • Example:

Renders this

Include here a screenshoot

Nice Work!!


  • That's my 2cents. Feel free to contact me in case of doubts (or if weren't clear :( ).
  • the "clear/explicit" issue is because beginers like me need more recipes to be more efficients. I think givin all the tips on the same place improves user satisfaction. But if the guideline is to be DRY, forget abbout this particular comment.
  • BTW I installed and it worked nicely.

Attachments (0)

Change History (6)

comment:1 Changed 10 years ago by Alec Thomas

Owner: changed from Alec Thomas to Christian Boos

comment:2 Changed 10 years ago by Alec Thomas

Owner: changed from Christian Boos to osimons

Err, whoops.

comment:3 Changed 10 years ago by osimons

The macro has some inherit problems doing custom display in that it just inserts text into the wiki page, and will render like any other text on the wiki page. That is why custom styling and comment folding and such will likely not get done as part of the macro in its current incarnation as the macro cannot influence that rendering.

The point about date/time formatting though is very relevant actually - as the text gets inserted into the wiki markup regardless of locale it may also soon inherit the locale of the user making the comment. It may indeed be a good idea to use a common, more or less international, way of rendering the time in a uniform manner. I'll add that to my todo list.

Lastly, the feedback on the wiki page with instructions and info: It is a wiki page, editable by everyone. If you as a user feels something is missing, then by all means just edit the page to add whatever you find out that may help others use the macro. Be my guest :-)

comment:4 in reply to:  3 Changed 10 years ago by osimons

Replying to osimons:

The point about date/time formatting though is very relevant actually....

Well, look at it and it probably isn't such a good idea now anyway. The formatting uses the server locale setting - with many ways to override it and use your own. That means it will also follow the other similar Trac datetime points. See wiki:TracFaq#how-do-i-change-the-format-used-for-displaying-date-and-time.

I think it is preferable to just leave it until this gets redone for 0.12 following Babel introduction and such.

BTW, enclosing a patch that gives you what you requested, but it won't make it to the repos anytime soon.

  • 0.11/addcomment/

    8181        # If we are submitting or previewing, inject comment as it should look
    8282        if cancomment and comment and (preview or submit):
    8383            heading = tag.h4("Comment by ", authname, " on ",
    84                         to_unicode(time.strftime('%c', time.localtime())),
     84                        to_unicode(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())),
    8585                        id="commentpreview")
    8686            if preview:
    8787                the_preview = tag.div(heading,
    105105                if line.find('[[AddComment') == 0:
    106106                    newtext += "==== Comment by %s on %s ====\n%s\n\n" % (
    107107                            authname,
    108                             to_unicode(time.strftime('%c', time.localtime())),
     108                            to_unicode(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())),
    109109                            comment)
    110110                    submitted = True
    111111                newtext += line+"\n"

comment:5 Changed 10 years ago by LK <leho@…>

Cc: leho@… added; anonymous removed

Ability for user to select the height of edit box, like trac built in wiki editor, would be very nice.

comment:6 Changed 10 years ago by LK <leho@…>

If you preview a page with AddComment? in it, it shows me two button toolbars on top of each other in the add comment box.

Modify Ticket

Change Properties
Set your email in Preferences
as new The owner will remain osimons.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.