2017-04-05 49 views
1

我使用从我的软件包中调用的sectionservice创建了自己的应用程序/部分。我现在试图在本节中添加一个html/angular仪表板视图,但是我找到的所有教程都是关于编辑dashboard.config并在此处添加指向视图的指针。通过我的软件包更新dashboard.config

由于我的目标是创建一个独立的软件包,我不想直接编辑此文件,但实用的添加了一个仪表板到我的部分。

这可能吗?任何人都可以将我链接到教程或提示我应该使用哪些服务。


我不知道如何适用,这是,但我已要求粘贴我的代码创建的原始部分。

using Umbraco.Core; 
using Umbraco.Core.Models; 

namespace Labs.App_Plugins.StueyLabs 
{ 
    public class StueyLabsSection : ApplicationEventHandler 
    { 

     protected const string stueyLabsSectionAlias = "stueyLabs"; 

     protected override void ApplicationStarted(UmbracoApplicationBase umbraco, ApplicationContext context) 
     { 

      // Gets a reference to the section (if already added) 
      Section section = context.Services.SectionService.GetByAlias(stueyLabsSectionAlias); 
      if (section != null) return; 

      // Add a new "Stuey" section 
      context.Services.SectionService.MakeNew("Stuey Labs", stueyLabsSectionAlias, "icon-stuey"); 

      // Grant all existing users access to the new section 
      context.Services.UserService.AddSectionToAllUsers(stueyLabsSectionAlias); 
     } 

    } 
} 
+0

你能添加一些代码吗? – Akashii

+1

你想要什么样的代码?我的部分?对我而言,这似乎与仪表板视图无关,但我仍然会这样做。 – StueyKent

回答

0

这可能会帮助其他人尝试做类似于我的事情。在写作时,Umbraco没有代码优先选项来添加开箱即用的仪表板。

两种解决方案已经提出:

  1. 包操作

    当别人安装打包这些将运行,XML注入到dashboard.config,以定制的意见。

    https://our.umbraco.org/documentation/extending/dashboards/

  2. Skybrud.Umbraco.Dashboard

    这似乎是可以通过的NuGet安装一个插件,它允许你通过所有的C#操纵仪表盘在一把umbraco 7。

    https://github.com/abjerner/Skybrud.Umbraco.Dashboard

我选择了路线之一,一旦我很高兴我的结果会更新这个答案与任何有用的资源。