Opened 10 years ago

Closed 3 years ago

Last modified 3 years ago

#940 closed enhancement (fixed)

Allow URLs relative to project root

Reported by: anonymous Owned by: rjollos
Priority: normal Component: NavAddPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10


When hosting several projects on the same server, there is no way currently to add a button through the global trac.ini that will point to a URL relative to each project.

E.g. for one project it would end up pointing to, but on the next to

Attachments (1)

path-relative.patch (455 bytes) - added by manski 8 years ago.
Patch against r1023 and Trac 0.11.4

Download all attachments as: .zip

Change History (9)

comment:1 Changed 8 years ago by jevans

Yes, this would be useful.

For instance I'd like to add a direct link to the query module to the bar. But if I enter '/query', it says "Environment not found."

comment:2 Changed 8 years ago by manski

This was fairly simple. I've added a patch that makes all URLs relative to the project's root URL.

Changed 8 years ago by manski

Patch against r1023 and Trac 0.11.4

comment:3 Changed 5 years ago by rlrj60

The attachment:path-relative.patch does not work if url is an absolute URL.

For example, if url = "http://www.example...", it would turn into something like url = "".

I think it should check for '/' that indicate the root path of the project. Here's my simple fix:

if url[0] == '/':
    url = self.env.href() + url

comment:4 Changed 3 years ago by rjollos

  • Owner changed from otaku42 to rjollos
  • Status changed from new to assigned

comment:5 Changed 3 years ago by rjollos

In 13383:

Refs #940: Make href project-relative.

comment:6 Changed 3 years ago by rjollos

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:7 Changed 3 years ago by rjollos

In 13385:

Refs #940: Refactor code to use a ListOption and add doc. Bumped version to 0.2.

comment:8 Changed 3 years ago by rjollos

Additional changes relating to this feature were made in #11443.

Add Comment

Modify Ticket

as closed The owner will remain rjollos.
The resolution will be deleted. Next status will be 'reopened'.

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

Note: See TracTickets for help on using tickets.