Copied to clipboard

Flag this post as spam?

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


  • Kasper 21 posts 112 karma points
    Mar 11, 2019 @ 14:03
    Kasper
    0

    Custom section Umbraco v8

    How do add html view to this. enter image description here

  • Kevin Jump 2342 posts 14889 karma points MVP 8x c-trib
    Mar 11, 2019 @ 15:13
    Kevin Jump
    101

    Hi Kasper,

    you can add a Dashboard to your custom section, to display the html.

    in a package.manifest file (in a app_Plugins folder) this looks like :

    {
      "javascript": [
        "~/App_Plugins/MySimpleApp/SimpleApp.Controller.js"
      ],
      "dashboards": [
        {
          "alias": "myDashboard",
          "sections": [ "mySection" ],
          "view": "~/App_Plugins/MySimpleApp/dashboard.html"
        }
      ]
    }
    

    you can also add a dashboard in code for example:

    using Umbraco.Core;
    using Umbraco.Core.Dashboards;
    
    namespace MySampleApp
    {
        public class MyDashboard : IDashboard
        {
            public string[] Sections => new string[] { "mySection" };
    
            public IAccessRule[] AccessRules
            {
                get
                {
                    var rules = new IAccessRule[]
                    {
                        new AccessRule {Type = AccessRuleType.Grant, Value = Constants.Security.AdminGroupAlias}
                    };
                    return rules;
                }
            }
    
    
            public string Alias => "MyDashoard";
    
            public string View => "~/App_Plugins/MySampleCode/MyDashboard.html";
        }
    
    }
    

    Just checked and the Dashboard Documentation for v8 is complete - so you can see more details here https://our.umbraco.com/documentation/Extending/Dashboards/

  • Kasper 21 posts 112 karma points
    Mar 11, 2019 @ 16:21
    Kasper
    0

    Nice! Thank you Kevin Jump

  • mcgrph 35 posts 162 karma points
    Apr 28, 2019 @ 19:49
    mcgrph
    0

    For me the string for the view had to be like this:

    public string View => "/App_Plugins/MySampleCode/MyDashboard.html"
    

    Otherwise I'd get an 404...

Please Sign in or register to post replies

Write your reply to:

Draft