Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rodske 74 posts 104 karma points
    Nov 28, 2017 @ 22:30
    Rodske
    0

    Deep link into the Umbraco back-office content editing tab

    Obviously I can link users to the appropriate back office content editing page (via link like below), but we have a lot of tabs, with a lot of properties and would like to deep link directly to the tab the content is on. How can I anchor link or activate the appropriate tab with a single url?

    /umbraco/#/content/content/edit/1146
    
  • Nathan Woulfe 447 posts 1664 karma points MVP 5x hq c-trib
    Nov 29, 2017 @ 03:58
    Nathan Woulfe
    100

    Out of the box, nope. Changing tabs doesn't push anything into the history stack, so there's no relationship between the current tab and the URL.

    You could write some javascript to run in the backoffice to parse out the anchor value, and use that to find the correct tab link element and trigger a click.

    If your URL was /umbraco/#/content/content/edit/1146#metadata you'd need to do some gymnastics since window.location.hash will return #/content/content/edit/1146#metadata.

    Quick and dirty...

    var hashSegments = window.location.hash.split('#');
    if (hashSegments.length > 1) {
      var hash = hashSegments[hashSegments.length - 1].toLowerCase();
      var tabs = document.querySelectorAll('.umb-nav-tabs li');
      tabs.forEach(function(v) {
        if (v.innerText.toLowerCase() === hash) { 
          v.querySelector('a').click();
        }
      });
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft