N°3620 - Add confg. parameter to disable "quick create" history

This commit is contained in:
Molkobain
2021-01-13 10:40:31 +01:00
parent 6a33fbc7b3
commit 9221899525
4 changed files with 29 additions and 4 deletions

View File

@@ -1130,7 +1130,7 @@ class Config
],
'quick_create.enabled' => [
'type' => 'bool',
'description' => 'Whether or not the global search is enabled',
'description' => 'Whether or not the quick create is enabled',
'default' => true,
'value' => true,
'source_of_value' => '',
@@ -1138,15 +1138,23 @@ class Config
],
'quick_create.max_autocomplete_results' => [
'type' => 'integer',
'description' => 'Max. number of elements returned by the autocomplete.',
'description' => 'Max. number of elements returned by the autocomplete',
'default' => 10,
'value' => 10,
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'quick_create.show_history' => [
'type' => 'bool',
'description' => 'Whether or not to display the elements in the history',
'default' => true,
'value' => true,
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'quick_create.max_history_results' => [
'type' => 'integer',
'description' => 'Max. number of elements in the history.',
'description' => 'Max. number of elements in the history',
'default' => 10,
'value' => 10,
'source_of_value' => '',

View File

@@ -23,4 +23,5 @@ Dict::Add('EN US', 'English', 'English', array(
'UI:Component:QuickCreate:Input:Placeholder' => 'Select object type...',
'UI:Component:QuickCreate:Recents:Title' => 'Recents',
'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'You haven\'t create any object yet',
'UI:Component:QuickCreate:HistoryDisabled' => 'History is disabled',
));

View File

@@ -55,6 +55,8 @@ class QuickCreate extends UIBlock
protected $aLastClasses;
/** @var int $iMaxAutocompleteResults Max. number of elements returned by the autocomplete */
protected $iMaxAutocompleteResults;
/** @var bool $bShowHistory Whether or not to display the elements in the history */
protected $bShowHistory;
/** @var int $iMaxHistoryResults Max. number of elements in the history */
protected $iMaxHistoryResults;
@@ -73,6 +75,7 @@ class QuickCreate extends UIBlock
$this->aAvailableClasses = UserRights::GetAllowedClasses(UR_ACTION_CREATE, array('bizmodel'), true);
$this->aLastClasses = $aLastClasses;
$this->iMaxAutocompleteResults = (int) MetaModel::GetConfig()->Get('quick_create.max_autocomplete_results');
$this->bShowHistory = (bool) MetaModel::GetConfig()->Get('quick_create.show_history');
$this->iMaxHistoryResults = (int) MetaModel::GetConfig()->Get('quick_create.max_history_results');
}
@@ -119,6 +122,15 @@ class QuickCreate extends UIBlock
return $this->iMaxAutocompleteResults;
}
/**
* @see $bShowHistory
* @return bool
*/
public function GetShowHistory(): bool
{
return $this->bShowHistory;
}
/**
* @see $iMaxHistoryResults
* @return int

View File

@@ -20,7 +20,11 @@
<span>{{ 'UI:Component:QuickCreate:Recents:Title'|dict_s }}</span>
</div>
<div class="ibo-quick-create--compartment-content" data-role="ibo-quick-create--compartment-content">
{% if oUIBlock.GetLastClasses()|length > 0 %}
{% if oUIBlock.GetShowHistory == false %}
<div class="ibo-quick-create--compartment--placeholder">
<div class="ibo-quick-create--compartment--placeholder-hint">{{ 'UI:Component:QuickCreate:HistoryDisabled'|dict_s }}</div>
</div>
{% elseif oUIBlock.GetLastClasses()|length > 0 %}
{% for aClass in oUIBlock.GetLastClasses() %}
<a href="{{ aClass.target_url }}" class="ibo-quick-create--compartment-element" data-role="ibo-quick-create--compartment-element" data-class-code="{{ aQuery.class }}">
{% if aClass.icon_url is defined %}