<commit_before>var cdb = require('cartodb.js');

/**
 *  Create loading view
 *
 *  It will show a big loading when a new map is gonna be created
 *
 */

module.exports = cdb.core.View.extend({

  className: 'IntermediateInfo',
  tagName: 'div',
  
  initialize: function() {
    this.createModel = this.options.createModel;
    this.model = new cdb.core.Model({ state: 'idle', type: 'dataset' });
    this.template = cdb.templates.getTemplate('new_common/views/create/create_loading');
    this._initBinds();
  },

  render: function() {
    this.$el.html(
      this.template({
        type: this.model.get('type'),
        state: this.model.get('state')
      })
    );
    return this;
  },

  _initBinds: function() {
    this.model.bind('change:state', this.render, this);
    this.createModel.bind('datasetError mapError', this._itemError, this);
    this.createModel.bind('datasetCreating mapCreating', this._itemCreating, this);
    this.add_related_model(this.createModel);
  },

  _itemCreating: function(type, m, v) {
    this.model.set({
      type: type,
      state: 'loading'
    });
  },

  _itemError: function(m, v) {
    this.model.set({
      type: type,
      state: 'error'
    });
  }

});<commit_msg>Fixed problem with create loading element when new dataset or new map failed<commit_after>var cdb = require('cartodb.js');

/**
 *  Create loading view
 *
 *  It will show a big loading when a new map is gonna be created
 *
 */

module.exports = cdb.core.View.extend({

  className: 'IntermediateInfo',
  tagName: 'div',
  
  initialize: function() {
    this.createModel = this.options.createModel;
    this.model = new cdb.core.Model({ state: 'idle', type: 'dataset' });
    this.template = cdb.templates.getTemplate('new_common/views/create/create_loading');
    this._initBinds();
  },

  render: function() {
    this.$el.html(
      this.template({
        type: this.model.get('type'),
        state: this.model.get('state')
      })
    );
    return this;
  },

  _initBinds: function() {
    this.model.bind('change:state', this.render, this);
    this.createModel.bind('datasetError mapError', this._itemError, this);
    this.createModel.bind('datasetCreating mapCreating', this._itemCreating, this);
    this.add_related_model(this.createModel);
  },

  _itemCreating: function(type, m, v) {
    this.model.set({
      type: type,
      state: 'loading'
    });
  },

  _itemError: function(m, v) {
    this.model.set({
      state: 'error'
    });
  }

});
{'fraction_non_alphanumeric': 0.15390781563126252, 'fraction_numerical': 0.0, 'mean_word_length': 3.0851063829787235, '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': '5760387', 'n_tokens_mistral': 827, 'n_tokens_neox': 808, 'n_words': 174}