Hi All,
is there native support for adding a tab with external/plugin functionality to the main view of the products or categories?
Regards,
Boris
public class AdminTabStripConsumer : IConsumer<AdminTabStripCreated>
{
public void HandleEvent(AdminTabStripCreated tabEventInfo)
{
if (tabEventInfo != null && !string.IsNullOrEmpty(tabEventInfo.TabStripName))
{
if (tabEventInfo.TabStripName == "product-edit")
{
var urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext);
object objectId = HttpContext.Current.Request.RequestContext.RouteData.Values["id"];
if (!string.IsNullOrEmpty(objectId.ToString()))
{
string text = "Additional tab";
string content = urlHelper.Action("YourController", "YourAction", new { id = objectId });
tabEventInfo.BlocksToRender.Add(
new MvcHtmlString(
"<script>" +
"$(document).ready(function() {" +
"$('#product-edit').data('kendoTabStrip').append(" +
"[{" +
"text: '" + text + "'," +
"contentUrl: '" + content + "'" +
"}]" +
");" +
"});" +
"</script>"
)
);
}
}
}
}
}
public ActionResult Action(int? id)
{
// do code here.
return PartialView("Path/to/your/View.cshtml", id);
}
View.cshtml:
@model int?
@{
var productId = Model;
if (productId == null)
{
<div>Save before edit</div>
return;
}
}
<div>Your code here</div>