diff --git a/administrator/components/com_content/src/View/Articles/HtmlView.php b/administrator/components/com_content/src/View/Articles/HtmlView.php index eda91831e62a2..5ebfd55b6410d 100644 --- a/administrator/components/com_content/src/View/Articles/HtmlView.php +++ b/administrator/components/com_content/src/View/Articles/HtmlView.php @@ -88,6 +88,11 @@ public function display($tpl = null) $this->activeFilters = $this->get('ActiveFilters'); $this->vote = PluginHelper::isEnabled('content', 'vote'); + if (!count($this->items) && $this->get('IsBlankSlate')) + { + $this->setLayout('blankstate'); + } + if (ComponentHelper::getParams('com_content')->get('workflow_enabled')) { PluginHelper::importPlugin('workflow'); diff --git a/administrator/components/com_content/src/View/Featured/HtmlView.php b/administrator/components/com_content/src/View/Featured/HtmlView.php index fa8735cc83129..7b5bc7726c462 100644 --- a/administrator/components/com_content/src/View/Featured/HtmlView.php +++ b/administrator/components/com_content/src/View/Featured/HtmlView.php @@ -88,6 +88,11 @@ public function display($tpl = null) $this->activeFilters = $this->get('ActiveFilters'); $this->vote = PluginHelper::isEnabled('content', 'vote'); + if (!count($this->items) && $this->get('IsBlankSlate')) + { + $this->setLayout('blankstate'); + } + if (ComponentHelper::getParams('com_content')->get('workflow_enabled')) { PluginHelper::importPlugin('workflow'); diff --git a/administrator/components/com_content/tmpl/articles/blankstate.php b/administrator/components/com_content/tmpl/articles/blankstate.php new file mode 100644 index 0000000000000..8a7d56081b1b6 --- /dev/null +++ b/administrator/components/com_content/tmpl/articles/blankstate.php @@ -0,0 +1,34 @@ + + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +defined('_JEXEC') or die; + +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; + +?> +
+ +
+ +

+
+

+ +

+
+ + +
+
+
+ + + +
diff --git a/administrator/components/com_content/tmpl/featured/blankstate.php b/administrator/components/com_content/tmpl/featured/blankstate.php new file mode 100644 index 0000000000000..e6fbad1ecb029 --- /dev/null +++ b/administrator/components/com_content/tmpl/featured/blankstate.php @@ -0,0 +1,12 @@ + + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +defined('_JEXEC') or die; + +require __DIR__ . '/../articles/blankstate.php'; diff --git a/administrator/language/en-GB/com_content.ini b/administrator/language/en-GB/com_content.ini index 61b9ef0c89395..e1c95b9053571 100644 --- a/administrator/language/en-GB/com_content.ini +++ b/administrator/language/en-GB/com_content.ini @@ -12,6 +12,10 @@ COM_CONTENT_ATTRIBS_ARTICLE_SETTINGS_LABEL="Options" COM_CONTENT_ATTRIBS_FIELDSET_LABEL="Options" COM_CONTENT_BATCH_OPTIONS="Batch process the selected articles" COM_CONTENT_BATCH_TIP="If a category is selected for move/copy, any actions selected will be applied to the copied or moved articles. Otherwise, all actions are applied to the selected articles." +COM_CONTENT_BLANKSTATE_BUTTON_ADD="Add your first article" +COM_CONTENT_BLANKSTATE_BUTTON_LEARNMORE="Learn more" +COM_CONTENT_BLANKSTATE_CONTENT="Articles are the main content on most Joomla sites. You can use the Joomla Article Editor to create and manage your content." +COM_CONTENT_BLANKSTATE_TITLE="No Articles have been created yet." COM_CONTENT_CHANGE_STAGE="Change stage" COM_CONTENT_CHANGE_STAGE_AMBIGUOUS_TRANSITIONS="Some transitions are ambiguous for this condition. Please select your preferred transition and proceed." COM_CONTENT_CONFIG_ARTICLE_SETTINGS_DESC="These settings apply for article layouts unless they are changed for a specific menu item or article." diff --git a/libraries/src/MVC/Model/ListModel.php b/libraries/src/MVC/Model/ListModel.php index 1d7e64ecfec8a..cb411d54ff900 100644 --- a/libraries/src/MVC/Model/ListModel.php +++ b/libraries/src/MVC/Model/ListModel.php @@ -149,6 +149,29 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu } } + /** + * Is this a blank state, I.e: no items of this type regardless of the searched for states. + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public function getisBlankSlate() + { + $sql = $this->query + ->clear('select') + ->clear('values') + ->clear('bounded') + ->clear('limit') + ->clear('order') + ->clear('where') + ->select('count(*)'); + + $this->_db->setQuery($sql); + + return !($this->_db->loadResult() > 0); + } + /** * Method to cache the last query constructed. * diff --git a/tests/Codeception/_support/Page/Acceptance/Administrator/AdminPage.php b/tests/Codeception/_support/Page/Acceptance/Administrator/AdminPage.php index 7708b8cd431ee..e3dfe3d600404 100644 --- a/tests/Codeception/_support/Page/Acceptance/Administrator/AdminPage.php +++ b/tests/Codeception/_support/Page/Acceptance/Administrator/AdminPage.php @@ -28,6 +28,14 @@ class AdminPage extends AcceptanceTester */ public static $systemMessageContainer = ['id' => 'system-message-container']; + /** + * The form element with id "adminForm" + * + * @var array + * @since __DEPLOY_VERSION__ + */ + public static $adminForm = ['id' => 'adminForm']; + /** * The element id which contains page title in administrator header. * diff --git a/tests/Codeception/acceptance/administrator/components/com_content/ContentListCest.php b/tests/Codeception/acceptance/administrator/components/com_content/ContentListCest.php index fb197c0b4a48c..41b0d1f5b0f81 100644 --- a/tests/Codeception/acceptance/administrator/components/com_content/ContentListCest.php +++ b/tests/Codeception/acceptance/administrator/components/com_content/ContentListCest.php @@ -46,7 +46,7 @@ public function loadsWithoutPhpNoticesAndWarnings(AcceptanceTester $I) { $I->wantToTest('that it loads without php notices and warnings.'); $I->amOnPage(ContentListPage::$url); - $I->waitForElement(ContentListPage::$filterSearch); + $I->waitForElement(ContentListPage::$adminForm); $I->checkForPhpNoticesOrWarnings(); }