N°3632 Move tab's layout preference to preferences page

This commit is contained in:
Stephen Abello
2021-01-22 10:29:17 +01:00
parent b3f1b0e610
commit 46b4990252
5 changed files with 21 additions and 20 deletions

View File

@@ -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;

View File

@@ -5,5 +5,4 @@
*/
Dict::Add('EN US', 'English', 'English', [
'UI:Menu:SwitchTabMode' => 'Switch tab mode',
]);

View File

@@ -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',

View File

@@ -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.

View File

@@ -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');