MDL-55802 theme_noname: Navbar is responsive and better styled
authorFrederic Massart <fred@moodle.com>
Fri, 2 Sep 2016 04:50:59 +0000 (12:50 +0800)
committerDan Poltawski <dan@moodle.com>
Fri, 23 Sep 2016 09:55:15 +0000 (10:55 +0100)
Still not perfect, but better...

Conflicts:
theme/noname/templates/columns1.mustache
theme/noname/templates/columns2.mustache
theme/noname/templates/columns3.mustache

Part of MDL-55071

theme/noname/scss/moodle/core.scss
theme/noname/scss/moodle/icons.scss
theme/noname/scss/moodle/modules.scss
theme/noname/scss/moodle/search.scss
theme/noname/templates/columns1.mustache
theme/noname/templates/columns2.mustache
theme/noname/templates/columns3.mustache
theme/noname/templates/core/custom_menu_item.mustache
theme/noname/templates/header.mustache [new file with mode: 0644]

index 2051604..fc87d8a 100644 (file)
@@ -1659,6 +1659,15 @@ img#persona_signin {
     }
 }
 
+/** Header. */
+header {
+    .collapse.in,
+    .collapsing {
+        display: block;
+        clear: both;
+    }
+}
+
 /** Header-bar styles **/
 .page-context-header {
     // We need to be explicit about the height of the header.
index afa1359..f67f6bf 100644 (file)
@@ -15,8 +15,8 @@ a:first-of-type > .icon {
 }
 
 // Fix the cog icon for an action menu.
-.action-menu > .dropdown {
-    margin-left: -0.5rem;
+.action-menu > .dropdown .icon {
+    margin-left: 0;
 }
 
 // Fix the first item in a drop down menu (it's a list of links and icons, but has been made vertical.
index 7cda361..9424080 100644 (file)
@@ -279,13 +279,12 @@ div#dock {
 // Usermenu
 .usermenu {
     .login {
-      //  color: $navbarText;
-        line-height: 40px;
+        line-height: 2.25rem;
         a {
-            color: $dropdown-link-color;
+            color: $link-color;
             &:hover,
             &:focus {
-                color: $dropdown-link-hover-color;
+                color: $link-hover-color;
                 text-decoration: underline;
             }
         }
index fcbf0e5..8ee8dd5 100644 (file)
 }
 
 .search-input-wrapper {
-    margin: 0 5px 0 2px;
+    margin: 0 $spacer 0 0;
     overflow: hidden;
     float: right;
     height: 100%;
     width: 16px;
     transition: width 0.5s ease, left 0.5s ease;
+    padding-top: $navbar-brand-padding-y;
+    padding-bottom: $navbar-brand-padding-y;
 }
 
 .search-input-wrapper > div {
     float: left;
-    margin: 10px 0 9px 0;
+    margin: 0;
+    .icon {
+        margin-right: 0;
+    }
 }
 
 .search-input-wrapper > form {
     opacity: 0;
-    margin: 5px 0 5px 25px;
+    margin-left: 25px;
     transition: opacity 0.5s ease-in-out;
 }
 
 }
 
 .search-input-wrapper.expanded {
-    width: 160px;
+    width: 162px;
 }
 
-.navbar .search-input-wrapper > form {
-    margin: 5px 0 5px 25px;
+@include media-breakpoint-down(xs) {
+    .search-input-wrapper {
+        > div {
+            margin: 0;
+        }
+        > form {
+            display: none;
+        }
+        margin: 0 $spacer 0 0;
+    }
 }
 
 .search-areas-actions {
index af1221e..dc721b9 100644 (file)
 
     {{{ output.standard_top_of_body_html }}}
 
-    <header role="banner" class="navbar navbar-light bg-faded navbar-static-top moodle-has-zindex">
-        <div class="clearfix">
-            <button class="navbar-toggler pull-xs-right hidden-sm-up" data-toggle="collapse" data-target="#bd-main-mav">☰<span class="sr-only">{{#str}}expand{{/str}}</span></button>
-        </div>
-
-        <a href="{{{ config.wwwroot }}}" class="navbar-brand">
-            {{# output.should_display_navbar_logo }}
-                <div class="logo">
-                    <img src="{{output.get_compact_logo_url}}" alt={{#quote}}{{sitename}}{{/quote}}>
-                </div>
-            {{/ output.should_display_navbar_logo }}
-            <div class="site-name">{{{ sitename }}}</div>
-        </a>
-
-        <!-- user_menu -->
-        {{{ output.user_menu }}}
-
-        <div class="collapse navbar-toggleable-xs" id="bd-main-nav">
-            <nav class="nav navbar-nav">
-                <!-- search_box -->
-                {{{ output.search_box }}}
-                <!-- custom_menu -->
-                {{{ output.custom_menu }}}
-                <!-- page_heading_menu -->
-                {{{ output.page_heading_menu }}}
-            </div>
-        </nav>
-    </header>
+    {{>theme_noname/header}}
 
     <div id="page" class="container-fluid">
         {{{ output.full_header }}}
index 72586da..6c614c0 100644 (file)
 
     {{{ output.standard_top_of_body_html }}}
 
-    <header role="banner" class="navbar navbar-light bg-faded navbar-static-top moodle-has-zindex">
-        <div class="clearfix">
-            <button class="navbar-toggler pull-xs-right hidden-sm-up" data-toggle="collapse" data-target="#bd-main-mav">☰<span class="sr-only">{{#str}}expand{{/str}}</span></button>
-        </div>
-
-        <a href="{{{ config.wwwroot }}}" class="navbar-brand">
-            {{# output.should_display_navbar_logo }}
-                <div class="logo">
-                    <img src="{{output.get_compact_logo_url}}" alt={{#quote}}{{sitename}}{{/quote}}>
-                </div>
-            {{/ output.should_display_navbar_logo }}
-            <div class="site-name">{{{ sitename }}}</div>
-        </a>
-
-        <!-- user_menu -->
-        {{{ output.user_menu }}}
-
-        <div class="collapse navbar-toggleable-xs" id="bd-main-nav">
-            <nav class="nav navbar-nav">
-                <!-- search_box -->
-                {{{ output.search_box }}}
-                <!-- custom_menu -->
-                {{{ output.custom_menu }}}
-                <!-- page_heading_menu -->
-                {{{ output.page_heading_menu }}}
-            </div>
-        </nav>
-    </header>
+    {{>theme_noname/header}}
 
     <div id="page" class="container-fluid">
         {{{ output.full_header }}}
index c09b8d7..61595ba 100644 (file)
 
     {{{ output.standard_top_of_body_html }}}
 
-    <header role="banner" class="navbar navbar-light bg-faded navbar-static-top moodle-has-zindex">
-        <div class="clearfix">
-            <button class="navbar-toggler pull-xs-right hidden-sm-up" data-toggle="collapse" data-target="#bd-main-mav">☰<span class="sr-only">{{#str}}expand{{/str}}</span></button>
-        </div>
-
-        <a href="{{{ config.wwwroot }}}" class="navbar-brand">
-            {{# output.should_display_navbar_logo }}
-                <div class="logo">
-                    <img src="{{output.get_compact_logo_url}}" alt={{#quote}}{{sitename}}{{/quote}}>
-                </div>
-            {{/ output.should_display_navbar_logo }}
-            <div class="site-name">{{{ sitename }}}</div>
-        </a>
-
-        <!-- user_menu -->
-        {{{ output.user_menu }}}
-
-        <div class="collapse navbar-toggleable-xs" id="bd-main-nav">
-            <nav class="nav navbar-nav">
-                <!-- search_box -->
-                {{{ output.search_box }}}
-                <!-- custom_menu -->
-                {{{ output.custom_menu }}}
-                <!-- page_heading_menu -->
-                {{{ output.page_heading_menu }}}
-            </div>
-        </nav>
-    </header>
+    {{>theme_noname/header}}
 
     <div id="page" class="container-fluid">
         {{{ output.full_header }}}
index 28def18..9a35f57 100644 (file)
@@ -1,7 +1,7 @@
 {{^divider}}
 {{#haschildren}}
 <span class="dropdown nav-item">
-    <a class="dropdown-toggle nav-link p-x-1" id="drop-down-{{uniqid}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#">
+    <a class="dropdown-toggle nav-link" id="drop-down-{{uniqid}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#">
         {{text}}
     </a>
     <div class="dropdown-menu" aria-labelledby="drop-down-{{uniqid}}">
diff --git a/theme/noname/templates/header.mustache b/theme/noname/templates/header.mustache
new file mode 100644 (file)
index 0000000..2b6168a
--- /dev/null
@@ -0,0 +1,47 @@
+{{!
+    This file is part of Moodle - http://moodle.org/
+
+    Moodle is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    Moodle is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+}}
+{{!
+    Page header.
+}}
+<header role="banner" class="navbar navbar-light bg-faded navbar-static-top moodle-has-zindex">
+
+    <button class="navbar-toggler pull-xs-right hidden-sm-up" data-toggle="collapse" data-target="#bd-main-nav" aria-expanded="false" aria-controls="bd-main-nav" type="button">☰<span class="sr-only">{{#str}}expand{{/str}}</span></button>
+
+    <a href="{{{ config.wwwroot }}}" class="navbar-brand">
+        {{# output.should_display_navbar_logo }}
+            <div class="logo">
+                <img src="{{output.get_compact_logo_url}}" alt={{#quote}}{{sitename}}{{/quote}}>
+            </div>
+        {{/ output.should_display_navbar_logo }}
+        <div class="site-name">{{{ sitename }}}</div>
+    </a>
+
+    <!-- user_menu -->
+    {{{ output.user_menu }}}
+
+    <!-- search_box -->
+    {{{ output.search_box }}}
+
+    <div class="collapse navbar-toggleable-xs" id="bd-main-nav">
+        <nav class="nav navbar-nav">
+            <!-- custom_menu -->
+            {{{ output.custom_menu }}}
+            <!-- page_heading_menu -->
+            {{{ output.page_heading_menu }}}
+        </nav>
+    </div>
+</header>