Add some safety when rendering a dropdown button to make sure it has
content.
This commit is contained in:
parent
4a11bb5227
commit
e4e239c159
|
@ -31,20 +31,23 @@ export default Discourse.View.extend(StringBuffer, {
|
||||||
buffer.push("</button>");
|
buffer.push("</button>");
|
||||||
buffer.push("<ul class='dropdown-menu'>");
|
buffer.push("<ul class='dropdown-menu'>");
|
||||||
|
|
||||||
var self = this;
|
var contents = this.get('dropDownContent');
|
||||||
this.get('dropDownContent').forEach(function(row) {
|
if (contents) {
|
||||||
var id = row.id,
|
var self = this;
|
||||||
title = row.title,
|
contents.forEach(function(row) {
|
||||||
iconClass = row.styleClasses,
|
var id = row.id,
|
||||||
description = row.description,
|
title = row.title,
|
||||||
className = (self.get('activeItem') === id ? 'disabled': '');
|
iconClass = row.styleClasses,
|
||||||
|
description = row.description,
|
||||||
|
className = (self.get('activeItem') === id ? 'disabled': '');
|
||||||
|
|
||||||
buffer.push("<li data-id=\"" + id + "\" class=\"" + className + "\"><a href>");
|
buffer.push("<li data-id=\"" + id + "\" class=\"" + className + "\"><a href>");
|
||||||
buffer.push("<span class='icon " + iconClass + "'></span>");
|
buffer.push("<span class='icon " + iconClass + "'></span>");
|
||||||
buffer.push("<div><span class='title'>" + title + "</span>");
|
buffer.push("<div><span class='title'>" + title + "</span>");
|
||||||
buffer.push("<span>" + description + "</span></div>");
|
buffer.push("<span>" + description + "</span></div>");
|
||||||
buffer.push("</a></li>");
|
buffer.push("</a></li>");
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
buffer.push("</ul>");
|
buffer.push("</ul>");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue