Add some safety when rendering a dropdown button to make sure it has

content.
This commit is contained in:
Robin Ward 2015-01-15 15:43:20 -05:00
parent 4a11bb5227
commit e4e239c159
1 changed files with 16 additions and 13 deletions

View File

@ -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>");