Skip to content

Commit

Permalink
MDL-61298 theme Boost: Nav drawer icon improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kathrin84 authored and David Monllao committed Apr 10, 2018
1 parent 5ba5a5e commit 64448e1
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 17 deletions.
6 changes: 5 additions & 1 deletion lib/classes/output/icon_system_fontawesome.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public function get_core_icon_map() {
'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',
Expand All @@ -231,6 +232,7 @@ public function get_core_icon_map() {
'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',
Expand All @@ -251,7 +253,7 @@ public function get_core_icon_map() {
'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',
Expand All @@ -265,6 +267,7 @@ public function get_core_icon_map() {
'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',
Expand All @@ -284,6 +287,7 @@ public function get_core_icon_map() {
'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',
Expand Down
24 changes: 16 additions & 8 deletions lib/navigationlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,8 @@ public function __construct(moodle_page $page) {
'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', '')
);
}

Expand Down Expand Up @@ -1211,7 +1212,8 @@ public function initialise() {
}
} 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
Expand All @@ -1221,7 +1223,7 @@ public function initialise() {
$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');

Expand Down Expand Up @@ -2037,7 +2039,8 @@ public function load_generic_course_sections(stdClass $course, 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) {
Expand Down Expand Up @@ -2592,7 +2595,7 @@ public function add_course(stdClass $course, $forcegeneric = false, $coursetype
}
}

$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);
Expand Down Expand Up @@ -2686,7 +2689,8 @@ public function add_course_essentials($coursenode, stdClass $course) {

//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');
Expand Down Expand Up @@ -2801,15 +2805,17 @@ public function add_front_page_course_essentials(navigation_node $coursenode, st

// 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;
}

if (isloggedin()) {
$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;
}
Expand Down Expand Up @@ -3848,6 +3854,7 @@ public function initialise() {

$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();
Expand Down Expand Up @@ -3887,6 +3894,7 @@ public function initialise() {
$flat = new flat_navigation_node($admin, 0);
$flat->set_showdivider(true);
$flat->key = 'sitesettings';
$flat->icon = new pix_icon('t/preferences', '');
$this->add($flat);
}

Expand Down
1 change: 1 addition & 0 deletions pix/i/home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions pix/i/privatefiles.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions pix/i/section.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions theme/boost/templates/flat_navigation.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@
<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>
Expand All @@ -79,11 +79,11 @@
<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>
Expand Down

0 comments on commit 64448e1

Please sign in to comment.