Sha256: 92ec554340f4cbc16d10ed42ce84e31e350fdb25f906b743fbe59ff881cd6eb9

Contents?: true

Size: 956 Bytes

Versions: 338

Compression:

Stored size: 956 Bytes

Contents

var Model = function(params) {
  for (var thing in params)
    this[thing] = params[thing];
  
  if (this.options_url)
  {
    for (var attrib in this.options_url)
      this.populate_options(this.options_url[attrib]);
  }
};

Model.prototype = {
  name: false,
  id: false,
  attributes: [],
  attributes_clean: [],
  update_url: false,
  fetch_url: false,
  options_url: false,
  options: false,
  
  // Moved to model binder
  //save: function(attrib, after) {
  //  if (!attrib.update_url)
  //    attrib.update_url = this.update_url;    
  //  attrib.save(after);        
  //},
  
  populate_options: function(after, i) {
    if (i == null || i == undefined)
      i = 0;
    if (i >= this.attributes.length)
      after();
    var this2 = this;
    this.attributes[i].populate_options(function() { this2.populate_options(after, i+1); });
  },
  
  name_and_id: function() {
    return this.model_name.toLowerCase() + '_' + this.model_id;
  }
  
};

Version data entries

338 entries across 338 versions & 1 rubygems

Version Path
caboose-cms-0.9.229 app/assets/javascripts/caboose/model/model.js
caboose-cms-1.0.2 app/assets/javascripts/caboose/model/model.js
caboose-cms-1.0.1 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.228 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.227 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.226 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.225 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.224 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.223 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.222 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.221 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.220 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.219 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.218 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.217 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.216 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.215 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.214 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.213 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.212 app/assets/javascripts/caboose/model/model.js