mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-20 09:08:42 +02:00
N°2847 - Navigation menu: Change default expanded/collapsed behavior
- Keep previous value (iTop 2.7 and older) if present - Otherwise, collapsed by default - Also renamed the user pref. to match new conventions
This commit is contained in:
@@ -115,8 +115,8 @@ $(function()
|
||||
this.element.toggleClass(this.css_classes.menu_expanded);
|
||||
|
||||
// Save state in user preferences
|
||||
const sPrefValue = this.element.hasClass(this.css_classes.menu_expanded) ? 'opened' : 'closed';
|
||||
SetUserPreference('menu_pane', sPrefValue, true);
|
||||
const sPrefValue = this.element.hasClass(this.css_classes.menu_expanded) ? 'expanded' : 'collapsed';
|
||||
SetUserPreference('navigation_menu.expanded', sPrefValue, true);
|
||||
},
|
||||
_onMenuGroupClick: function(oEvent, oMenuGroupElem)
|
||||
{
|
||||
@@ -192,7 +192,7 @@ $(function()
|
||||
this.element.find(this.js_selectors.menu_filter_hint).hide();
|
||||
|
||||
// Save state in user preferences
|
||||
SetUserPreference('navigation_menu_filter_hint', false, true);
|
||||
SetUserPreference('navigation_menu.show_filter_hint', false, true);
|
||||
},
|
||||
|
||||
_onUserMenuTogglerClick: function(oEvent)
|
||||
|
||||
@@ -824,7 +824,7 @@ try
|
||||
break;
|
||||
|
||||
case 'set_pref':
|
||||
$sCode = utils::ReadPostedParam('code', '');
|
||||
$sCode = utils::ReadPostedParam('code', '', 'raw_data');
|
||||
$sValue = utils::ReadPostedParam('value', '', 'raw_data');
|
||||
appUserPreferences::SetPref($sCode, $sValue);
|
||||
break;
|
||||
|
||||
@@ -376,13 +376,20 @@ JS;
|
||||
// Check if menu should be opened only if we re not in demo mode
|
||||
if (false === MetaModel::GetConfig()->Get('demo_mode'))
|
||||
{
|
||||
// Force state if necessary...
|
||||
if (utils::ReadParam('force_menu_pane', null) === 0)
|
||||
{
|
||||
$bIsExpanded = false;
|
||||
}
|
||||
elseif (appUserPreferences::GetPref('menu_pane', 'closed') === 'opened')
|
||||
// ... otherwise look for the new user pref ...
|
||||
elseif (appUserPreferences::GetPref('navigation_menu.expanded', null) !== null)
|
||||
{
|
||||
$bIsExpanded = true;
|
||||
$bIsExpanded = appUserPreferences::GetPref('navigation_menu.expanded', null) === 'expanded';
|
||||
}
|
||||
// ... or fallback on the old one
|
||||
elseif (appUserPreferences::GetPref('menu_pane', null) !== null)
|
||||
{
|
||||
$bIsExpanded = appUserPreferences::GetPref('menu_pane', null) === 'opened';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +409,7 @@ JS;
|
||||
*/
|
||||
protected function ComputeMenuFilterHintState(): void
|
||||
{
|
||||
$this->bShowMenuFilterHint = (true === appUserPreferences::GetPref('navigation_menu_filter_hint', static::DEFAULT_SHOW_MENU_FILTER_HINT));
|
||||
$this->bShowMenuFilterHint = (true === appUserPreferences::GetPref('navigation_menu.show_filter_hint', static::DEFAULT_SHOW_MENU_FILTER_HINT));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user