Skip to content

Commit

Permalink
Fix #6721: Top menu entries for spaces are not highlighted when click…
Browse files Browse the repository at this point in the history
…ed (#6727)

Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
  • Loading branch information
marc-farre and luke- committed Dec 13, 2023
1 parent a3dafde commit d5f6e7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ HumHub Changelog
- Enh #6667: Allow view file when owner object provides this
- Enh #6671: Remove interface `ReadableInterface`
- Enh #5751: Allow user blocking from profile page
- Fix #6721: Top menu entries for spaces are not highlighted when clicked
- Fix #6725: Allow theme without second topbar menu
14 changes: 6 additions & 8 deletions static/js/humhub/humhub.ui.navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,27 @@ humhub.module('ui.navigation', function (module, require, $) {
});
// Reset active config.
module.config['active'] = undefined;
}).on('humhub:space:changed', function () {
$('#top-menu-nav').find('li').removeClass('active');
});
};

var setActive = function (id, item) {
if(!id) {
if (!id) {
return;
}

if(!item) {
if (!item) {
module.setActiveItem(null);
return;
}

var $menu = $('#' + id);
var $item = null;

if(item.id) {
$item = $menu.find('[data-menu-id="'+item.id+'"]');
if (item.id) {
$item = $menu.find('[data-menu-id="' + item.id + '"]');
}

if((!$item || !$item.length) && item.url) {
if ((!$item || !$item.length) && item.url) {
$item = $menu.find('[href="' + item.url + '"]');
}

Expand All @@ -57,7 +55,7 @@ humhub.module('ui.navigation', function (module, require, $) {
return;
}

$item.each(function() {
$item.each(function () {
var $this = $(this);
$this.closest('ul').find('li').removeClass('active');
$this.closest('ul').find('a').removeClass('active');
Expand Down

0 comments on commit d5f6e7f

Please sign in to comment.