removing .bind mootools call (phase 1/2)
This commit is contained in:
@@ -29,19 +29,20 @@ mindplot.commands.AddTopicCommand = new Class({
|
||||
|
||||
execute:function (commandContext) {
|
||||
|
||||
var me = this;
|
||||
_.each(this._models, function (model, index) {
|
||||
|
||||
// Add a new topic ...
|
||||
var topic = commandContext.createTopic(model);
|
||||
|
||||
// Connect to topic ...
|
||||
if (this._parentsIds) {
|
||||
var parentId = this._parentsIds[index];
|
||||
if (me._parentsIds) {
|
||||
var parentId = me._parentsIds[index];
|
||||
if ($defined(parentId)) {
|
||||
var parentTopic = commandContext.findTopics(parentId)[0];
|
||||
commandContext.connect(topic, parentTopic);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
commandContext.addTopic(topic);
|
||||
}
|
||||
|
||||
@@ -53,7 +54,7 @@ mindplot.commands.AddTopicCommand = new Class({
|
||||
// Render node ...
|
||||
topic.setVisibility(true);
|
||||
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
undoExecute:function (commandContext) {
|
||||
@@ -69,7 +70,7 @@ mindplot.commands.AddTopicCommand = new Class({
|
||||
var topicId = model.getId();
|
||||
var topic = commandContext.findTopics(topicId)[0];
|
||||
commandContext.deleteTopic(topic);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
this._models = clonedModel;
|
||||
}
|
||||
|
@@ -97,7 +97,7 @@ mindplot.commands.DeleteCommand = new Class({
|
||||
// Add rebuild relationships ...
|
||||
_.each(this._deletedRelModel, function (model) {
|
||||
commandContext.addRelationship(model);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
// Finally display the topics ...
|
||||
_.each(this._deletedTopicModels, function (topicModel) {
|
||||
|
@@ -46,10 +46,11 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
||||
}
|
||||
|
||||
if (topics != null) {
|
||||
var me = this;
|
||||
_.each(topics, function (topic) {
|
||||
var oldValue = this._commandFunc(topic, this._value);
|
||||
this._oldValues.push(oldValue);
|
||||
}.bind(this));
|
||||
var oldValue = me._commandFunc(topic, me._value);
|
||||
me._oldValues.push(oldValue);
|
||||
});
|
||||
}
|
||||
this.applied = true;
|
||||
|
||||
@@ -62,10 +63,11 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
||||
undoExecute:function (commandContext) {
|
||||
if (this.applied) {
|
||||
var topics = commandContext.findTopics(this._topicsId);
|
||||
var me = this;
|
||||
_.each(topics, function (topic, index) {
|
||||
this._commandFunc(topic, this._oldValues[index]);
|
||||
me._commandFunc(topic, me._oldValues[index]);
|
||||
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
this.applied = false;
|
||||
this._oldValues = [];
|
||||
|
Reference in New Issue
Block a user