Commit 7bcafab6 authored by Kevin Ditscheid's avatar Kevin Ditscheid

[BUGFIX± Fix pagetree selection in backend module

parent 53880d3e
......@@ -23,14 +23,20 @@
***************************************************************/
define([
'jquery'
], function($) {
'jquery',
'TYPO3/CMS/Backend/ModuleMenu',
'TYPO3/CMS/Backend/Viewport'
], function($, ModuleMenu, Viewport) {
'use strict';
var SgRoutes = {
init: function() {
$('.btn-delete-all').on('click', SgRoutes.deleteAllListener);
$.get(TYPO3.settings.ajaxUrls['sg_routes::ajaxPing']);
$('.sg-routes_pageswitch').on('click', function(event) {
event.preventDefault();
SgRoutes.goTo('web_SgRoutesRoute', event.target.dataset.page);
});
},
/**
* Deletes all routes
......@@ -58,6 +64,16 @@ define([
window.location.href = editLink.data('url') + '&returnUrl=' + T3_THIS_LOCATION;
}
}
},
goTo: function(module, id) {
var pageTreeNodes = Viewport.NavigationContainer.PageTree.instance.nodes;
for (var nodeIndex in pageTreeNodes) {
if (pageTreeNodes.hasOwnProperty(nodeIndex) && pageTreeNodes[nodeIndex].identifier === parseInt(id)) {
Viewport.NavigationContainer.PageTree.selectNode(pageTreeNodes[nodeIndex]);
break;
}
}
ModuleMenu.App.showModule(module, 'id=' + id);
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment