Edgewall Software
Modify

Ticket #5227 (new enhancement)

Opened 5 years ago

Last modified 10 months ago

provide option to insert summary in a ticket link

Reported by: ecarter Owned by: cboos
Priority: low Milestone: next-major-0.1X
Component: wiki system Version: devel
Severity: minor Keywords:
Cc: ryano@…, thijstriemstra
Release Notes:
API 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

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

Download all attachments as: .zip

Change History

comment:1 Changed 5 years ago by cboos

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 Changed 4 years ago by sid

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

comment:3 Changed 4 years ago by cmlenz

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

comment:4 Changed 4 years ago by osimons

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 Changed 4 years ago by cboos

  • Component changed from ticket system to wiki
  • Milestone set to 0.12
  • Owner changed from jonas to cboos
  • Priority changed from normal to low
  • Severity changed from normal to minor
  • Version set to devel

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

comment:6 Changed 3 years ago by Nils.drews@…

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:8 Changed 18 months ago by mark.m.mcmahon@…

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 :)

Changed 18 months ago by Mark Mc Mahon <mark.mcmahon@…>

Simple resource macro

comment:9 follow-up: Changed 18 months ago by Mark Mc Mahon <mark.mcmahon@…>

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)

comment:10 in reply to: ↑ 9 Changed 18 months ago by rblank

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 follow-up: Changed 18 months ago by Mark Mc Mahon <mark.mcmahon@…>

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.

comment:12 in reply to: ↑ 11 Changed 18 months ago by rblank

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.

Changed 18 months ago by Mark Mc Mahon <mark.mcmahon@…>

Allow multiple formats separated with | character

comment:13 Changed 18 months ago by Mark Mc Mahon <mark.mcmahon@…>

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 Changed 18 months ago by Ryan J Ollos <ryano@…>

  • Cc ryano@… added

comment:15 Changed 10 months ago by cboos

#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 Changed 10 months ago by thijstriemstra

  • Cc thijstriemstra added
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from cboos. Next status will be 'new'
The owner will be changed from cboos to anonymous. Next status will be 'assigned'
Author


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

 
Note: See TracTickets for help on using tickets.