<commit_before>Travis.Views.Jobs = Backbone.View.extend({
  initialize: function(args) {
    _.bindAll(this, 'element', 'bind', 'unbind', 'render', 'renderItems', 'renderItem', 'jobAdded', 'jobRemoved', 'updateEmpty');

    this.jobs = args.app.jobs;
    this.templates = {
      list: args.app.templates['jobs/list'],
      item: args.app.templates['jobs/_item']
    }
  },
  element: function() {
    return $('#jobs');
  },
  bind: function() {
    Backbone.Events.bind.apply(this, arguments);
    this.jobs.bind('add', this.jobAdded);
    this.jobs.bind('remove', this.jobRemoved);
  },
  unbind: function() {
    Backbone.Events.unbind.apply(this, arguments);
    if(this.jobs) {
      this.jobs.unbind('add', this.jobAdded);
      this.jobs.unbind('remove', this.jobRemoved);
    }
  },
  render: function() {
    this.bind();
    this.element().empty();
    this.element().append($(this.templates.list({ workers: [] })));
    $('.loading', this.element()).show();
    this.renderItems(this.jobs);
  },
  renderItems: function(jobs) {
    $('.loading', this.element).hide();
    this.updateEmpty();
    _.each(jobs.models, function(job) { this.renderItem(job) }.bind(this));
    // Travis.Helpers.Util.updateTimes(this.element);
  },
  renderItem: function(job) {
    $('ul', this.element()).prepend($(this.templates.item(job.toJSON())));
  },
  jobAdded: function(job) {
    this.updateEmpty();
    this.renderItem(job);
  },
  jobRemoved: function(job) {
    this.updateEmpty();
    $('#job_' + job.get('meta_id'), this.element()).remove();
  },
  updateEmpty: function() {
    var element = $('.empty', this.element());
    this.jobs.length == 0 ? element.show() : element.hide();
  }
});<commit_msg>fix mysterious #main element hiding bug<commit_after>Travis.Views.Jobs = Backbone.View.extend({
  initialize: function(args) {
    _.bindAll(this, 'element', 'bind', 'unbind', 'render', 'renderItems', 'renderItem', 'jobAdded', 'jobRemoved', 'updateEmpty');

    this.jobs = args.app.jobs;
    this.templates = {
      list: args.app.templates['jobs/list'],
      item: args.app.templates['jobs/_item']
    }
  },
  element: function() {
    return $('#jobs');
  },
  bind: function() {
    Backbone.Events.bind.apply(this, arguments);
    this.jobs.bind('add', this.jobAdded);
    this.jobs.bind('remove', this.jobRemoved);
  },
  unbind: function() {
    Backbone.Events.unbind.apply(this, arguments);
    if(this.jobs) {
      this.jobs.unbind('add', this.jobAdded);
      this.jobs.unbind('remove', this.jobRemoved);
    }
  },
  render: function() {
    this.bind();
    this.element().empty();
    this.element().append($(this.templates.list({ workers: [] })));
    $('.loading', this.element()).show();
    this.renderItems(this.jobs);
  },
  renderItems: function(jobs) {
    $('.loading', this.element()).hide();
    this.updateEmpty();
    _.each(jobs.models, function(job) { this.renderItem(job) }.bind(this));
    // Travis.Helpers.Util.updateTimes(this.element);
  },
  renderItem: function(job) {
    $('ul', this.element()).prepend($(this.templates.item(job.toJSON())));
  },
  jobAdded: function(job) {
    this.updateEmpty();
    this.renderItem(job);
  },
  jobRemoved: function(job) {
    this.updateEmpty();
    $('#job_' + job.get('meta_id'), this.element()).remove();
  },
  updateEmpty: function() {
    var element = $('.empty', this.element());
    this.jobs.length == 0 ? element.show() : element.hide();
  }
});
{'fraction_non_alphanumeric': 0.21038885664538595, 'fraction_numerical': 0.0005803830528148578, 'mean_word_length': 3.608288770053476, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4806558', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1146, 'n_words': 175}