mirror of https://github.com/artf/grapesjs.git
7 changed files with 40 additions and 20 deletions
@ -0,0 +1,4 @@ |
|||||
|
<div class="<%= pfx %>field <%= pfx %>input"> |
||||
|
<span id='<%= pfx %>input-holder'></span> |
||||
|
</div> |
||||
|
<div style="clear:both"></div> |
||||
@ -1,30 +1,32 @@ |
|||||
define(['backbone','./PropertyView', 'text!./../templates/propertySelect.html'], |
define(['backbone','./PropertyView', 'text!./../templates/propertySelect.html'], |
||||
function (Backbone, PropertyView, propertyTemplate) { |
function (Backbone, PropertyView, propertyTemplate) { |
||||
/** |
/** |
||||
* @class PropertySelectView |
* @class PropertySelectView |
||||
* */ |
* */ |
||||
return PropertyView.extend({ |
return PropertyView.extend({ |
||||
|
|
||||
template: _.template(propertyTemplate), |
template: _.template(propertyTemplate), |
||||
|
|
||||
/** @inheritdoc */ |
/** @inheritdoc */ |
||||
renderInput: function() { |
renderInput: function() { |
||||
var pfx = this.pfx; |
var pfx = this.pfx; |
||||
if(!this.$input){ |
if(!this.$input){ |
||||
if(this.list && this.list.length){ |
if(this.list && this.list.length){ |
||||
this.input = '<select>'; |
this.input = '<select>'; |
||||
|
|
||||
_.each(this.list,function(el){ |
_.each(this.list,function(el){ |
||||
var name = el.name ? el.name : el.value; |
var name = el.name ? el.name : el.value; |
||||
var style = el.style ? el.style.replace(/"/g,'"') : ''; |
var style = el.style ? el.style.replace(/"/g,'"') : ''; |
||||
this.input += '<option value="'+el.value.replace(/"/g,'"')+'" style="'+style+'">'+name+'</option>'; |
this.input += '<option value="'+el.value.replace(/"/g,'"')+'" style="'+style+'">'+name+'</option>'; |
||||
},this); |
},this); |
||||
|
|
||||
this.input += '</select>'; |
this.input += '</select>'; |
||||
this.$input = $(this.input); |
this.$input = $(this.input); |
||||
this.$el.find('#'+ pfx +'input-holder').html(this.$input); |
this.$el.find('#'+ pfx +'input-holder').html(this.$input); |
||||
} |
} |
||||
} |
} |
||||
this.setValue(this.componentValue, 0); |
this.setValue(this.componentValue, 0); |
||||
}, |
}, |
||||
|
|
||||
}); |
}); |
||||
}); |
}); |
||||
|
|||||
Loading…
Reference in new issue