public void HandleEvent(AdminTabStripCreated eventMessage)
{
if (eventMessage.TabStripName == "order-edit")
{
OrderModel om = eventMessage.Helper.ViewData.Model as OrderModel;
string currentTabName = _localizationService.GetResource("Actopus.Nop.Plugin.Shipping.MyParcel.Menu.TabStripItem");
string url = "../../../Plugins/MyParcel/Labels/" + om.Id;
eventMessage.BlocksToRender.Add(new MvcHtmlString(
"<script>"
+ "$(document).ready(function() {"
+ "$(\"<li><a data-tab-name='tab-name' data-toggle='tab' href='#tab-name'>"
+ _localizationService.GetResource("Actopus.Nop.Plugin.Shipping.MyParcel.Menu.TabStripItem")
+ "</a></li> \").appendTo('#order-edit .nav-tabs:first');"
+ "$.get('" + url + "', function(result) {"
+ "$(\" <div class='tab-pane' id='tab-name'>\" + result + \"</div>\").appendTo('#order-edit .tab-content:first');"
+ "});"
+ "});"
+ "</script>"));
}
}
I noticed that this mechanism still adds a tab to the tab control. However I have a feeling that this is no longer the preferred solution especially as the tab view now gets its contents async.
Any input would be highly appreciated
thx
Stefan