mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°3632 Move tab's layout preference to preferences page
This commit is contained in:
@@ -1277,7 +1277,6 @@ class utils
|
||||
new JSPopupMenuItem('UI:Menu:ExportXLSX', Dict::S('ExcelExporter:ExportMenu'), "ExportListDlg('$sOQL', '', 'xlsx', ".json_encode(Dict::S('ExcelExporter:ExportMenu')).")"),
|
||||
new SeparatorPopupMenuItem(),
|
||||
new URLPopupMenuItem('UI:Menu:PrintableVersion', Dict::S('UI:Menu:PrintableVersion'), $sUrl.'&printable=1', '_blank'),
|
||||
new JSPopupMenuItem('UI:Menu:SwitchTabMode', Dict::S('UI:Menu:SwitchTabMode'), "SwitchTabMode()"),
|
||||
);
|
||||
break;
|
||||
|
||||
|
||||
@@ -5,5 +5,4 @@
|
||||
*/
|
||||
|
||||
Dict::Add('EN US', 'English', 'English', [
|
||||
'UI:Menu:SwitchTabMode' => 'Switch tab mode',
|
||||
]);
|
||||
|
||||
@@ -27,6 +27,9 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
'UI:RichText:ToolbarState:Expanded' => 'Expanded',
|
||||
'UI:RichText:ToolbarState:Collapsed' => 'Collapsed',
|
||||
'UI:Tabs:Preferences' => 'Tabs',
|
||||
'UI:Tabs:Layout:Label' => 'Tabs layout',
|
||||
'UI:Tabs:Layout:Horizontal' => 'Horizontal',
|
||||
'UI:Tabs:Layout:Vertical' => 'Vertical',
|
||||
'UI:Tabs:Scrollable:Label' => 'Tabs navigation',
|
||||
'UI:Tabs:Scrollable:Classic' => 'Classic',
|
||||
'UI:Tabs:Scrollable:Scrollable' => 'Scrollable',
|
||||
|
||||
@@ -41,22 +41,6 @@ function StripArchiveArgument(sUrl)
|
||||
var res = sUrl.replace(/&with-archive=[01]/g, '');
|
||||
return res;
|
||||
}
|
||||
//TODO 3.0.0 Is this the right place to put this method ?
|
||||
function SwitchTabMode()
|
||||
{
|
||||
let aTabContainer = $('[data-role="ibo-tab-container"]');
|
||||
if (!aTabContainer.hasClass('ibo-is-vertical'))
|
||||
{
|
||||
aTabContainer.removeClass('ibo-is-horizontal');
|
||||
aTabContainer.addClass('ibo-is-vertical');
|
||||
SetUserPreference('tab_layout', 'vertical', true);
|
||||
} else
|
||||
{
|
||||
aTabContainer.removeClass('ibo-is-vertical');
|
||||
aTabContainer.addClass('ibo-is-horizontal');
|
||||
SetUserPreference('tab_layout', 'horizontal', true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A toolbox for common JS operations in the backoffice. Meant to be used by Combodo developers and the community.
|
||||
|
||||
@@ -331,7 +331,15 @@ JS
|
||||
|
||||
$oTabsForm = new Form();
|
||||
$oTabsForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('operation', 'apply_tab_config'));
|
||||
|
||||
|
||||
// Tab Layout
|
||||
$sTabsLayoutValue = appUserPreferences::GetPref('tab_layout', false);;
|
||||
$oTabsLayout = InputUIBlockFactory::MakeForSelectWithLabel('tab_layout', Dict::S('UI:Tabs:Layout:Label'));
|
||||
$oTabsLayout->GetInput()->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption('horizontal', Dict::S('UI:Tabs:Layout:Horizontal'), 'horizontal' === $sTabsLayoutValue));
|
||||
$oTabsLayout->GetInput()->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption('vertical', Dict::S('UI:Tabs:Layout:Vertical'), 'vertical' === $sTabsLayoutValue));
|
||||
$oTabsForm->AddSubBlock($oTabsLayout);
|
||||
|
||||
// Tab navigation
|
||||
$sTabsScrollableValue = appUserPreferences::GetPref('tab_scrollable', false);;
|
||||
$oTabsScrollable = InputUIBlockFactory::MakeForSelectWithLabel('tab_scrollable', Dict::S('UI:Tabs:Scrollable:Label'));
|
||||
$oTabsScrollable->GetInput()->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption('true', Dict::S('UI:Tabs:Scrollable:Scrollable'), true === $sTabsScrollableValue));
|
||||
@@ -501,8 +509,16 @@ try {
|
||||
DisplayPreferences($oPage);
|
||||
break;
|
||||
case 'apply_tab_config':
|
||||
$bScrollable= utils::ReadParam('tab_scrollable', 'false') === 'true';
|
||||
$sLayout = utils::ReadParam('tab_layout', 'horizontal');
|
||||
$sLayoutAllowedValues = ['horizontal', 'vertical'];
|
||||
if(in_array($sLayout, $sLayoutAllowedValues, true))
|
||||
{
|
||||
appUserPreferences::SetPref('tab_layout', $sLayout);
|
||||
}
|
||||
|
||||
$bScrollable = utils::ReadParam('tab_scrollable', 'false') === 'true';
|
||||
appUserPreferences::SetPref('tab_scrollable', $bScrollable);
|
||||
DisplayPreferences($oPage);
|
||||
break;
|
||||
case 'apply_language':
|
||||
$sLangCode = utils::ReadParam('language', 'EN US');
|
||||
|
||||
Reference in New Issue
Block a user