Skip to content

Commit 06ff7e7

Browse files
committed
[4.0] com_messages blank state
See joomla#33264 for instructions but this time for user orubate messages and not content This PR requires the code from joomla#33264 to be merged first - specifically the change in libraries/src/MVC/Model/ListModel.php
1 parent a340698 commit 06ff7e7

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

administrator/components/com_messages/src/View/Messages/HtmlView.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ public function display($tpl = null)
7979
$this->filterForm = $this->get('FilterForm');
8080
$this->activeFilters = $this->get('ActiveFilters');
8181

82+
if (!count($this->items) && $this->get('IsBlankSlate'))
83+
{
84+
$this->setLayout('blankstate');
85+
}
86+
8287
// Check for errors.
8388
if (count($errors = $this->get('Errors')))
8489
{

administrator/language/en-GB/com_messages.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
COM_MESSAGES="Messaging"
77
COM_MESSAGES_ADD="New Private Message"
8+
COM_MESSAGES_BLANKSTATE_TITLE="There are no messages for you in your inbox."
9+
COM_MESSAGES_BLANKSTATE_REQUESTS="Send messages to other administrators on your site and read their replies."
10+
COM_MESSAGES_BLANKSTATE_BUTTON_ADD="Send a message"
11+
COM_MESSAGES_BLANKSTATE_BUTTON_LEARNMORE="Learn more"
812
COM_MESSAGES_CONFIG_SAVED="Configuration saved."
913
COM_MESSAGES_CONFIGURATION="Messages: Options"
1014
COM_MESSAGES_ERR_INVALID_USER="Invalid user"

libraries/src/MVC/Model/ListModel.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,28 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu
148148
$this->listForbiddenList = array_merge($this->listBlacklist, $this->listForbiddenList);
149149
}
150150
}
151-
151+
/**
152+
* Is this a blank state, I.e: no items of this type regardless of the searched for states.
153+
*
154+
* @return boolean
155+
*
156+
* @since __DEPLOY_VERSION__
157+
*/
158+
public function getisBlankSlate()
159+
{
160+
$sql = $this->query
161+
->clear('select')
162+
->clear('values')
163+
->clear('bounded')
164+
->clear('limit')
165+
->clear('order')
166+
->clear('where')
167+
->select('count(*)');
168+
169+
$this->_db->setQuery($sql);
170+
171+
return !($this->_db->loadResult() > 0);
172+
}
152173
/**
153174
* Method to cache the last query constructed.
154175
*

0 commit comments

Comments
 (0)