MDL-62714 theme_boost: Course visibility in navigation bar

Added check in navbar.mustache to add dimmed_text class if needed.
Added is_hidden() in navigationlib.php to return if the class needs
to be added.
This commit is contained in:
Fotis Skandalis 2018-09-10 16:51:35 +03:00
parent 6e2e63457e
commit 8665cc33e0
2 changed files with 22 additions and 6 deletions

View File

@ -686,6 +686,15 @@ class navigation_node implements renderable {
return !empty($this->action);
}
/**
* Used to easily determine if this link in the breadcrumbs is hidden.
*
* @return boolean
*/
public function is_hidden() {
return $this->hidden;
}
/**
* Gets the CSS class to add to this node to describe its type
*

View File

@ -31,6 +31,7 @@
* action - string
* get_title - string
* get_content - string
* is_hidden - boolean
Example context (json):
{
@ -39,21 +40,25 @@
"has_action": true,
"action": "#",
"get_title": "Test title",
"get_content": "First & fresh"
"get_content": "First & fresh",
"is_hidden": false
},
{
"has_action": true,
"action": "#",
"get_title": "Second item & a title",
"get_content": "Second item"
"get_content": "Second item",
"is_hidden": false
},
{
"has_action": false,
"get_content": "Third item"
"get_content": "Third item",
"is_hidden": false
},
{
"has_action": false,
"get_content": "Fourth & last"
"get_content": "Fourth & last",
"is_hidden": true
}
]
}
@ -62,10 +67,12 @@
<ol class="breadcrumb">
{{#get_items}}
{{#has_action}}
<li class="breadcrumb-item"><a href="{{{action}}}" {{#get_title}}title="{{get_title}}"{{/get_title}}>{{{get_content}}}</a></li>
<li class="breadcrumb-item{{#is_hidden}} dimmed_text{{/is_hidden}}">
<a href="{{{action}}}" {{#get_title}}title="{{get_title}}"{{/get_title}}>{{{get_content}}}</a>
</li>
{{/has_action}}
{{^has_action}}
<li class="breadcrumb-item">{{{text}}}</li>
<li class="breadcrumb-item{{#is_hidden}} dimmed_text{{/is_hidden}}">{{{text}}}</li>
{{/has_action}}
{{/get_items}}
</ol>