<commit_before>var MAX_SHOWN = 5;

export default Em.Component.extend({
  classNameBindings: [':gutter'],

  // 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'),

  render: 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("<ul class='post-links'>");
      toRender.forEach(function(l) {
        var direction = Em.get(l, 'reflection') ? 'left' : 'right',
            clicks = Em.get(l, 'clicks');

        buffer.push("<li><a href='" + Em.get(l, 'url') + "' class='track-link'>");
        /* suppress both left and right arrow for now */
        var title = Em.get(l, 'title');
        if (!Em.isEmpty(title)) {
          buffer.push(Handlebars.Utils.escapeExpression(title));
        }
        if (clicks) {
          buffer.push("<span class='badge badge-notification clicks'>" + clicks + "</span>");
        }
        buffer.push("</a></li>");
      });

      if (collapsed) {
        var remaining = links.length - MAX_SHOWN;
        if (remaining > 0) {
          buffer.push("<li><a href='#' class='toggle-more'>" + I18n.t('post.more_links', {count: remaining}) + "</a></li>");
        }
      }
      buffer.push('</ul>');<commit_msg>UX: Add class to gutter links so you can infer if they are inbound or outbound using CSS<commit_after>var MAX_SHOWN = 5;

export default Em.Component.extend({
  classNameBindings: [':gutter'],

  // 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'),

  render: 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("<ul class='post-links'>");
      toRender.forEach(function(l) {
        var direction = Em.get(l, 'reflection') ? 'inbound' : 'outbound',
            clicks = Em.get(l, 'clicks');

        buffer.push("<li><a href='" + Em.get(l, 'url') + "' class='track-link " + direction + "'>");

        var title = Em.get(l, 'title');
        if (!Em.isEmpty(title)) {
          buffer.push(Handlebars.Utils.escapeExpression(title));
        }
        if (clicks) {
          buffer.push("<span class='badge badge-notification clicks'>" + clicks + "</span>");
        }
        buffer.push("</a></li>");
      });

      if (collapsed) {
        var remaining = links.length - MAX_SHOWN;
        if (remaining > 0) {
          buffer.push("<li><a href='#' class='toggle-more'>" + I18n.t('post.more_links', {count: remaining}) + "</a></li>");
        }
      }
      buffer.push('</ul>');
{'fraction_non_alphanumeric': 0.1829020063972085, 'fraction_numerical': 0.002907822041291073, 'mean_word_length': 2.239171374764595, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6201287', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1080, 'n_words': 229}