MDL-67577 core_message: navbar_output order
authorBas Brands <bas@moodle.com>
Mon, 27 Jan 2020 11:14:16 +0000 (12:14 +0100)
committerBas Brands <bas@moodle.com>
Mon, 27 Jan 2020 11:14:16 +0000 (12:14 +0100)
* 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

message/lib.php
message/output/popup/lib.php
message/templates/message_popover.mustache
message/tests/behat/message_drawer_manage_contacts.feature
theme/boost/scss/moodle/popover-region.scss
theme/boost/style/moodle.css
theme/classic/style/moodle.css

index b850e7f..b3cb81d 100644 (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.
  *
index fcfb369..dd3964e 100644 (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;
 }
index 72e541a..8f63132 100644 (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}}
index 1b8c3b0..cd8cf1a 100644 (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"
index 56f83c8..2acb9c6 100644 (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 {
index 43bf02f..d5542ac 100644 (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;
index 7052d1a..266ab12 100644 (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;