<commit_before>require(
['ext/jquery', 'ext/underscore', 'ext/underscore.string', 'course', 'ext/bootstrap', 'ext/backbone'],
function($, _, _s, course, _b, Backbone) {
  $(function() {

    var SearchFormView = Backbone.View.extend({
      tagName: 'form',
      className: 'nav nav-pills',
      timer: undefined,
      courseCollectionView: undefined,
      keywords: undefined,
      sortMode: undefined,
      direction: undefined,

      initialize: function(options) {
      },

      render: function() {
        var sortModes = window.pageData.sortModes;
        var directions = window.pageData.directions;
        this.$el.html(_.template($('#search-form-tpl').html(), {
          sortModes: sortModes,
          directions: directions,
          selectedSortMode: sortModes[0],
          selectedDirection: directions[1]
        }));
        $('.dropdown-toggle').dropdown();

        return this;
      },

      events: {
        'click .sort-mode-dropdown .dropdown-menu li': 'changeSortMode',
        'click .order-dropdown .dropdown-menu li': 'changeDirection',
        'input .keywords': 'changeKeywords',
        'paste .keywords': 'changeKeywords'
      },

      changeSortMode: function(evt) {
        var $target = $(evt.currentTarget);
        this.$('.selected-sort-mode').text($target.text());
        this.sortMode = $target.attr('data-value');
        this.updateCourses();
      },

      changeDirection: function(evt) {
        var $target = $(evt.currentTarget);
        this.$('.selected-direction').text($target.text());
        this.direction = $target.attr('data-value');
        this.updateCourses();
      },<commit_msg>load courses on initial load of courses page<commit_after>require(
['ext/jquery', 'ext/underscore', 'ext/underscore.string', 'course', 'ext/bootstrap', 'ext/backbone'],
function($, _, _s, course, _b, Backbone) {
  $(function() {

    var SearchFormView = Backbone.View.extend({
      tagName: 'form',
      className: 'nav nav-pills',
      timer: undefined,
      courseCollectionView: undefined,
      keywords: undefined,
      sortMode: undefined,
      direction: undefined,

      initialize: function(options) {
      },

      render: function() {
        var sortModes = window.pageData.sortModes;
        var directions = window.pageData.directions;
        this.$el.html(_.template($('#search-form-tpl').html(), {
          sortModes: sortModes,
          directions: directions,
          selectedSortMode: sortModes[0],
          selectedDirection: directions[1]
        }));
        $('.dropdown-toggle').dropdown();
        this.updateCourses();

        return this;
      },

      events: {
        'click .sort-mode-dropdown .dropdown-menu li': 'changeSortMode',
        'click .order-dropdown .dropdown-menu li': 'changeDirection',
        'input .keywords': 'changeKeywords',
        'paste .keywords': 'changeKeywords'
      },

      changeSortMode: function(evt) {
        var $target = $(evt.currentTarget);
        this.$('.selected-sort-mode').text($target.text());
        this.sortMode = $target.attr('data-value');
        this.updateCourses();
      },

      changeDirection: function(evt) {
        var $target = $(evt.currentTarget);
        this.$('.selected-direction').text($target.text());
        this.direction = $target.attr('data-value');
        this.updateCourses();
      },
{'fraction_non_alphanumeric': 0.1545750666271839, 'fraction_numerical': 0.0011844832691738228, 'mean_word_length': 2.5859872611464967, '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': '5606204', 'n_tokens_mistral': 962, 'n_tokens_neox': 951, 'n_words': 184}