MDL-61298 theme Boost: Nav drawer icon improvements.
authorKathrin Osswald <kathrin.osswald@uni-ulm.de>
Tue, 10 Apr 2018 09:27:34 +0000 (11:27 +0200)
committerDavid Monllao <davidm@moodle.com>
Tue, 10 Apr 2018 13:31:12 +0000 (15:31 +0200)
lib/classes/output/icon_system_fontawesome.php
lib/navigationlib.php
pix/i/home.svg [new file with mode: 0644]
pix/i/privatefiles.svg [new file with mode: 0644]
pix/i/section.svg [new file with mode: 0644]
theme/boost/templates/flat_navigation.mustache

index d91d0c7..b355f8a 100644 (file)
@@ -206,6 +206,7 @@ class icon_system_fontawesome extends icon_system_font {
             'core:i/dashboard' => 'fa-tachometer',
             'core:i/lock' => 'fa-lock',
             'core:i/categoryevent' => 'fa-cubes',
+            'core:i/course' => 'fa-graduation-cap',
             'core:i/courseevent' => 'fa-university',
             'core:i/db' => 'fa-database',
             'core:i/delete' => 'fa-trash',
@@ -231,6 +232,7 @@ class icon_system_fontawesome extends icon_system_font {
             'core:i/group' => 'fa-users',
             'core:i/groups' => 'fa-user-circle',
             'core:i/groupv' => 'fa-user-circle-o',
+            'core:i/home' => 'fa-home',
             'core:i/hide' => 'fa-eye',
             'core:i/hierarchylock' => 'fa-lock',
             'core:i/import' => 'fa-level-up',
@@ -251,7 +253,7 @@ class icon_system_fontawesome extends icon_system_font {
             'core:i/mnethost' => 'fa-external-link',
             'core:i/moodle_host' => 'fa-graduation-cap',
             'core:i/move_2d' => 'fa-arrows',
-            'core:i/navigationitem' => 'fa-fw',
+            'core:i/navigationitem' => 'fa-circle-thin',
             'core:i/ne_red_mark' => 'fa-remove',
             'core:i/new' => 'fa-bolt',
             'core:i/news' => 'fa-newspaper-o',
@@ -265,6 +267,7 @@ class icon_system_fontawesome extends icon_system_font {
             'core:i/persona_sign_in_black' => 'fa-male',
             'core:i/portfolio' => 'fa-id-badge',
             'core:i/preview' => 'fa-search-plus',
+            'core:i/privatefiles' => 'fa-file-o',
             'core:i/progressbar' => 'fa-spinner fa-spin',
             'core:i/publish' => 'fa-share',
             'core:i/questions' => 'fa-question',
@@ -284,6 +287,7 @@ class icon_system_fontawesome extends icon_system_font {
             'core:i/scales' => 'fa-balance-scale',
             'core:i/scheduled' => 'fa-calendar-check-o',
             'core:i/search' => 'fa-search',
+            'core:i/section' => 'fa-folder-o',
             'core:i/settings' => 'fa-cog',
             'core:i/show' => 'fa-eye-slash',
             'core:i/siteevent' => 'fa-globe',
index 5fae0fc..5181f76 100644 (file)
@@ -1147,7 +1147,8 @@ class global_navigation extends navigation_node {
                 'key' => 'myhome',
                 'type' => navigation_node::TYPE_SYSTEM,
                 'text' => get_string('myhome'),
-                'action' => new moodle_url('/my/')
+                'action' => new moodle_url('/my/'),
+                'icon' => new pix_icon('i/dashboard', '')
             );
         }
 
@@ -1211,7 +1212,8 @@ class global_navigation extends navigation_node {
             }
         } else {
             // The home element should be the site because the root node is my moodle
-            $this->rootnodes['home'] = $this->add(get_string('sitehome'), new moodle_url('/'), self::TYPE_SETTING, null, 'home');
+            $this->rootnodes['home'] = $this->add(get_string('sitehome'), new moodle_url('/'),
+                self::TYPE_SETTING, null, 'home', new pix_icon('i/home', ''));
             $this->rootnodes['home']->showinflatnavigation = true;
             if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MY)) {
                 // We need to stop automatic redirection
@@ -1221,7 +1223,7 @@ class global_navigation extends navigation_node {
         $this->rootnodes['site'] = $this->add_course($SITE);
         $this->rootnodes['myprofile'] = $this->add(get_string('profile'), null, self::TYPE_USER, null, 'myprofile');
         $this->rootnodes['currentcourse'] = $this->add(get_string('currentcourse'), null, self::TYPE_ROOTNODE, null, 'currentcourse');
-        $this->rootnodes['mycourses'] = $this->add(get_string('mycourses'), null, self::TYPE_ROOTNODE, null, 'mycourses');
+        $this->rootnodes['mycourses'] = $this->add(get_string('mycourses'), null, self::TYPE_ROOTNODE, null, 'mycourses', new pix_icon('i/course', ''));
         $this->rootnodes['courses'] = $this->add(get_string('courses'), new moodle_url('/course/index.php'), self::TYPE_ROOTNODE, null, 'courses');
         $this->rootnodes['users'] = $this->add(get_string('users'), null, self::TYPE_ROOTNODE, null, 'users');
 
@@ -2037,7 +2039,8 @@ class global_navigation extends navigation_node {
                 $sectionname = get_section_name($course, $section);
                 $url = course_get_url($course, $section->section, array('navigation' => true));
 
-                $sectionnode = $coursenode->add($sectionname, $url, navigation_node::TYPE_SECTION, null, $section->id);
+                $sectionnode = $coursenode->add($sectionname, $url, navigation_node::TYPE_SECTION,
+                    null, $section->id, new pix_icon('i/section', ''));
                 $sectionnode->nodetype = navigation_node::NODETYPE_BRANCH;
                 $sectionnode->hidden = (!$section->visible || !$section->available);
                 if ($this->includesectionnum !== false && $this->includesectionnum == $section->section) {
@@ -2592,7 +2595,7 @@ class global_navigation extends navigation_node {
             }
         }
 
-        $coursenode = $parent->add($coursename, $url, self::TYPE_COURSE, $shortname, $course->id);
+        $coursenode = $parent->add($coursename, $url, self::TYPE_COURSE, $shortname, $course->id, new pix_icon('i/course', ''));
         $coursenode->showinflatnavigation = $coursetype == self::COURSE_MY;
 
         $coursenode->hidden = (!$course->visible);
@@ -2686,7 +2689,8 @@ class global_navigation extends navigation_node {
 
         //Participants
         if ($navoptions->participants) {
-            $participants = $coursenode->add(get_string('participants'), new moodle_url('/user/index.php?id='.$course->id), self::TYPE_CONTAINER, get_string('participants'), 'participants');
+            $participants = $coursenode->add(get_string('participants'), new moodle_url('/user/index.php?id='.$course->id),
+                self::TYPE_CONTAINER, get_string('participants'), 'participants', new pix_icon('i/users', ''));
 
             if ($navoptions->blogs) {
                 $blogsurls = new moodle_url('/blog/index.php');
@@ -2801,7 +2805,8 @@ class global_navigation extends navigation_node {
 
             // Calendar
             $calendarurl = new moodle_url('/calendar/view.php', $params);
-            $node = $coursenode->add(get_string('calendar', 'calendar'), $calendarurl, self::TYPE_CUSTOM, null, 'calendar');
+            $node = $coursenode->add(get_string('calendar', 'calendar'), $calendarurl,
+                self::TYPE_CUSTOM, null, 'calendar', new pix_icon('i/calendar', ''));
             $node->showinflatnavigation = true;
         }
 
@@ -2809,7 +2814,8 @@ class global_navigation extends navigation_node {
             $usercontext = context_user::instance($USER->id);
             if (has_capability('moodle/user:manageownfiles', $usercontext)) {
                 $url = new moodle_url('/user/files.php');
-                $node = $coursenode->add(get_string('privatefiles'), $url, self::TYPE_SETTING, null, 'privatefiles');
+                $node = $coursenode->add(get_string('privatefiles'), $url,
+                    self::TYPE_SETTING, null, 'privatefiles', new pix_icon('i/privatefiles', ''));
                 $node->display = false;
                 $node->showinflatnavigation = true;
             }
@@ -3848,6 +3854,7 @@ class flat_navigation extends navigation_node_collection {
 
             $flat = new flat_navigation_node(navigation_node::create($coursename, $url), 0);
             $flat->key = 'coursehome';
+            $flat->icon = new pix_icon('i/course', '');
 
             $courseformat = course_get_format($course);
             $coursenode = $PAGE->navigation->find_active_node();
@@ -3887,6 +3894,7 @@ class flat_navigation extends navigation_node_collection {
             $flat = new flat_navigation_node($admin, 0);
             $flat->set_showdivider(true);
             $flat->key = 'sitesettings';
+            $flat->icon = new pix_icon('t/preferences', '');
             $this->add($flat);
         }
 
diff --git a/pix/i/home.svg b/pix/i/home.svg
new file mode 100644 (file)
index 0000000..4ec4b08
--- /dev/null
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="#999999"><path d="M488 312.7V456c0 13.3-10.7 24-24 24H348c-6.6 0-12-5.4-12-12V356c0-6.6-5.4-12-12-12h-72c-6.6 0-12 5.4-12 12v112c0 6.6-5.4 12-12 12H112c-13.3 0-24-10.7-24-24V312.7c0-3.6 1.6-7 4.4-9.3l188-154.8c4.4-3.6 10.8-3.6 15.3 0l188 154.8c2.7 2.3 4.3 5.7 4.3 9.3zm83.6-60.9L488 182.9V44.4c0-6.6-5.4-12-12-12h-56c-6.6 0-12 5.4-12 12V117l-89.5-73.7c-17.7-14.6-43.3-14.6-61 0L4.4 251.8c-5.1 4.2-5.8 11.8-1.6 16.9l25.5 31c4.2 5.1 11.8 5.8 16.9 1.6l235.2-193.7c4.4-3.6 10.8-3.6 15.3 0l235.2 193.7c5.1 4.2 12.7 3.5 16.9-1.6l25.5-31c4.2-5.2 3.4-12.7-1.7-16.9z"/></svg>
diff --git a/pix/i/privatefiles.svg b/pix/i/privatefiles.svg
new file mode 100644 (file)
index 0000000..96ba658
--- /dev/null
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="#999999"><path d="M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48z"/></svg>
diff --git a/pix/i/section.svg b/pix/i/section.svg
new file mode 100644 (file)
index 0000000..a24f360
--- /dev/null
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="#999999"><path d="M464 128H272l-64-64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V176c0-26.51-21.49-48-48-48zm-6 272H54c-3.314 0-6-2.678-6-5.992V117.992A5.993 5.993 0 0 1 54 112h134.118l64 64H458a6 6 0 0 1 6 6v212a6 6 0 0 1-6 6z"/></svg>
index 0ce8ca9..3e07313 100644 (file)
 <nav class="list-group m-t-1">
     {{/showdivider}}
     {{#action}}
-    <a class="list-group-item list-group-item-action {{#isactive}}font-weight-bold{{/isactive}}" href="{{{action}}}" data-key="{{key}}" data-isexpandable="{{isexpandable}}" data-indent="{{get_indent}}" data-showdivider="{{showdivider}}" data-type="{{type}}" data-nodetype="{{nodetype}}" data-collapse="{{collapse}}" data-forceopen="{{forceopen}}" data-isactive="{{isactive}}" data-hidden="{{hidden}}" data-preceedwithhr="{{preceedwithhr}}" {{#parent.key}}data-parent-key="{{.}}"{{/parent.key}}>
+    <a class="list-group-item list-group-item-action" href="{{{action}}}" data-key="{{key}}" data-isexpandable="{{isexpandable}}" data-indent="{{get_indent}}" data-showdivider="{{showdivider}}" data-type="{{type}}" data-nodetype="{{nodetype}}" data-collapse="{{collapse}}" data-forceopen="{{forceopen}}" data-isactive="{{isactive}}" data-hidden="{{hidden}}" data-preceedwithhr="{{preceedwithhr}}" {{#parent.key}}data-parent-key="{{.}}"{{/parent.key}}>
         <div class="m-l-{{get_indent}}">
             <div class="media">
-            {{#is_section}}
+            {{#icon.pix}}
                 <span class="media-left">
-                    {{#pix}}i/folder{{/pix}}
+                    {{#pix}}{{{icon.pix}}}, {{{icon.component}}}, {{{icon.alt}}}{{/pix}}
                 </span>
-            {{/is_section}}
-                <span class="media-body">{{{text}}}</span>
+            {{/icon.pix}}
+                <span class="media-body {{#isactive}}font-weight-bold{{/isactive}}">{{{text}}}</span>
             </div>
         </div>
     </a>
     <div class="list-group-item" data-key="{{key}}" data-isexpandable="{{isexpandable}}" data-indent="{{get_indent}}" data-showdivider="{{showdivider}}" data-type="{{type}}" data-nodetype="{{nodetype}}" data-collapse="{{collapse}}" data-forceopen="{{forceopen}}" data-isactive="{{isactive}}" data-hidden="{{hidden}}" data-preceedwithhr="{{preceedwithhr}}" {{#parent.key}}data-parent-key="{{.}}"{{/parent.key}}>
         <div class="m-l-{{get_indent}}">
             <div class="media">
-            {{#is_section}}
+            {{#icon.pix}}
                 <span class="media-left">
-                    {{#pix}}i/folder{{/pix}}
+                    {{#pix}}{{{icon.pix}}}, {{{icon.component}}}, {{{icon.alt}}}{{/pix}}
                 </span>
-            {{/is_section}}
+            {{/icon.pix}}
                 <span class="media-body">{{{text}}}</span>
             </div>
         </div>