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) { |
|||
/** |
|||
/** |
|||
* @class PropertySelectView |
|||
* */ |
|||
return PropertyView.extend({ |
|||
|
|||
|
|||
template: _.template(propertyTemplate), |
|||
|
|||
|
|||
/** @inheritdoc */ |
|||
renderInput: function() { |
|||
var pfx = this.pfx; |
|||
if(!this.$input){ |
|||
if(this.list && this.list.length){ |
|||
this.input = '<select>'; |
|||
|
|||
_.each(this.list,function(el){ |
|||
var name = el.name ? el.name : el.value; |
|||
var style = el.style ? el.style.replace(/"/g,'"') : ''; |
|||
this.input += '<option value="'+el.value.replace(/"/g,'"')+'" style="'+style+'">'+name+'</option>'; |
|||
var name = el.name ? el.name : el.value; |
|||
var style = el.style ? el.style.replace(/"/g,'"') : ''; |
|||
this.input += '<option value="'+el.value.replace(/"/g,'"')+'" style="'+style+'">'+name+'</option>'; |
|||
},this); |
|||
|
|||
this.input += '</select>'; |
|||
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); |
|||
}, |
|||
}, |
|||
|
|||
}); |
|||
}); |
|||
|
|||
Loading…
Reference in new issue