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
20 changes: 20 additions & 0 deletions administrator/components/com_finder/src/Model/MapsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Database\DatabaseQuery;

/**
* Maps model for the Finder package.
Expand Down Expand Up @@ -392,4 +393,23 @@ public function purge()

return true;
}

/**
* Manipulate the query to be used to evaluate if this is an Empty State to provide specific conditions for this extension.
*
* @return DatabaseQuery
*
* @since __DEPLOY_VERSION__
*/
protected function getEmptyStateQuery()
{
$query = parent::getEmptyStateQuery();

$title = 'ROOT';

$query->where($this->_db->quoteName('title') . ' <> :title')
->bind(':title', $title);

return $query;
}
}
51 changes: 33 additions & 18 deletions administrator/components/com_finder/src/View/Maps/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ class HtmlView extends BaseHtmlView
*/
public $activeFilters;

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

/**
* Method to display the view.
*
Expand All @@ -100,6 +107,11 @@ public function display($tpl = null)
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');

if ($this->total === 0 && $this->isEmptyState = $this->get('isEmptyState'))
{
$this->setLayout('emptystate');
}

// Check for errors.
if (count($errors = $this->get('Errors')))
{
Expand Down Expand Up @@ -128,29 +140,32 @@ protected function addToolbar()
// Get the toolbar object instance
$toolbar = Toolbar::getInstance('toolbar');

if ($canDo->get('core.edit.state'))
if (!$this->isEmptyState)
{
$dropdown = $toolbar->dropdownButton('status-group')
->text('JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
->listCheck(true);

$childBar = $dropdown->getChildToolbar();
if ($canDo->get('core.edit.state'))
{
$dropdown = $toolbar->dropdownButton('status-group')
->text('JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
->listCheck(true);

$childBar->publish('maps.publish')->listCheck(true);
$childBar->unpublish('maps.unpublish')->listCheck(true);
}
$childBar = $dropdown->getChildToolbar();

ToolbarHelper::divider();
$toolbar->appendButton('Popup', 'bars', 'COM_FINDER_STATISTICS', 'index.php?option=com_finder&view=statistics&tmpl=component', 550, 350, '', '', '', Text::_('COM_FINDER_STATISTICS_TITLE'));
ToolbarHelper::divider();
$childBar->publish('maps.publish')->listCheck(true);
$childBar->unpublish('maps.unpublish')->listCheck(true);
}

if ($canDo->get('core.delete'))
{
ToolbarHelper::deleteList('', 'maps.delete');
ToolbarHelper::divider();
$toolbar->appendButton('Popup', 'bars', 'COM_FINDER_STATISTICS', 'index.php?option=com_finder&view=statistics&tmpl=component', 550, 350, '', '', '', Text::_('COM_FINDER_STATISTICS_TITLE'));
ToolbarHelper::divider();

if ($canDo->get('core.delete'))
{
ToolbarHelper::deleteList('', 'maps.delete');
ToolbarHelper::divider();
}
}

if ($canDo->get('core.admin') || $canDo->get('core.options'))
Expand Down
23 changes: 23 additions & 0 deletions administrator/components/com_finder/tmpl/maps/emptystate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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=maps',
'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Help4.x:Smart_Search:_Content_Maps',
'icon' => 'icon-search-plus finder',
'title' => Text::_('COM_FINDER_MAPS_TOOLBAR_TITLE')
];

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_CONTENT="No content has been indexed or you have deleted all your maps. Please visit the Smart Search Index page to reindex your content."
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"
Expand Down