Copied to clipboard

Flag this post as spam?

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


  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Nov 02, 2015 @ 05:55
    Nicholas Westby
    0

    Programmatically Load Content Node in Back Office?

    I'm trying to work on a ticket, and the short version is that I'd like to add a button to each selected node in the multinode treepicker that, when clicked, loads that content node.

    So far, I am able to highlight the content node in the content tree with this code:

    navigationService.syncTree({ tree: "content", path: data.path, forceReload: false, activate: true });
    

    That's half the battle. However, what I'd really like is to actually cause the page to navigate to that node as if the user had clicked it.

    Is there some easy way of accomplishing this? That is, is there an elegant way to display the edit page for a content node programmatically?

  • Patrick Scott 70 posts 110 karma points c-trib
    Nov 02, 2015 @ 09:43
    Patrick Scott
    0

    I can't help you with the angular code to achieve this, but I don't think you want to navigate to the selected node as this would loose any changes made to the existing node. The best option would be to load a dialog box with the properties from the selected node.

    I know Le Blender does this for the display grid - https://our.umbraco.org/projects/backoffice-extensions/leblender/ (you can see how it does it in the youtube video) but I'm not sure if there is any other packages doing it with node properties you could copy.

    Are you also going to include the full path to the node as I described in the ticket? Unless you are using the content picker in the data grid or similar, there is loads of space horizontally on the page, so showing the full path is easy an easy win. I've modified my code slightly to just show the icon and breadcrumb path which I think looks neater.

    enter image description here

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Nov 02, 2015 @ 17:33
    Nicholas Westby
    0

    Umbraco already has the ability to load the node in a dialog (if you enable the "preview" edit feature that allows you to edit content nodes picked by a multinode treepicker). That doesn't allow you to see the node in context (though, adding a breadcrumb to that dialog might be an option).

    And yes, I'm thinking of adding a title tag or something to show the full path on hover. Another option would be a button or something that toggles between the current view and the one you are showing with the full breadcrumb. Another option I'm considering is having an info button that shows the info (e.g., in an overlay, a popup, or as a notification).

    Just to get back to the question, does a anybody know how to programmatically open a content node using the Umbraco Angular API?

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Nov 04, 2015 @ 06:37
    Nicholas Westby
    0

    This doesn't feel quite right, but this is all I have so far (in addition to the syncTree call above):

    var routePath = "content/content/edit/" + id.toString();
    $location.path(routePath).search("");
    

    That's part of what is being done in the navigation service: https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js#L253

    If there is a better way, I'd still like to know what it is, but until then I'm going to try this.

Please Sign in or register to post replies

Write your reply to:

Draft