-
-
Notifications
You must be signed in to change notification settings - Fork 46
Closed
Description
New language relevant PR in upstream repo: joomla/joomla-cms#33491 Here are the upstream changes:
Click to expand the diff!
diff --git a/administrator/components/com_finder/src/Model/MapsModel.php b/administrator/components/com_finder/src/Model/MapsModel.php
index 8df64e3538822..3a2231dc54f78 100644
--- a/administrator/components/com_finder/src/Model/MapsModel.php
+++ b/administrator/components/com_finder/src/Model/MapsModel.php
@@ -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.
@@ -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;
+ }
}
diff --git a/administrator/components/com_finder/src/View/Maps/HtmlView.php b/administrator/components/com_finder/src/View/Maps/HtmlView.php
index 72b58b8e2bba5..96935ba5105a8 100644
--- a/administrator/components/com_finder/src/View/Maps/HtmlView.php
+++ b/administrator/components/com_finder/src/View/Maps/HtmlView.php
@@ -78,6 +78,13 @@ class HtmlView extends BaseHtmlView
*/
public $activeFilters;
+ /**
+ * @var boolean
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ private $isEmptyState = false;
+
/**
* Method to display the view.
*
@@ -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')))
{
@@ -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'))
diff --git a/administrator/components/com_finder/tmpl/maps/emptystate.php b/administrator/components/com_finder/tmpl/maps/emptystate.php
new file mode 100644
index 0000000000000..3675b05b6677b
--- /dev/null
+++ b/administrator/components/com_finder/tmpl/maps/emptystate.php
@@ -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);
diff --git a/administrator/language/en-GB/com_finder.ini b/administrator/language/en-GB/com_finder.ini
index 678cfc095d67a..314922386886b 100644
--- a/administrator/language/en-GB/com_finder.ini
+++ b/administrator/language/en-GB/com_finder.ini
@@ -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"