<commit_before>var CoreView = require('backbone/core-view');
var checkAndBuildOpts = require('builder/helpers/required-opts');
var ImportsSelectorView = require('./imports-selector/imports-selector-view');
var SelectedImportView = require('./selected-import/selected-import-view');

var REQUIRED_OPTS = [
  'createModel',
  'userModel',
  'configModel',
  'privacyModel',
  'guessingModel'
];

/**
 *  Selected Import header
 */

module.exports = CoreView.extend({
  initialize: function (opts) {
    checkAndBuildOpts(opts, REQUIRED_OPTS, this);
  },

  render: function () {
    this._initViews();

    return this;
  },

  _initViews: function () {
    this._importsSelector = new ImportsSelectorView({
      userModel: this._userModel,
      configModel: this._configModel,
      createModel: this._createModel,
      privacyModel: this._privacyModel,
      guessingModel: this._guessingModel
    });
    this._importsSelector.bind('selectImport', this._selectImport, this);
    this.$el.append(this._importsSelector.render().el);
    this.addView(this._importsSelector);
  },

  _selectImport: function (opts) {
    this.trigger('toggleNavigation', this);
    this._importsSelector.hide();
    this._renderSelectedImportView(opts);
  },

  _showImportsSelector: function (opts) {
    this.trigger('toggleNavigation', this);
    this._importsSelector.show();
    this._selectedImport.remove();
  },

  _renderSelectedImportView: function (importContent) {
    if (importContent) {
      importContent.bind('change', this._setUploadModel, this);

      this._selectedImport = new SelectedImportView({
        title: importContent.options.title,
        name: importContent.options.name,
        importView: importContent
      });
      this._selectedImport.bind('showImportsSelector', this._showImportsSelector, this);
      this.$el.append(this._selectedImport.render().el);
      this.addView(this._selectedImport);
    }
  },

  _setUploadModel: function (d) {
    this._importsSelector._setUploadModel(d);
  }
});
<commit_msg>Reset upload model to disable footer CTA<commit_after>var CoreView = require('backbone/core-view');
var checkAndBuildOpts = require('builder/helpers/required-opts');
var ImportsSelectorView = require('./imports-selector/imports-selector-view');
var SelectedImportView = require('./selected-import/selected-import-view');
var UploadModel = require('builder/data/upload-model');

var REQUIRED_OPTS = [
  'createModel',
  'userModel',
  'configModel',
  'privacyModel',
  'guessingModel'
];

/**
 *  Selected Import header
 */

module.exports = CoreView.extend({
  initialize: function (opts) {
    checkAndBuildOpts(opts, REQUIRED_OPTS, this);
  },

  render: function () {
    this._initViews();

    return this;
  },

  _initViews: function () {
    this._importsSelector = new ImportsSelectorView({
      userModel: this._userModel,
      configModel: this._configModel,
      createModel: this._createModel,
      privacyModel: this._privacyModel,
      guessingModel: this._guessingModel
    });
    this._importsSelector.bind('selectImport', this._selectImport, this);
    this.$el.append(this._importsSelector.render().el);
    this.addView(this._importsSelector);
  },

  _selectImport: function (opts) {
    this.trigger('toggleNavigation', this);
    this._importsSelector.hide();
    this._renderSelectedImportView(opts);
  },

  _showImportsSelector: function () {
    this._resetUploadModel();
    this.trigger('toggleNavigation', this);
    this._importsSelector.show();
    this._selectedImport.remove();
  },

  _renderSelectedImportView: function (importContent) {
    if (importContent) {
      importContent.bind('change', this._setUploadModel, this);

      this._selectedImport = new SelectedImportView({
        title: importContent.options.title,
        name: importContent.options.name,
        importView: importContent
      });
      this._selectedImport.bind('showImportsSelector', this._showImportsSelector, this);
      this.$el.append(this._selectedImport.render().el);
      this.addView(this._selectedImport);
    }
  },

  _setUploadModel: function (d) {
    this._importsSelector._setUploadModel(d);
  },

  _resetUploadModel: function () {
    this._importsSelector._setUploadModel(new UploadModel(null, {
      configModel: this._configModel,
      userModel: this._userModel
    }).attributes);
  }

});

{'fraction_non_alphanumeric': 0.1300274223034735, 'fraction_numerical': 0.0, 'mean_word_length': 4.008009153318078, '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': '6102121', 'n_tokens_mistral': 1306, 'n_tokens_neox': 1281, 'n_words': 208}