Add some safety when rendering a dropdown button to make sure it has
content.
This commit is contained in:
parent
4a11bb5227
commit
e4e239c159
|
@ -31,8 +31,10 @@ 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 contents = this.get('dropDownContent');
|
||||||
|
if (contents) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.get('dropDownContent').forEach(function(row) {
|
contents.forEach(function(row) {
|
||||||
var id = row.id,
|
var id = row.id,
|
||||||
title = row.title,
|
title = row.title,
|
||||||
iconClass = row.styleClasses,
|
iconClass = row.styleClasses,
|
||||||
|
@ -45,6 +47,7 @@ export default Discourse.View.extend(StringBuffer, {
|
||||||
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