Browse Source

Create PropertyInteger Model

pull/312/head
Artur Arseniev 9 years ago
parent
commit
5a1776be8f
  1. 18
      src/style_manager/model/Property.js
  2. 18
      src/style_manager/model/PropertyInteger.js

18
src/style_manager/model/Property.js

@ -67,4 +67,22 @@ module.exports = Backbone.Model.extend({
return result; return result;
}, },
/**
* Get a complete value of the property.
* This probably will replace the getValue when all
* properties models will be splitted
* @param {string} val Custom value to replace the one on the model
* @return {string}
*/
getFullValue(val) {
const fn = this.get('functionName');
let value = val || this.get('value');
if (fn) {
value = `${fn}(${value})`;
}
return value;
},
}); });

18
src/style_manager/model/PropertyInteger.js

@ -0,0 +1,18 @@
const Property = require('./Component');
module.exports = Property.extend({
defaults: Object.assign({}, Property.prototype.defaults, {
// Array of units, eg. ['px', '%']
units: [],
// Selected unit, eg. 'px'
unit: '',
}),
getFullValue() {
let value = this.get('value') + this.get('unit');
return Property.prototype.getFullValue.apply(this, [value]);
},
});
Loading…
Cancel
Save