mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Add some safety when rendering a dropdown button to make sure it has
content.
This commit is contained in:
@@ -31,8 +31,10 @@ export default Discourse.View.extend(StringBuffer, {
|
||||
buffer.push("</button>");
|
||||
buffer.push("<ul class='dropdown-menu'>");
|
||||
|
||||
var contents = this.get('dropDownContent');
|
||||
if (contents) {
|
||||
var self = this;
|
||||
this.get('dropDownContent').forEach(function(row) {
|
||||
contents.forEach(function(row) {
|
||||
var id = row.id,
|
||||
title = row.title,
|
||||
iconClass = row.styleClasses,
|
||||
@@ -45,6 +47,7 @@ export default Discourse.View.extend(StringBuffer, {
|
||||
buffer.push("<span>" + description + "</span></div>");
|
||||
buffer.push("</a></li>");
|
||||
});
|
||||
}
|
||||
|
||||
buffer.push("</ul>");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user