mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
navigation MDL-20557 Made navigation icons part of the link for that item so it is clickable
This commit is contained in:
parent
6644741db6
commit
1c4eef5795
@ -771,26 +771,33 @@ navigation_tree_branch.prototype.inject_into_dom = function (element, gntinstanc
|
||||
if (this.myid != null) {
|
||||
branchp.setAttribute('id',this.myid);
|
||||
}
|
||||
var branchicon = false;
|
||||
if (this.myicon != null) {
|
||||
var branchicon = document.createElement('img');
|
||||
branchicon = document.createElement('img');
|
||||
branchicon.setAttribute('src',this.myicon);
|
||||
branchicon.setAttribute('alt','');
|
||||
branchp.appendChild(branchicon);
|
||||
this.myname = ' '+this.myname;
|
||||
}
|
||||
if (this.mylink === null) {
|
||||
branchp.innerHTML = this.myname.replace(/\n/g, '<br />');
|
||||
if (branchicon !== false) {
|
||||
branchp.appendChild(branchicon);
|
||||
}
|
||||
branchp.appendChild(document.createTextNode(this.myname.replace(/\n/g, '<br />')));
|
||||
} else {
|
||||
var branchlink = document.createElement('a');
|
||||
branchlink.setAttribute('title', this.mytitle);
|
||||
branchlink.setAttribute('href', this.mylink);
|
||||
branchlink.innerHTML = this.myname.replace(/\n/g, '<br />');
|
||||
if (branchicon !== false) {
|
||||
branchlink.appendChild(branchicon);
|
||||
}
|
||||
branchlink.appendChild(document.createTextNode(this.myname.replace(/\n/g, '<br />')));
|
||||
if (this.myhidden) {
|
||||
YAHOO.util.Dom.addClass(branchlink, 'dimmed');
|
||||
}
|
||||
branchp.appendChild(branchlink);
|
||||
}
|
||||
branchli.appendChild(branchp);
|
||||
alert(branchli.innerHTML);
|
||||
element.appendChild(branchli);
|
||||
return branchli;
|
||||
}
|
||||
|
@ -402,6 +402,15 @@ class navigation_node {
|
||||
$title = $this->title;
|
||||
}
|
||||
|
||||
if ($this->icon!==null) {
|
||||
$icon = new html_image();
|
||||
$icon->src = $this->icon;
|
||||
$icon->alt = '';
|
||||
$content = $OUTPUT->image($icon).' '.$content;
|
||||
} else if ($this->helpbutton!==null) {
|
||||
$content = sprintf('%s<span class="clearhelpbutton">%s</span>',trim($this->helpbutton),$content);
|
||||
}
|
||||
|
||||
if ($content != '' && ((is_object($this->action) && ($this->action instanceof moodle_url || $this->action instanceof html_link)) || is_string($this->action))) {
|
||||
if (!($this->action instanceof html_link)) {
|
||||
$link = new html_link();
|
||||
@ -424,19 +433,15 @@ class navigation_node {
|
||||
|
||||
$content = $OUTPUT->link($link);
|
||||
} else {
|
||||
$span = new html_span();
|
||||
$span->contents = $content;
|
||||
if ($title !== '') {
|
||||
$title = ' title="'.s($title).'"';
|
||||
$span->title = $title;
|
||||
}
|
||||
if ($this->hidden) {
|
||||
$content = sprintf('<span class="dimmed_text"%s>%s</span>', $title, clean_text($content));
|
||||
} else {
|
||||
$content = sprintf('<span%s>%s</span>', $title, clean_text($content));
|
||||
$span->add_class('dimmed_text');
|
||||
}
|
||||
}
|
||||
if ($this->icon!==null) {
|
||||
$content = sprintf('<img src="%s" alt="" /> %s',$this->icon,$content);
|
||||
} else if ($this->helpbutton!==null) {
|
||||
$content = sprintf('%s<span class="clearhelpbutton">%s</span>',trim($this->helpbutton),$content);
|
||||
$content = $OUTPUT->span($span);
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user