Free and Open source Web Builder Framework. Next generation tool for building templates without coding
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
661 B

define(['backbone'],
function (Backbone) {
return Backbone.Model.extend({
idAttribute: 'name',
defaults: {
name: '',
label: '',
type: 'class',
active: true,
},
initialize: function() {
this.set('name', this.escapeName(this.get('name')));
var label = this.get('label').trim();
if(!label)
this.set('label', this.get('name'));
},
/**
* Escape string
* @param {string} name
* @return {string}
* @private
*/
escapeName: function(name) {
return name.replace(/([^a-z0-9\w]+)/gi, '-');
},
});
});