Copied to clipboard

Flag this post as spam?

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


  • Dennis 33 posts 238 karma points
    Sep 20, 2017 @ 06:05
    Dennis
    0

    "Front page" in custom section

    Hi.

    I am trying to setup a custom section in Umbraco 7. I have done this before in Umbraco 6, but it seems something is not right?

    I have created my application and three controller. What I try to accumplish is a simple "front page", for my custom section.

    First thing first. This i my Application:

    [Application("Statistic", "Statistics", "icon-lab", 15)]
    public class CustomSectionApplication : IApplication { }
    

    Then I have created the following simple three controller:

    [PluginController("Statistics")]
    [Tree("Statistic", "StatisticsTree", "Statistics", iconClosed: "icon-doc")]
    public class StatisticsSectionTreeController : TreeController
    {
        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            var controller = new StatisticAuthApiController();
    
            var nodes = new TreeNodeCollection();
            var bannerStats = controller.GetAll();
            //var bannerNodes = bannerStats.Select(a => CreateTreeNode(a.Id.ToString(), null, queryStrings, a.Name, "icon-user", false));
    
            //nodes.AddRange(bannerNodes);
    
            return nodes;
        }
    
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            //return null;
    
            var menu = new MenuItemCollection();
            menu.Items.Add<ActionNew>("Opret");
            menu.Items.Add<ActionRefresh>("Opdater");
    
            return menu;
        }
    
        protected override TreeNode CreateRootNode(FormDataCollection queryStrings)
        {
            // routepath HAS to be /appsection/treealias/htmlview/ID 
            var route = "/Statistic/StatisticsTree/index/0";
            return CreateTreeNode("0", "Statistic", queryStrings, "Statistik", "icon-server", false, route);
        }
    }
    

    I have a index.html position under:

      "App_Plugins\Statistic\backoffice\StatisticsTree\index.html"
    

    I have also tried to test the location with making a create view, which are loaded correct by Umbraco.

    For further information I have the following entry in applications.config:

    <add alias="Statistic" name="Statistics" icon="icon-lab" sortOrder="15" />
    

    And in threes.config:

    <add initialize="true" sortOrder="0" alias="StatisticsTree" application="Statistic" title="Statistics" iconClosed="icon-doc" iconOpen="icon-folder-open" type="UmbracoKenneth.Kenneth.StatisticsSectionTreeController, UmbracoKenneth" />
    

    Can anyone help me where the problem is?

  • Cimplex 113 posts 576 karma points
    Sep 20, 2017 @ 06:20
    Cimplex
    100

    Hi Dennis, I think what you want is to create a dashboard, see the link below.

    https://our.umbraco.org/documentation/Tutorials/Creating-a-Custom-Dashboard/

    // Herman

  • Dennis 33 posts 238 karma points
    Sep 21, 2017 @ 07:06
    Dennis
    0

    Hi Cimplex.

    This is almost what I wont. But how do I add a dashboard as a front page, for my custom section?

    Thanks!

  • Cimplex 113 posts 576 karma points
    Sep 21, 2017 @ 07:12
    Cimplex
    0

    Hi Dennis, Follow the tutorial and create a view in you app_plugins folder for your custom section, and in the dashboard.config file edit it to something like this:

    <section alias="Custom Welcome Dashboard">
        <access>
            <deny>translator</deny>
        </access>
        <areas>
            <area>Statistic</area>
        </areas>
        <tab caption="Welcome">
            <control>
                /app_plugins/CustomWelcomeDashboard/WelcomeDashboard.html
            </control>
        </tab>
    </section>
    

    But replace the file path to your own.

    If im not totaly wrong you should have Statistic in the area tag but you can also try "StatisticsTree"

    It can help to touch the web.config to force umbraco to reload cache.

    // Herman

  • Dennis 33 posts 238 karma points
    Sep 21, 2017 @ 08:02
    Dennis
    1

    YES!

    I just read it more detailed! Sorry the morning coffee helped clear it!

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft