MDL-67577 core_message: navbar_output order

* moved the logic from core_message_popup_render_navbar_output to
message_popup_render_navbar_output in message/output/popup/lib.php

* using float: left instead of float: right in theme
This commit is contained in:
Bas Brands 2020-01-27 12:14:16 +01:00
parent 4e41ace0be
commit 77e5b4462e
7 changed files with 17 additions and 42 deletions

View File

@ -784,39 +784,6 @@ function core_message_user_preferences() {
return $preferences;
}
/**
* Renders the popup.
*
* @param renderer_base $renderer
* @return string The HTML
*/
function core_message_render_navbar_output(\renderer_base $renderer) {
global $USER, $CFG;
// Early bail out conditions.
if (!isloggedin() || isguestuser() || user_not_fully_set_up($USER) ||
get_user_preferences('auth_forcepasswordchange') ||
(!$USER->policyagreed && !is_siteadmin() &&
($manager = new \core_privacy\local\sitepolicy\manager()) && $manager->is_defined())) {
return '';
}
$output = '';
// Add the messages popover.
if (!empty($CFG->messaging)) {
$unreadcount = \core_message\api::count_unread_conversations($USER);
$requestcount = \core_message\api::get_received_contact_requests_count($USER->id);
$context = [
'userid' => $USER->id,
'unreadcount' => $unreadcount + $requestcount
];
$output .= $renderer->render_from_template('core_message/message_popover', $context);
}
return $output;
}
/**
* Render the message drawer to be included in the top of the body of each page.
*

View File

@ -58,5 +58,16 @@ function message_popup_render_navbar_output(\renderer_base $renderer) {
$output .= $renderer->render_from_template('message_popup/notification_popover', $context);
}
// Add the messages popover.
if (!empty($CFG->messaging)) {
$unreadcount = \core_message\api::count_unread_conversations($USER);
$requestcount = \core_message\api::get_received_contact_requests_count($USER->id);
$context = [
'userid' => $USER->id,
'unreadcount' => $unreadcount + $requestcount
];
$output .= $renderer->render_from_template('core_message/message_popover', $context);
}
return $output;
}

View File

@ -35,7 +35,7 @@
}
}}
<div class="float-right popover-region collapsed">
<div class="popover-region collapsed" data-region="popover-region-messages">
<a id="message-drawer-toggle-{{uniqid}}" class="nav-link d-inline-block popover-region-toggle position-relative" href="#"
role="button">
{{#pix}} t/message, core, {{#str}} togglemessagemenu, message {{/str}} {{/pix}}

View File

@ -44,7 +44,7 @@ Feature: Manage contacts
And I should see "Contact request sent"
And I log out
And I log in as "student4"
Then I should see "2" in the "//*[@data-region='count-container']" "xpath_element"
Then I should see "2" in the "//div[@data-region='popover-region-messages']//*[@data-region='count-container']" "xpath_element"
And I open messaging
And I click on "Contacts" "link"
Then I should see "2" in the "//div[@data-region='view-contacts']//*[@data-region='contact-request-count']" "xpath_element"
@ -69,7 +69,7 @@ Feature: Manage contacts
And I should see "Contact request sent"
And I log out
And I log in as "student3"
Then I should see "1" in the "//*[@data-region='count-container']" "xpath_element"
Then I should see "1" in the "//div[@data-region='popover-region-messages']//*[@data-region='count-container']" "xpath_element"
And I open messaging
And I click on "Contacts" "link"
Then I should see "1" in the "//div[@data-region='view-contacts']//*[@data-region='contact-request-count']" "xpath_element"

View File

@ -22,7 +22,6 @@ $content-header-footer-height: $region-header-height + $region-footer-height;
}
.popover-region {
float: right;
position: relative;
&.collapsed {
@ -177,7 +176,7 @@ $content-header-footer-height: $region-header-height + $region-footer-height;
.navbar {
.popover-region {
float: right;
float: left;
margin-right: 10px;
&.collapsed {

View File

@ -17754,7 +17754,6 @@ body {
flex-shrink: 0; }
.popover-region {
float: right;
position: relative; }
.popover-region.collapsed .popover-region-toggle:before, .popover-region.collapsed .popover-region-toggle:after {
display: none; }
@ -17869,7 +17868,7 @@ body {
display: none; }
.navbar .popover-region {
float: right;
float: left;
margin-right: 10px; }
.navbar .popover-region.collapsed .popover-region-container {
opacity: 0;

View File

@ -17934,7 +17934,6 @@ body {
flex-shrink: 0; }
.popover-region {
float: right;
position: relative; }
.popover-region.collapsed .popover-region-toggle:before, .popover-region.collapsed .popover-region-toggle:after {
display: none; }
@ -18049,7 +18048,7 @@ body {
display: none; }
.navbar .popover-region {
float: right;
float: left;
margin-right: 10px; }
.navbar .popover-region.collapsed .popover-region-container {
opacity: 0;