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.170 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.169 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.168 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.167 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.166 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.165 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.164 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.163 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.162 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.161 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.160 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.159 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.158 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.157 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.156 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.155 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.154 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.153 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.152 app/assets/javascripts/caboose/model/model.js
caboose-cms-0.9.151 app/assets/javascripts/caboose/model/model.js