replacing old .each mootools' method by _.each

This commit is contained in:
Ezequiel Bergamaschi
2014-03-17 00:36:29 -03:00
parent a0e3c74921
commit 2ab488bfa6
26 changed files with 63 additions and 62 deletions

View File

@@ -29,7 +29,7 @@ mindplot.commands.AddTopicCommand = new Class({
execute:function (commandContext) {
this._models.each(function (model, index) {
_.each(this._models, function (model, index) {
// Add a new topic ...
var topic = commandContext.createTopic(model);
@@ -59,12 +59,12 @@ mindplot.commands.AddTopicCommand = new Class({
undoExecute:function (commandContext) {
// Delete disconnected the nodes. Create a copy of the topics ...
var clonedModel = [];
this._models.each(function (model) {
_.each(this._models, function (model) {
clonedModel.push(model.clone());
});
// Finally, remove the nodes ...
this._models.each(function (model) {
_.each(this._models, function (model) {
var topicId = model.getId();
var topic = commandContext.findTopics(topicId)[0];

View File

@@ -35,7 +35,7 @@ mindplot.commands.DeleteCommand = new Class({
var topics = this._filterChildren(this._topicIds, commandContext);
if (topics.length > 0) {
topics.each(function (topic) {
_.each(topics, function (topic) {
// In case that it's editing text node, force close without update ...
topic.closeEditors();
@@ -47,7 +47,7 @@ mindplot.commands.DeleteCommand = new Class({
return rel.getModel().clone();
}));
relationships.each(function (relationship) {
_.each(relationships, function (relationship) {
commandContext.deleteRelationship(relationship);
});
@@ -69,7 +69,7 @@ mindplot.commands.DeleteCommand = new Class({
var rels = commandContext.findRelationships(this._relIds);
if (rels.length > 0) {
rels.each(function (rel) {
_.each(rels, function (rel) {
this._deletedRelModel.push(rel.getModel().clone());
commandContext.deleteRelationship(rel);
}, this);
@@ -79,12 +79,12 @@ mindplot.commands.DeleteCommand = new Class({
undoExecute:function (commandContext) {
// Add all the topics ...
this._deletedTopicModels.each(function (model) {
_.each(this._deletedTopicModels, function (model) {
commandContext.createTopic(model);
}, this);
// Do they need to be connected ?
this._deletedTopicModels.each(function (topicModel, index) {
_.each(this._deletedTopicModels, function (topicModel, index) {
var topics = commandContext.findTopics(topicModel.getId());
var parentId = this._parentTopicIds[index];
@@ -95,12 +95,12 @@ mindplot.commands.DeleteCommand = new Class({
}, this);
// Add rebuild relationships ...
this._deletedRelModel.each(function (model) {
_.each(this._deletedRelModel, function (model) {
commandContext.addRelationship(model);
}.bind(this));
// Finally display the topics ...
this._deletedTopicModels.each(function (topicModel) {
_.each(this._deletedTopicModels, function (topicModel) {
var topics = commandContext.findTopics(topicModel.getId());
topics[0].setBranchVisibility(true);
}, this);
@@ -121,7 +121,7 @@ mindplot.commands.DeleteCommand = new Class({
var topics = commandContext.findTopics(topicIds);
var result = [];
topics.each(function (topic) {
_.each(topics, function (topic) {
var parent = topic.getParent();
var found = false;
while (parent != null && !found) {

View File

@@ -46,7 +46,7 @@ mindplot.commands.GenericFunctionCommand = new Class({
}
if (topics != null) {
topics.each(function (topic) {
_.each(topics, function (topic) {
var oldValue = this._commandFunc(topic, this._value);
this._oldValues.push(oldValue);
}.bind(this));
@@ -62,7 +62,7 @@ mindplot.commands.GenericFunctionCommand = new Class({
undoExecute:function (commandContext) {
if (this.applied) {
var topics = commandContext.findTopics(this._topicsId);
topics.each(function (topic, index) {
_.each(topics, function (topic, index) {
this._commandFunc(topic, this._oldValues[index]);
}.bind(this));