Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions classes/output/core_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public function favicon()

public function navbar(): string
{
return $this->render_from_template('theme_academi/breadcrumbs', [
'list' => $this->get_breadcrumb_list()
]);
$items = $this->get_breadcrumb_list();
$this->make_last_item_non_clickable($items);
return $this->render_from_template('theme_academi/breadcrumbs', ['items' => $items]);
}

private function get_breadcrumb_list(): array
Expand All @@ -70,16 +70,16 @@ private function get_breadcrumb_list(): array
// Standard breadcrumb for non-course pages.
if (count($navitems) > 1 && strpos($page->pagetype, 'course-view') !== 0) {
$items = array_merge($items, $this->build_standard_nav_items($navitems));
return $this->wrap_single_breadcrumb_trail($items);
return $items;
}

// Course view breadcrumb: home > courses > categories > current course.
// Course view breadcrumb: home > courses > mycourses > categories > current course.
if (strpos($page->pagetype, 'course-view') === 0 && !empty($page->course->id)) {
$items = array_merge($items, $this->build_course_view_items($page->course));
return $this->wrap_single_breadcrumb_trail($items);
return $items;
}

return $this->wrap_single_breadcrumb_trail($items);
return $items;
}

private function build_home_item(): array
Expand All @@ -104,8 +104,6 @@ private function build_standard_nav_items(array $navitems): array
];
}

$this->make_last_item_non_clickable($items);

return $items;
}

Expand All @@ -115,6 +113,10 @@ private function build_course_view_items(\stdClass $course): array
[
'text' => get_string('courses'),
'url' => (new moodle_url('/course/index.php'))->out(false)
],
[
'text' => get_string('mycourses'),
'url' => (new moodle_url('/my/courses.php'))->out(false)
]
];

Expand Down Expand Up @@ -171,9 +173,4 @@ private function make_last_item_non_clickable(array &$items)
$items[$lastitemindex]['url'] = null;
}
}

private function wrap_single_breadcrumb_trail(array $items): array
{
return [['items' => $items]];
}
}
45 changes: 14 additions & 31 deletions scss/standard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ div.backup-section + form {
border-radius: 0;
display: block;
padding: 0;
> li {
.breadcrumb-item {
color: $grey;
text-shadow: none;
border-top-left-radius: 2px;
Expand All @@ -1128,6 +1128,11 @@ div.backup-section + form {
padding: 5px 15px;
float: left;
position: relative;
padding-inline: 1em;
overflow: visible;
width: fit-content;
margin-right: -.4em;
clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
a {
color: $grey;
&:hover,
Expand All @@ -1136,37 +1141,18 @@ div.backup-section + form {
text-decoration: none;
}
}
> .divider {
font-size: 10px;
color: $primary;
&:first-child {
clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
}
}
.breadcrumb-item {
&:last-child {
color: $white;
padding-left: 15px;
padding-right: 10px;
background: $primary;
&:before {
display: none;
}
&:after {
content: '';
width: 0;
height: 0;
border-top: 18px solid transparent;
border-bottom: 15px solid transparent;
border-left: 20px solid $primary;
position: absolute;
right: -20px;
top: 0;
}
}
+ .breadcrumb-item:before {
content: '\f105';
font-family: $font_0;
font-weight: $font_weight;
margin-right: 10px;
&:nth-child(2n):not(:last-child) {
background-color: mix($primary, $color_gallery_approx, 15%);
}
+ .breadcrumb-item::before{
display: none;
}
}
}
Expand Down Expand Up @@ -1239,7 +1225,6 @@ body:not(.pagelayout-frontpage) {
margin-right: auto;
}
.secondary-navigation {
max-width: 960px;
margin-left: auto;
margin-right: auto;
}
Expand All @@ -1251,7 +1236,6 @@ body:not(.pagelayout-frontpage) {
margin-right: auto;
}
.secondary-navigation {
max-width: 960px;
margin-left: auto;
margin-right: auto;
}
Expand All @@ -1264,7 +1248,6 @@ body:not(.pagelayout-frontpage) {
margin-right: auto;
}
.secondary-navigation {
max-width: 960px;
margin-left: auto;
margin-right: auto;
}
Expand Down Expand Up @@ -1293,7 +1276,6 @@ body:not(.pagelayout-frontpage) {
.secondary-navigation {
padding: 10px 30px;
.navigation {
max-width: 960px;
margin: 0 auto;
border: 0;
}
Expand Down Expand Up @@ -1449,6 +1431,7 @@ body:not(.pagelayout-frontpage) {
.moremenu {
.nav.nav-tabs {
border-bottom: 0;
max-width: none;
.nav-item {
margin-right: 1px;
&:last-child {
Expand Down
26 changes: 12 additions & 14 deletions templates/breadcrumbs.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,16 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
<nav aria-label="breadcrumb">
{{#list}}
<ol class="breadcrumb">
{{#items}}
<li class="breadcrumb-item{{^url}} active{{/url}}">
{{#url}}
<a href="{{url}}">{{text}}</a>
{{/url}}
{{^url}}
<span aria-current="page">{{text}}</span>
{{/url}}
</li>
{{/items}}
</ol>
{{/list}}
<ol class="breadcrumb">
{{#items}}
<li class="breadcrumb-item{{^url}} active{{/url}}">
{{#url}}
<a href="{{url}}">{{text}}</a>
{{/url}}
{{^url}}
<span aria-current="page">{{text}}</span>
{{/url}}
</li>
{{/items}}
</ol>
</nav>
Loading