mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
N°3207 - Global search: Keep input open and focus at the end of the query when running a search
This commit is contained in:
@@ -46,6 +46,8 @@ class GlobalSearch extends UIBlock
|
||||
|
||||
/** @var string $sEndpoint Absolute endpoint URL of the search form */
|
||||
protected $sEndpoint;
|
||||
/** @var string Query currently in the input */
|
||||
protected $sQuery;
|
||||
/** @var array $aLastQueries */
|
||||
protected $aLastQueries;
|
||||
/** @var bool $bShowHistory Whether or not to display the elements in the history */
|
||||
@@ -65,6 +67,7 @@ class GlobalSearch extends UIBlock
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->SetEndpoint(static::DEFAULT_ENDPOINT_REL_URL);
|
||||
$this->SetQuery('');
|
||||
$this->SetLastQueries($aLastQueries);
|
||||
$this->bShowHistory = (bool) MetaModel::GetConfig()->Get('global_search.show_history');
|
||||
$this->iMaxHistoryResults = (int) MetaModel::GetConfig()->Get('global_search.max_history_results');
|
||||
@@ -98,6 +101,36 @@ class GlobalSearch extends UIBlock
|
||||
return $this->sEndpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses $sQuery
|
||||
* @param string $sQuery
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetQuery(string $sQuery)
|
||||
{
|
||||
$this->sQuery = $sQuery;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses $sQuery
|
||||
* @return string
|
||||
*/
|
||||
public function GetQuery(): string
|
||||
{
|
||||
return $this->sQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses $sQuery
|
||||
* @return bool
|
||||
*/
|
||||
public function HasQuery(): bool
|
||||
{
|
||||
return !empty($this->sQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set all the last queries at once
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user