Copied to clipboard

Flag this post as spam?

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


  • Mihail 39 posts 142 karma points
    Sep 15, 2016 @ 05:34
    Mihail
    0

    Want to create a datatype with predefined values got from Umbraco CMS nodes

    Hi,

    I want to create a data type with a list of checkboxes which values are got from Umbraco CMS nodes value based on a document type alias.

    I started followed the tutorial from http://umbraco.github.io/Belle/#/tutorials/CreatingAPropertyEditor but I'm stuck on angular js and html part.

    Can you advice me how to do that if is possible ? Or which way should I follow for my requirements ?

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Sep 15, 2016 @ 07:12
    Michaël Vanbrabandt
    0

    Hi Mihail,

    can you give some more details? Or maybe a short example of what you are trying to achieve?

    In that way we will have a better view and can we help you better to your goal.

    /Michaël

  • Mihail 39 posts 142 karma points
    Sep 15, 2016 @ 07:22
    Mihail
    0

    I have the following content structure:

    • Content
    • EN-US
    • FR-FR
    • etc etc

    And I added a data type in a children node of EN-US ... I created a plugin which get all localizations except current one, means: FR-FR, DE-DE, etc.

    So, my logic is to get current node and get highest parent level which should be EN-US.

    Then create an array with all contents (first-level content only) except EN-US and then add that array to $scope which will be done in HTML page where I make a list of checkboxes.

    I tried something like this:

    angular.module("umbraco")
      .controller("LocalizationCheckboxEditorController",
         function ($scope, appState, treeService) {
            var pattern = /\/edit\/(\d+)/gi;
            var regex = pattern.exec(location.href);
    
            var nodeId = parseInt(regex[1]); // get node id from url
    
           // below variable give me `Content`
           var currentNode = appState.getTreeState("currentRootNode"); 
    
           // below returns always null
           var selectedNode = appState.getTreeState("selectedNode");
    
            // returns error  `No childNodesUrl property found on the tree node, cannot load child nodes`
           var children = treeService.getChildren({ node: appState.getTreeState("currentRootNode") });
         }
      );
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies