var MAX_SHOWN = 5; import StringBuffer from 'discourse/mixins/string-buffer'; import { iconHTML } from 'discourse/helpers/fa-icon'; export default Em.Component.extend(StringBuffer, { classNameBindings: [':gutter'], rerenderTriggers: ['expanded'], // Roll up links to avoid duplicates collapsed: function() { var seen = {}, result = [], links = this.get('links'); if (!Em.isEmpty(links)) { links.forEach(function(l) { var title = Em.get(l, 'title'); if (!seen[title]) { result.pushObject(l); seen[title] = true; } }); } return result; }.property('links'), renderString: function(buffer) { var links = this.get('collapsed'), toRender = links, collapsed = !this.get('expanded'); if (!Em.isEmpty(links)) { if (collapsed) { toRender = toRender.slice(0, MAX_SHOWN); } buffer.push("