<commit_before>/* globals window */
var Backbone = require('backbone'),
    $ = require('jquery'),
    Query = require('lib/query'),
    _ = require('underscore'),
    facilities = require('collections/facilities').instance,
    searchParams = ["fr"];

function validCategory(category) {
  return category && (/[a-z]+/).test(category.toString());
}

function getData($elements, dataAttrName) {
  var result = [];
  $elements.each(function(n, el) {
    result.push($(el).data(dataAttrName));
  });
  return result;
}

var CATEGORIES = [
  {
    key: "food",
    title: "Food",
    icon: "shopping-cart"

  },
  {
    key: "medical",
    title: "Medical",
    icon: "heart"
  },
  {
    key: "housing",
    title: "Housing",
    icon: "briefcase"
  },
  {
    key: "technology",
    title: "Technology",
    icon: "hdd"
  },
  {
    key: "hygiene",
    title: "Hygiene",
    icon: "tint"
  }
];

var ListView = Backbone.View.extend({
  template: require('templates/list'),

  events: {
    "click #filter": 'toggleSearch',
    "click .query .submit-query": 'doFilterQuery',
    "click .query .dismiss": 'dismissFilters',
    "click #load-more": 'loadMore'
  },

  initialize: function() {
    this.listenTo(this.collection, 'reset', this.render);
    this.listenTo(this.collection, 'add', this.render);
  },

  reset: function() {
    this.offset = this.hideMore = null;
  },

  loadMore: function() {
    $('#loading-spinner').show();
    $('#load-more-container').hide();

    Query.submit(this.getFilterParams()).done(function(results) {
      $('#loading-spinner').hide();

      this.offset = results.offset;
      this.hideMore = (results.data.length < 10);

      facilities.add(results.data);
    }.bind(this));
  },

  toggleSearch: function() {<commit_msg>call render manually.  backbone events not working<commit_after>/* globals window */
var Backbone = require('backbone'),
    $ = require('jquery'),
    Query = require('lib/query'),
    _ = require('underscore'),
    facilities = require('collections/facilities').instance,
    searchParams = ["fr"];

function validCategory(category) {
  return category && (/[a-z]+/).test(category.toString());
}

function getData($elements, dataAttrName) {
  var result = [];
  $elements.each(function(n, el) {
    result.push($(el).data(dataAttrName));
  });
  return result;
}

var CATEGORIES = [
  {
    key: "food",
    title: "Food",
    icon: "shopping-cart"

  },
  {
    key: "medical",
    title: "Medical",
    icon: "heart"
  },
  {
    key: "housing",
    title: "Housing",
    icon: "briefcase"
  },
  {
    key: "technology",
    title: "Technology",
    icon: "hdd"
  },
  {
    key: "hygiene",
    title: "Hygiene",
    icon: "tint"
  }
];

var ListView = Backbone.View.extend({
  template: require('templates/list'),

  events: {
    "click #filter": 'toggleSearch',
    "click .query .submit-query": 'doFilterQuery',
    "click .query .dismiss": 'dismissFilters',
    "click #load-more": 'loadMore'
  },

  initialize: function() {
    this.listenTo(this.collection, 'reset', this.render);
  },

  reset: function() {
    this.offset = this.hideMore = null;
  },

  loadMore: function() {
    $('#loading-spinner').show();
    $('#load-more-container').hide();

    Query.submit(this.getFilterParams()).done(function(results) {
      $('#loading-spinner').hide();

      this.offset = results.offset;
      this.hideMore = (results.data.length < 10);

      this.collection.add(results.data);
      this.render();
    }.bind(this));
  },

  toggleSearch: function() {
{'fraction_non_alphanumeric': 0.1884016973125884, 'fraction_numerical': 0.0011315417256011315, 'mean_word_length': 3.1796690307328603, 'pattern_counts': {'":': 8, '<': 5, '<?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': '3363055', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1178, 'n_words': 222}