Opened 6 years ago

Closed 6 years ago

# [PATCH] root=self option to automatically refer to current ticket when used within a ticket

Reported by: Owned by: Patrick Schaaf Chris Nelson normal TracJsGanttPlugin normal 0.11

### Description

This patch enables a special value for the root=ID macro option, written as root=self. It can be used (and only makes sense) when the macro is embedded within a ticket, e.g. in the description of the parent of a tree of child/sub tickets.

Using root=self automatically determines the ticket ID of the current ticket by looking at the URL path_info (numeric stuff after /ticket/), and then uses that as the single root for the display.

While it is possibly for users with TICKET_EDIT_DESCRIPTION permission to edit the description after ticket creation, when they know the ticket ID, that is not the case for some users. This patch helps that situation, as the macro can be put into the description during ticket creation.

Also, when using clone, or other kinds of description-inheriting other-ticket creation, a description-embedded gantt macro call with root=self will continue to work, without having to adapt the root=ID to the newly created ticket.

The patch is patterned after a patch I did for ProgressMeterMacro, for the same reasons - see #8917

### Changed 6 years ago by Patrick Schaaf

root=self macro argument to refer to current ticket (when used in ticket description)

### comment:1 in reply to:  description Changed 6 years ago by Chris Nelson

Status: new → assigned

This patch enables a special value for the root=ID macro option, written as root=self. It can be used (and only makes sense) when the macro is embedded within a ticket, e.g. in the description of the parent of a tree of child/sub tickets. ...

Nice! Thanks.

### comment:2 Changed 6 years ago by Patrick Schaaf

Note https://trac-hacks.org/ticket/8961#comment:4 - when my options handling rework is applied, the condition for testing whether root has been specified, must change - but it isn't changed in the patch in this ticket (which was created against the still unchanged svn of this afternoon).

Hope this is not too confusing. I'll stop working on four fronts at once, now :)

Oh, and thanks a lot for the fast accepting of the tickets and initial feedback - it's the first time I get feedback on trac-hacks tickets, after five or six other patches to other plugins just sit in the databases...

### comment:3 Changed 6 years ago by Chris Nelson

(For some reason, my commit didn't link here automatically.)

(In [10408]) Allow "self" as a value for "root". Refs #8962.

When including a Gantt in a ticket description, root=self will show the children without an explicit ticket ID. This is useful in ticket templates and when cloning tickets so they don't need to be edited.

Thanks to bof for the patch!

### comment:4 follow-up:  5 Changed 6 years ago by Patrick Schaaf

Thanks for including all my patches! I'll replace my current local stuff tomorrow and test it through under 0.11.7 and 0.12.2.

Your last changeset, for setup.py, looks fishy - some cryptic stuff appears before the shebang.

### comment:5 in reply to:  4 Changed 6 years ago by Chris Nelson

Thanks for including all my patches! I'll replace my current local stuff tomorrow and test it through under 0.11.7 and 0.12.2.

I didn't include the openClosedTickets change since I'm going to do something else with that.

Your last changeset, for setup.py, looks fishy - some cryptic stuff appears before the shebang.

Fixed. Thanks. (You wouldn't believe the setup I'm working in right now. Verrrrrrry slow network.)

### comment:6 Changed 6 years ago by Chris Nelson

Resolution: → fixed assigned → closed

### Modify Ticket

Change Properties