mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°3620 - Add confg. parameter to disable "quick create" history
This commit is contained in:
@@ -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' => '',
|
||||
|
||||
@@ -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',
|
||||
));
|
||||
@@ -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
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
Reference in New Issue
Block a user