Commit abde59c6 authored by Curtis Adam's avatar Curtis Adam

Fix card export and code style issues

parent 25f2537f
......@@ -49,6 +49,7 @@
"Ground": false,
"SSR": true,
"process": true,
"Assets": true
"Assets": true,
"saveAs": false
}
}
......@@ -535,32 +535,33 @@ Template.cardsetInfo.events({
}
},
'click #exportCardsBtn': function () {
//TODO: linked to todo below
/*var cardset = Cardsets.findOne(this._id);
var cards = Cards.find({
cardset_id: this._id
}, {
fields: {
'front': 1,
'back': 1,
'_id': 0
}
}).fetch();
var cardsString = '';
for (var i = 0; i < cards.length; i++) {
cardsString += JSON.stringify(cards[i]);
if (cards.length - 1 > cards[i]) {
cardsString += ", ";
}
}
var exportData = new Blob([cardsString], {
type: "application/json"
});*/
//TODO: This function is not defined... do something!
//saveAs(exportData, cardset.name + ".json");
var cardset = Cardsets.findOne(this._id);
var cards = Cards.find({
cardset_id: this._id
}, {
fields: {
'subject': 1,
'difficulty': 1,
'hint': 1,
'front': 1,
'back': 1,
'_id': 0
}
}).fetch();
var cardsString = '';
for (var i = 0; i < cards.length; i++) {
cardsString += JSON.stringify(cards[i]);
if (i < cards.length - 1) {
cardsString += ", ";
}
}
var exportData = new Blob([cardsString], {
type: "application/json"
});
saveAs(exportData, cardset.name + ".json");
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment