import Ember from 'ember';
import Polling from 'travis/mixins/polling';
import { colorForState } from 'travis/utils/helpers';

export default Ember.Component.extend(Polling, {
  routing: Ember.inject.service('-routing'),
  tagName: 'li',
  pollModels: 'repo',
  classNames: ['repo'],
  classNameBindings: ['selected'],

  selected: function() {
    return this.get('repo') === this.get('selectedRepo');
  }.property('selectedRepo'),

  color: function() {
    return colorForState(this.get('repo.lastBuildState'));
  }.property('repo.lastBuildState'),

  scrollTop: function() {
    if (window.scrollY > 0) {
      return $('html, body').animate({
        scrollTop: 0
      }, 200);
    }
  },

  click() {
    this.scrollTop();
    return this.get('routing').transitionTo('repo', this.get('repo.slug').split('/'));
  }
});

import Ember from 'ember';
import Polling from 'travis/mixins/polling';
import { colorForState } from 'travis/utils/helpers';

export default Ember.Component.extend(Polling, {
  routing: Ember.inject.service('-routing'),
  tagName: 'li',
  pollModels: 'repo',
  classNames: ['repo'],
  classNameBindings: ['selected'],

  selected: function() {
    return this.get('repo') === this.get('selectedRepo');
  }.property('selectedRepo'),

  color: function() {
    return colorForState(this.get('repo.lastBuildState'));
  }.property('repo.lastBuildState'),

  scrollTop: function() {
    if (window.scrollY > 0) {
      return $('html, body').animate({
        scrollTop: 0
      }, 200);
    }
  }
});

Remove click handler overriding default link behavior
Remove click handler overriding default link behavior

An [issue](https://github.com/travis-ci/travis-ci/issues/5181) was reported in
which the repository sidebar links were not functioning properly. I've
tracked it down to the fact that a click handler was registered and
automatically performing a redirect to the repo route.

This breaks CMD+Click behavior (as the click handler was still
called and navigating when the user did not expect it, as well as
navigated to a link that the user did not intend to visit.

This commit simply removes that click handler. I checked the previous
coffee version of the file to gain more context on why it was initially
added, but unfortunately, it was simply added when the original
component was created, so I'm not sure what its use was.
