Mercurial > hg > isophonics-drupal-site
diff core/modules/quickedit/js/models/BaseModel.js @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/modules/quickedit/js/models/BaseModel.js Wed Nov 29 16:09:58 2017 +0000 @@ -0,0 +1,29 @@ +/** +* DO NOT EDIT THIS FILE. +* See the following change record for more information, +* https://www.drupal.org/node/2815083 +* @preserve +**/ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +(function (Drupal, Backbone) { + Drupal.quickedit.BaseModel = Backbone.Model.extend({ + initialize: function initialize(options) { + this.__initialized = true; + return Backbone.Model.prototype.initialize.call(this, options); + }, + set: function set(key, val, options) { + if (this.__initialized) { + if ((typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object') { + key.validate = true; + } else { + if (!options) { + options = {}; + } + options.validate = true; + } + } + return Backbone.Model.prototype.set.call(this, key, val, options); + } + }); +})(Drupal, Backbone); \ No newline at end of file