rename event to follow naming convention, fix missing tab id, change so the tab id matches the new "info"-tab

This commit is contained in:
Mads Rasmussen
2017-09-28 10:12:01 +02:00
parent 7e0d7ebbd4
commit 59defa6b11
2 changed files with 9 additions and 11 deletions

View File

@@ -32,9 +32,9 @@
// get document type details
scope.documentType = scope.node.documentType;
// load audit trail on tab change
eventsService.on("tab change", function (event, args) {
if (args.tabId === "0" || args.tabHash === "#tab0") {
// load audit trail when on the info tab
eventsService.on("app.tabChange", function (event, args) {
if (args.id === -1) {
loadAuditTrail();
}
});

View File

@@ -19,22 +19,20 @@ angular.module("umbraco.directives")
var curr = $(event.target); // active tab
var prev = $(event.relatedTarget); // previous tab
var args = { tabId: curr.context.id, tabHash: curr.context.hash }
// emit tab change event
eventsService.emit("tab change", args);
// emit tab change event
var tabId = Number(curr.context.hash.replace("#tab", ""));
var args = { id: tabId, hash: curr.context.hash };
eventsService.emit("app.tabChange", args);
$scope.$apply();
for (var c in callbacks) {
callbacks[c].apply(this, [{current: curr, previous: prev}]);
}
}
//NOTE: it MUST be done this way - binding to an ancestor element that exists
// in the DOM to bind to the dynamic elements that will be created.