Edgewall Software
Modify

Opened 17 years ago

Last modified 9 years ago

#5227 new enhancement

provide option to insert summary in a ticket link

Reported by: Eli Carter Owned by:
Priority: low Milestone: next-major-releases
Component: wiki system Version: devel
Severity: minor Keywords:
Cc: Ryan J Ollos, Thijs Triemstra Branch:
Release Notes:
API Changes:
Internal Changes:

Description

It would be nice to be able to create a ticket link that automatically includes the summary line for the ticket. A possible syntax for this could be [ticket:23:summary] and have it do the same thing as [ticket:23 #23: Prettier "Access Denied" message.], so it would look like #23: Prettier "Access Denied" message..

Attachments (2)

resource_macro.patch (1.7 KB ) - added by Mark Mc Mahon <mark.mcmahon@…> 14 years ago.
Simple resource macro
resource_macro_multiple_formats.patch (2.1 KB ) - added by Mark Mc Mahon <mark.mcmahon@…> 14 years ago.
Allow multiple formats separated with | character

Download all attachments as: .zip

Change History (24)

comment:1 by Christian Boos, 17 years ago

I have one reserve about this: usually, the ":" is used for separating arguments composing the target of the link (e.g. comment:1:ticket:5227, googlegroups:trac-dev:7505cdd4e241b5a8). In this case, you'd not link to the summary of the ticket, but rather change the presentation of the link. So I think we should come up with another syntax, something that could eventually be generalized to other kinds of label tweaking.

E.g. [ticket:123+summary]

That could be transposed in other contexts: wiki:TracDev+title, report:23+title

comment:2 by sid, 17 years ago

+1 to this. I also think the syntax proposed by cboos work would quite well.

comment:3 by Christopher Lenz, 17 years ago

I'd strongly prefer this being a macro. The wiki links syntax is complicated enough already.

comment:4 by osimons, 16 years ago

With 0.11 it can be a [[Resource]] macro that takes in realm, id and optionally version, and uses the presentation and link generation from the Resource system. Nice and generic, and will work for anything in Trac or added to Trac via plugins that supports the new resource system.

The Resource API has a get_resource_description() that supports a format=summary parameter as input - a nice default, with 'default' and 'compact' as optional args.

A 10-line macro. No further changes needed.

comment:5 by Christian Boos, 16 years ago

Component: ticket systemwiki
Milestone: 0.12
Owner: changed from Jonas Borgström to Christian Boos
Priority: normallow
Severity: normalminor
Version: devel

Interesting. A bit more verbose than the original proposal, but as you said, more general.

comment:6 by Nils.drews@…, 15 years ago

is this "10 line makro" somewhere available? I didn't find it anywhere on trac-hacks or somewhere else. And i am not in writing trac makros, so it would take more time, than i have to do this.

comment:7 by Christian Boos, 14 years ago

comment:8 by mark.m.mcmahon@…, 14 years ago

OK - I made a few false starts, but I put together a fairly simple Resource macro that might do.

I would guess I am being too lenient for parameters (e.g. stripping whitespace, and allowing parameters to be passed as args or keywords). Removing most of that would make the macro super simple :)

by Mark Mc Mahon <mark.mcmahon@…>, 14 years ago

Attachment: resource_macro.patch added

Simple resource macro

comment:9 by Mark Mc Mahon <mark.mcmahon@…>, 14 years ago

Oh - and maybe to achieve the proposed return value above how about a 'complete' resource display format? which would also include the defect number? (Summary doesn't contain the #23 in #23: Prettier "Access Denied" message. i.e. the 'summary' format is defect: Prettier "Access Denied" message.(closed)

in reply to:  9 comment:10 by Remy Blank, 14 years ago

Replying to Mark Mc Mahon <mark.mcmahon@…>:

Oh - and maybe to achieve the proposed return value above how about a 'complete' resource display format?

Isn't there already a "short" format that returns the short form of the link? This could be used in combination with the default format.

comment:11 by Mark Mc Mahon <mark.mcmahon@…>, 14 years ago

I guess you could..

[[Resource(ticket,23,format=compact]][[Resource(ticket,23,format=summary]]

would produce something like

#23 defect: Prettier "Access Denied" message.(closed)

I just noticed that the doc string in the patch is incorrect - it mentions 'complete' rather than 'summary' format.

in reply to:  11 comment:12 by Remy Blank, 14 years ago

Replying to Mark Mc Mahon <mark.mcmahon@…>:

I guess you could..

[[Resource(ticket,23,format=compact]][[Resource(ticket,23,format=summary]]

Or even:

[[Resource(ticket,23,format=compact|summary]]

and have the macro concatenate both.

by Mark Mc Mahon <mark.mcmahon@…>, 14 years ago

Allow multiple formats separated with | character

comment:13 by Mark Mc Mahon <mark.mcmahon@…>, 14 years ago

I have added a new patch which allows multiple formats to be supplied. To tell the truth I feel that maybe a format string might be a good way to go for Resource.render_resource_link().

realm, version, id would be common parameters across all resource types, and then each individual resource may have other resource types (e.g. summary, status, etc for tickets, due_date for milestones, etc)

comment:14 by Ryan J Ollos <ryano@…>, 14 years ago

Cc: ryano@… added

comment:15 by Christian Boos, 13 years ago

#10117 suggested the #10117# syntax for this feature. Nice! Note that the syntax I suggested in comment:1 could have an abbreviated form like #10117+, so quite close.

Note also that the [[TicketQuery(10117)]] alternative suggested by Remy in that other ticket has the disadvantage to introduce a <div>, whereas the #10117+ form could just produce an <a> like #10117 does.

comment:16 by Thijs Triemstra, 13 years ago

Cc: Thijs Triemstra added

comment:17 by anonymous, 11 years ago

so the result is ?

I just want not write the title of #23 ,but want display the title of #23 by link.

in reply to:  17 ; comment:18 by anonymous, 11 years ago

In the end I use the TicketQuery macro:

[[TicketQuery(id=10117)]]

which shows

#10117
Reference to ticket should also (optionally) display ticket summary

Hope this helps.

Replying to anonymous:

so the result is ?

I just want not write the title of #23 ,but want display the title of #23 by link.

in reply to:  18 comment:19 by anonymous, 10 years ago

Replying to anonymous: yeah,thanks!

comment:20 by Ryan J Ollos, 10 years ago

Cc: Ryan J Ollos added; ryano@… removed

comment:21 by anonymous, 10 years ago

Sadly TicketQuery cannot be used inline…

comment:22 by Ryan J Ollos, 9 years ago

Owner: Christian Boos removed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.