Skip to content

Commit

Permalink
Merge pull request #207 from webgme/issue/88_meta_editor_type_bug
Browse files Browse the repository at this point in the history
Closes #88 meta editor rm and add all attributes on change
  • Loading branch information
kecso committed Mar 3, 2015
2 parents 93ded96 + b2e579a commit 2600fe9
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,22 +252,20 @@ define(['js/Constants',
newAttributes = client.getOwnValidAttributeNames(this._metaInfo[CONSTANTS.GME_ID]),
len,
displayedAttributes = this._attributeNames.slice(0),
diff,
attrLIBase = $('<li/>'),
i;

// We have to remove all shown attributes (if type changed and name does not, we cannot detect the difference)
//first get the ones that are not there anymore
diff = _.difference(displayedAttributes, newAttributes);
len = diff.length;
len = displayedAttributes.length;
while (len--) {
this._removeAttribute(diff[len]);
this._removeAttribute(displayedAttributes[len]);
}

//second get the ones that are new
diff = _.difference(newAttributes, displayedAttributes);
len = diff.length;
len = newAttributes.length;
while (len--) {
this._addAttribute(diff[len]);
this._addAttribute(newAttributes[len]);
}

//finally update UI
Expand Down

0 comments on commit 2600fe9

Please sign in to comment.