don't ask about adding 0 topics

This commit is contained in:
Devin Howard 2016-02-07 17:51:01 +08:00
parent 6df7fa849a
commit b47ed7b5b4

View file

@ -22,7 +22,9 @@ Metamaps.Import = {
var text = e.originalEvent.clipboardData.getData('text/plain');
var parsed = self.parseTabbedString(text);
if (confirm("Are you sure you want to create " + parsed.length + " new topics?")) {
if (parsed.length > 0 &&
confirm("Are you sure you want to create " + parsed.length +
" new topics?")) {
self.importTopics(parsed);
}//if
});
@ -76,7 +78,8 @@ Metamaps.Import = {
return results;
},
createTopicWithParameters: function(name, metacode_name, permission, desc, link, xloc, yloc) {
createTopicWithParameters: function(name, metacode_name, permission, desc,
link, xloc, yloc) {
var self = Metamaps.Topic;
var metacode = Metamaps.Metacodes.where({name: metacode_name})[0] || null;
@ -99,6 +102,7 @@ Metamaps.Import = {
});
Metamaps.Mappings.add(mapping);
self.renderTopic(mapping, topic, true, true); // this function also includes the creation of the topic in the database
// this function also includes the creation of the topic in the database
self.renderTopic(mapping, topic, true, true);
},
};