Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions administrator/components/com_finder/src/View/Searches/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ class HtmlView extends BaseHtmlView
*/
protected $canDo;

/**
* @var boolean
*
* @since __DEPLOY_VERSION__
*/
private $isEmptyState = false;

/**
* Display the view.
*
Expand All @@ -102,6 +109,11 @@ public function display($tpl = null)
$link = 'index.php?option=com_config&view=component&component=com_finder&return=' . base64_encode($uri);
$output = HTMLHelper::_('link', Route::_($link), Text::_('JOPTIONS'));

if (!\count($this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}

// Check for errors.
if (count($errors = $this->get('Errors')))
{
Expand Down Expand Up @@ -133,12 +145,15 @@ protected function addToolbar()

ToolbarHelper::title(Text::_('COM_FINDER_MANAGER_SEARCHES'), 'search');

if ($canDo->get('core.edit.state'))
if (!$this->isEmptyState)
{
ToolbarHelper::custom('searches.reset', 'refresh', '', 'JSEARCH_RESET', false);
}
if ($canDo->get('core.edit.state'))
{
ToolbarHelper::custom('searches.reset', 'refresh', '', 'JSEARCH_RESET', false);
}

ToolbarHelper::divider();
ToolbarHelper::divider();
}

if ($canDo->get('core.admin') || $canDo->get('core.options'))
{
Expand Down
24 changes: 24 additions & 0 deletions administrator/components/com_finder/tmpl/searches/emptystate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_finder
*
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;

$displayData = [
'textPrefix' => 'COM_FINDER',
'formURL' => 'index.php?option=com_finder&view=searches',
'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Help4.x:Smart_Search:_Search_Term_Analysis',
'icon' => 'icon-search',
'title' => Text::_('COM_FINDER_MANAGER_SEARCHES'),
'content' => Text::_('COM_FINDER_EMPTYSTATE_SEARCHES_CONTENT'),
];

echo LayoutHelper::render('joomla.content.emptystate', $displayData);
1 change: 1 addition & 0 deletions administrator/language/en-GB/com_finder.ini
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ COM_FINDER_CONFIGURATION="Smart Search: Options"
COM_FINDER_CREATE_FILTER="Create a filter."
COM_FINDER_EDIT_FILTER="Edit Filter"
COM_FINDER_EMPTYSTATE_BUTTON_ADD="Start the indexer"
COM_FINDER_EMPTYSTATE_SEARCHES_CONTENT="There are no phrases used for site searching to view yet."
COM_FINDER_FIELD_CREATED_BY_ALIAS_LABEL="Alias"
COM_FINDER_FIELD_CREATED_BY_LABEL="Created By"
COM_FINDER_FIELDSET_INDEX_OPTIONS_DESCRIPTION="Indexing options"
Expand Down