From c0ec7e02f86652fec2a723ac9b5da3b5efc01a95 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Tue, 11 May 2021 16:34:54 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B03939=20-=20Keep=20focus=20on=20current?= =?UTF-8?q?=20tab=20on=20object=20modification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/application/WebPage/iTopWebPage.php | 15 --------------- .../layouts/object/object-details/layout.js.twig | 12 +++++++++++- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/sources/application/WebPage/iTopWebPage.php b/sources/application/WebPage/iTopWebPage.php index d88be4e6d..5d6caf0c7 100644 --- a/sources/application/WebPage/iTopWebPage.php +++ b/sources/application/WebPage/iTopWebPage.php @@ -367,21 +367,6 @@ JS SetUserPreference(parent_id+'_'+this.id+'_height', $(this).height(), true); // true => persistent } } ); - - // Shortcut menu actions - $('.actions_button a').on('click', function() { - aMatches = /#(.*)$/.exec(window.location.href); - if (aMatches != null) - { - currentHash = aMatches[1]; - if ( /#(.*)$/.test(this.href)) - { - this.href = this.href.replace(/#(.*)$/, '#'+currentHash); - } - } - }); - - // End of Tabs handling PrepareWidgets(); diff --git a/templates/base/layouts/object/object-details/layout.js.twig b/templates/base/layouts/object/object-details/layout.js.twig index 725c88fd1..848d4db85 100644 --- a/templates/base/layouts/object/object-details/layout.js.twig +++ b/templates/base/layouts/object/object-details/layout.js.twig @@ -5,7 +5,6 @@ $('#{{ oUIBlock.GetId() }}').on('edit_object', function(){ $(this).find('button[name="UI:Menu:Modify"]').click(); }); - $('#{{ oUIBlock.GetId() }}').on('delete_object', function(){ $(this).find('button[name="UI:Menu:Delete"]').click(); }); @@ -22,3 +21,14 @@ $('#{{ oUIBlock.GetId() }}').on('save_object', function(){ $(this).find('button[type="submit"][name="submit"][value="submit"]').click(); }); {% endif %} + +// Keep URL's hash parameters when clicking on a link of the header +$('#{{ oUIBlock.GetId() }}').on('click', '[data-role="ibo-panel--header-right"] a', function() { + aMatches = /#(.*)$/.exec(window.location.href); + if (aMatches != null) { + currentHash = aMatches[1]; + if (/#(.*)$/.test(this.href)) { + this.href = this.href.replace(/#(.*)$/, '#'+currentHash); + } + } +}); \ No newline at end of file