Skip to content

Commit

Permalink
Dev tools: Added an example of how a plugin can integrate a page into…
Browse files Browse the repository at this point in the history
… the backend
  • Loading branch information
mgesing committed Sep 17, 2015
1 parent 84441ba commit 7ed2041
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Plugins/SmartStore.DevTools/AdminMenu.cs
@@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Routing;
using System.Web.Mvc;
using SmartStore.Collections;
using SmartStore.Web.Framework.UI;
using SmartStore.Collections;

namespace SmartStore.DevTools
{
Expand All @@ -20,6 +14,15 @@ protected override void BuildMenuCore(TreeNode<MenuItem> pluginsNode)
.ToItem();

pluginsNode.Prepend(menuItem);

// uncomment to add to admin menu (see plugin sub-menu)
//var backendExtensionItem = new MenuItem().ToBuilder()
// .Text("Backend extension")
// .Icon("area-chart")
// .Action("BackendExtension", "DevTools", new { area = "SmartStore.DevTools" })
// .ToItem();

//pluginsNode.Append(backendExtensionItem);
}
}
}
11 changes: 11 additions & 0 deletions src/Plugins/SmartStore.DevTools/Controllers/DevToolsController.cs
Expand Up @@ -4,6 +4,7 @@
using System.Web;
using System.Web.Mvc;
using SmartStore.Core;
using SmartStore.DevTools.Models;
using SmartStore.Services;
using SmartStore.Services.Configuration;
using SmartStore.Services.Stores;
Expand Down Expand Up @@ -86,5 +87,15 @@ public ActionResult WidgetZone(string widgetZone)
return new EmptyResult();
}

[AdminAuthorize]
public ActionResult BackendExtension()
{
var model = new BackendExtensionModel
{
Welcome = "Hello world!"
};

return View(model);
}
}
}
@@ -0,0 +1,9 @@
using SmartStore.Web.Framework.Mvc;

namespace SmartStore.DevTools.Models
{
public class BackendExtensionModel : ModelBase
{
public string Welcome { get; set; }
}
}
4 changes: 4 additions & 0 deletions src/Plugins/SmartStore.DevTools/SmartStore.DevTools.csproj
Expand Up @@ -155,6 +155,7 @@
<Compile Include="Filters\Samples\SampleResultFilter.cs" />
<Compile Include="Filters\Samples\SampleActionFilter.cs" />
<Compile Include="DevToolsPlugin.cs" />
<Compile Include="Models\BackendExtensionModel.cs" />
<Compile Include="ProfilerHttpModule.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RouteProvider.cs" />
Expand Down Expand Up @@ -208,6 +209,9 @@
<Content Include="Views\DevTools\WidgetZone.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Views\DevTools\BackendExtension.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<PropertyGroup>
Expand Down
@@ -0,0 +1,18 @@
@using SmartStore.DevTools.Models;
@model BackendExtensionModel
@{
Layout = "~/Administration/Views/Shared/_AdminLayout.cshtml";

ViewBag.Title = "My SmartStore.NET backend extension page";
}

<div class="section-header">
<div class="title">
<i class="fa fa-area-chart"></i>
My SmartStore.NET backend extension page
</div>
</div>

<div>
@Model.Welcome
</div>

1 comment on commit 7ed2041

@mgesing
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See forum

Please sign in to comment.