-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAdminTabEvent.cs
31 lines (28 loc) · 1.46 KB
/
AdminTabEvent.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using Grand.Framework.Events;
using Grand.Services.Events;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Routing;
namespace Grand.Plugin.Misc.TestAdminTab
{
public class AdminTabEvent : IConsumer<AdminTabStripCreated>
{
public void HandleEvent(AdminTabStripCreated eventMessage)
{
if (eventMessage.TabStripName == "category-edit")
{
var actionName = "Configure";
var controllerName = "TestAdminTab";
var urlHelper = new UrlHelper(eventMessage.Helper.ViewContext).Action(new UrlActionContext { Action = actionName, Controller = controllerName });
eventMessage.BlocksToRender.Add(new HtmlString("<script>" +
"$(document).ready(function() {" +
"$('#category-edit').data('kendoTabStrip').append(" +
"[{" +
"text: 'Test Admin Tab'," +
"contentUrl: '" + urlHelper + "'" +
"}]);" +
"});" +
"</script>"));
}
}
}
}