Browse Source

Avoid clear button on nested properties

pull/1663/head
artf 8 years ago
parent
commit
d6faa50c27
  1. 1
      src/style_manager/model/Layer.js
  2. 13
      src/style_manager/view/PropertyView.js

1
src/style_manager/model/Layer.js

@ -18,6 +18,7 @@ module.exports = Backbone.Model.extend({
'properties',
properties instanceof Properties ? properties : new Properties(properties)
);
this.get('properties').forEach(item => item.parent = this.collection.property);
// If there is no value I'll try to get it from values
// I need value setted to make preview working

13
src/style_manager/view/PropertyView.js

@ -21,11 +21,13 @@ module.exports = Backbone.View.extend({
const pfx = this.pfx;
const icon = model.get('icon');
const info = model.get('info');
const parent = model.parent;
return `
<span class="${pfx}icon ${icon}" title="${info}">
${model.get('name')}
</span>
<b class="${pfx}clear" ${clearProp}>&Cross;</b>
${ !parent ? `<b class="${pfx}clear" ${clearProp}>&Cross;</b>` : '' }
`;
},
@ -89,20 +91,23 @@ module.exports = Backbone.View.extend({
* @private
*/
updateStatus() {
const status = this.model.get('status');
const { model } = this;
const status = model.get('status');
const parent = model.parent;
const pfx = this.pfx;
const ppfx = this.ppfx;
const config = this.config;
const updatedCls = `${ppfx}four-color`;
const computedCls = `${ppfx}color-warn`;
const labelEl = this.$el.children(`.${pfx}label`);
const clearStyle = this.getClearEl().style;
const clearStyleEl = this.getClearEl();
const clearStyle = clearStyleEl ? clearStyleEl.style : {};
labelEl.removeClass(`${updatedCls} ${computedCls}`);
clearStyle.display = 'none';
switch (status) {
case 'updated':
labelEl.addClass(updatedCls);
!parent && labelEl.addClass(updatedCls);
if (config.clearProperties) {
clearStyle.display = 'inline';

Loading…
Cancel
Save