added event to load audit trail on Properties tab only

This commit is contained in:
Robert
2017-09-21 13:56:03 +02:00
parent f3a81d82be
commit a36b1097c5
2 changed files with 16 additions and 4 deletions
@@ -32,11 +32,16 @@
// get document type details
scope.documentType = getDocumentType(scope.node);
loadAuditTrail();
// load audit trail on tab change
eventsService.on("tab change", function (event, args) {
if (args.context.innerHTML === "Properties" && args.context.hash === "#tab0") {
console.log(args.context.alias);
loadAuditTrail();
}
});
}
scope.auditTrailPageChange = function(pageNumber) {
scope.auditTrailPageChange = function (pageNumber) {
scope.auditTrailOptions.pageNumber = pageNumber;
loadAuditTrail();
};
@@ -8,7 +8,7 @@ angular.module("umbraco.directives")
.directive('umbTabs', function () {
return {
restrict: 'A',
controller: function ($scope, $element, $attrs) {
controller: function ($scope, $element, $attrs, eventsService) {
var callbacks = [];
this.onTabShown = function(cb) {
@@ -20,13 +20,20 @@ angular.module("umbraco.directives")
var curr = $(event.target); // active tab
var prev = $(event.relatedTarget); // previous tab
//emit tab change event
eventsService.emit("tab change", curr);
$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.
// It would be nicer to create this event handler as a directive for which child