Commit 3dfe2515 authored by Curtis Adam's avatar Curtis Adam

Fix the activeCard session not setting the right value for new cards

parent e381825c
......@@ -203,6 +203,7 @@ export let CardEditor = class CardEditor {
} else {
Meteor.call("updateCard", card_id, subject, content1, content2, content3, content4, content5, content6, centerTextElement, Number(learningGoalLevel), Number(backgroundStyle), learningIndex, learningUnit);
BertAlertVisuals.displayBertAlert(TAPi18n.__('savecardSuccess'), "success", 'growl-top-left');
Session.set('activeCard', Router.current().params.card_id);
if (returnToCardset) {
Router.go('cardsetdetailsid', {
_id: Router.current().params._id
......
......@@ -111,8 +111,9 @@ Template.flashcards.helpers({
}
if (Route.isEditMode()) {
result = CardIndex.getEditModeCard();
Session.set('activeCard', -1);
}
if (Session.get('activeCard') === undefined) {
if (Session.get('activeCard') === undefined && result[0] !== undefined) {
CardNavigation.setActiveCardData(result[0]._id);
}
return CardVisuals.setTypeAndDifficulty(result);
......@@ -245,6 +246,7 @@ Meteor.startup(function () {
Template.cancelEditForm.events({
'click #cancelEditConfirm': function () {
$('#cancelEditModal').on('hidden.bs.modal', function () {
Session.set('activeCard', Router.current().params.card_id);
Router.go('cardsetdetailsid', {
_id: Router.current().params._id
});
......
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