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.
 
 
 
 

41 lines
1018 B

var Backbone = require('backbone');
var PropertyView = require('./PropertyView');
var InputNumber = require('domain_abstract/ui/InputNumber');
module.exports = PropertyView.extend({
initialize: function(options) {
PropertyView.prototype.initialize.apply(this, arguments);
this.listenTo( this.model ,'change:unit', this.valueChanged);
},
/**
* Returns value from inputs
* @return {string}
*/
getValueForTarget: function() {
var model = this.model;
return model.get('value') + model.get('unit');
},
renderInput: function() {
if (!this.input) {
var inputNumber = new InputNumber({
model: this.model,
ppfx: this.ppfx
});
this.input = inputNumber.render();
this.$el.append(this.input.$el);
this.$input = this.input.inputEl;
this.$unit = this.input.unitEl;
}
this.setValue(this.componentValue);
},
renderTemplate: function(){},
setValue: function(value) {
this.input.setValue(value, {silent: 1});
},
});