2017-04-05 119 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

我選擇了路線之一,一旦我很高興我的結果會更新這個答案與任何有用的資源。