nautobot icon indicating copy to clipboard operation
nautobot copied to clipboard

Add new template tag which hyperlinks an object, but opens in a new tab when clicked.

Open tsm1th opened this issue 1 year ago • 2 comments

As ...

P.D. - Plugin Developer

I want ...

I want a template tag similar to hyperlinked_object which adds the target="_blank" attribute.

https://github.com/nautobot/nautobot/blob/594743bf49ade45899034a4e34c83af956036ca4/nautobot/core/templatetags/helpers.py#L46

So that ...

The hyperlinked object opens in a new tab.

I know this is done when...

I add a hyperlinked object using the new template tag and the object opens in a new tab.

Optional - Feature groups this request pertains to.

  • [ ] Automation
  • [ ] Circuits
  • [ ] DCIM
  • [ ] IPAM
  • [ ] Misc (including Data Sources)
  • [ ] Organization
  • [X] Plugins (and other Extensibility)
  • [ ] Security (Secrets, etc)
  • [ ] Image Management
  • [X] UI/UX
  • [ ] Documentation
  • [ ] Other (not directly a platform feature)

Database Changes

No database change required

External Dependencies

No new dependencies required

tsm1th avatar Apr 11 '24 21:04 tsm1th

Can you give some examples of use cases where you'd want the template to "force" this behavior, rather than giving the user the option to select "Open link in new tab" on their own when that's what they desire?

glennmatthews avatar Apr 12 '24 12:04 glennmatthews

@glennmatthews I am mostly concerned with the first use case, but provided a second one for conversation sake.

Use cases

  • You want to provide links to other objects on a page with unsaved work.

    • Some custom apps could have pages where the user does a bunch of client side work. You provide them a link on that page to something helpful and they click on it before submitting their unsaved work back to the server.
  • You want to provide links to other objects on a page with media.

    • You might want to provide a link to an object but not interrupt any media that the user is consuming on that page.

tsm1th avatar Apr 12 '24 17:04 tsm1th