Copied to clipboard

Flag this post as spam?

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


  • Harshit 64 posts 226 karma points
    Oct 09, 2015 @ 09:02
    Harshit
    0

    custom tree routing

    I am implementing custom section and tree in umbraco I have AppPlugins folder structure AppPlugins/[Sectionname]/backoffice/CustomTreeName/(create/edit html file)

    i have a logic to open a new.html file in create.html(this is the right click menu option) file like :

    <a href="new.html"> 
    

    however its not getting redirecting to it.The new.html file is in the same directry ,under CustomTreeName.

    Can you please help where i can place the new.html file so that it can be redirected by create.html file and also the controller file of it?

    Thanks Harshit

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Oct 09, 2015 @ 11:28
    David Brendel
    0

    Hi Harshit,

    have you exactly this a-tag in your view? Because if yes you have to add the complete path in the href Attribute like: #/section/treeName/action?params=

    Hope that helps.

    Regards David

  • Harshit 64 posts 226 karma points
    Oct 09, 2015 @ 12:47
    Harshit
    0

    Hi David, Thanks for the reply.

    yes I am using a- tag

    <a href="#/Templates/TemplateTree/new?dasboard=true" ng-click="nav.hideNavigation()">
    

    and now i am getting this error enter image description here

    what will be the params in the routing? can you please help?

    Regards, Harshit

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Oct 09, 2015 @ 14:32
    David Brendel
    100

    Hi Harshit,

    i looked again at some source i have and the query parameters are Lister with a / between them.

    So i think it should be ".../edit/true" in your example. Can you try that.

    If that doesn't work then can you provide the tree- Attribute and section alias you used. Maybe its just a spelling issue.

    Regards David

  • Harshit 64 posts 226 karma points
    Oct 09, 2015 @ 19:54
    Harshit
    0

    thanks a lot. it worked

    this is the path i have given in the hyperlink

    <a href="#/Templates/TemplateTree/new/true" ng-click="nav.hideNavigation()">
    

    i have small doubt, i have a controller file for this new.html where i can place it ,i mean in the same directory or in different place?

    Regards, Harshit

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Oct 09, 2015 @ 19:57
    David Brendel
    0

    You can place it wäre you want. So maybe for better structuring keep them seperated.

    Only thing you need is to add the file in your package.manifest file

  • Harshit 64 posts 226 karma points
    Oct 12, 2015 @ 05:43
    Harshit
    0

    Thanks a lot David :)

  • Harshit 64 posts 226 karma points
    Oct 13, 2015 @ 08:51
    Harshit
    0

    Hi David,

    Can you please help? There is an issue with the package.manifest file I have a custom section and tree structure App_Pluggins/[SectionName]/backoffice/[Treename] If i am placing the package.manifest file at [TreeName] level umbraco is getting started but the js file linked in manifest file its not loading up.However if i am placing package.manifest file[SectionName],umbraco showing blank page with the below error message. enter image description here

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Oct 13, 2015 @ 08:55
    David Brendel
    0

    Hi Harshit,

    the file must be placed in the [sectionName] folder. Seems like there is an error in the manifest file. Can you post it so i can check?

    Regards David

  • Harshit 64 posts 226 karma points
    Oct 13, 2015 @ 12:10
    Harshit
    0

    Hi David,

    I have defined a view where it calling a controller path : App_pluggins/[SectionName]/backoffice/[TreeName]/createView

    <div class="umb-panel" ng-controller="CreateCtrl">
    

    and this controller is in CreateCtrl.js file

    angular.module("umbraco").controller("CreateCtrl"),
    function($scope, $http, $location, $rootScope) { --code-- };
    

    this js file path is in the manifest file.

    { javascript: ["~/App_Plugins/Templates/Create.js" ]}
    

    now the above error message are not coming ,umbraco is loading up however is not calling the js file linked in manifest.

    Can you please help on this?

    Regards, Harshit

  • Harshit 64 posts 226 karma points
    Oct 13, 2015 @ 18:26
    Harshit
    0

    Hi David ,

    Thanks, i have found the solution :)

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Oct 13, 2015 @ 19:48
    David Brendel
    0

    Hi Harshit,

    sorry for the late response. Glad you found it.

    Regards David

  • Harshit 64 posts 226 karma points
    Oct 14, 2015 @ 17:58
    Harshit
    0

    Hi David,

    Can you do me favor pls ,I am stuck in getting tree node Id. How we can get the current tree node Id in angular js and pass it to the controller? any idea?

    Regards, Harshit

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Oct 15, 2015 @ 14:31
    David Brendel
    0

    Hi Harshit,

    where do you need the ID. In the angular view or when you build your tree?

    Normally you would provide the ID of the current node as a Route param.

    Regards David

  • Harshit 64 posts 226 karma points
    Oct 15, 2015 @ 15:57
    Harshit
    0

    Hi David,

    I want it in the API through controller,so that i can add content to the parent id . i have uploaded the cod in the below link. https://gist.github.com/SinghHars/b5bbca636d85eb610a7d

    currently i am passing hard coded value as parent: 1046.

    $http({ method: 'POST', url: '/umbraco/api/StatusApi/PostStatus/', params: { parent: 1046 }, data: $scope.status })

    if i am doing so, i am getting “Failed to load resource: the server responded with a status of 500 (Internal Server Error)”:

    http://umbracoCustomSectionTest.com/umbraco/api/StatusApi/PostStatus/?parentId=1046

    this is the error message if i am clicking on the link:

    The requested resource does not support http method ‘GET’.

    ===================================================

    please help.

    Thanks, Harshit

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Oct 15, 2015 @ 18:07
    David Brendel
    0

    Hi Harshit,

    the error message is because your method in your api controller doesn't allow HttpPost. To enable this you have to add the [HttpPost] attribute to the method. Beware that there are two attributes with the same name, one for MVC and one for Http. You need the last one.

    For the id of the tree node i'm currently somewhat out of ideas. In my use cases until now i just saved the items to the database because i know on which node i want to show them and there aren't multiple locations.

    My first idea was to look at the TreeService but it seems that he hasn't a method to get the current active node. The only thing that remains is to provide the id through all url calls. So add it to the menu item url and then to the edit url as second parameter.

    Regards David

  • Harshit 64 posts 226 karma points
    Oct 15, 2015 @ 19:48
    Harshit
    0

    Thanks David,

    still the same error 500 :( Can you share how to save content in database and then linked to the specific node if possible?

    Harshit

Please Sign in or register to post replies

Write your reply to:

Draft