Commit d8ad30e8 authored by Klaus-Dieter Quibeldey-Cirkel's avatar Klaus-Dieter Quibeldey-Cirkel 🏀

Merge branch '1374-preview-is-without-content-when-the-first-card-is-created' into 'staging'

Resolve "Preview is without content when the first card is created"

Closes #1374

See merge request arsnova/flashcards!1616
parents e381825c 283826f5
......@@ -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
......
......@@ -329,10 +329,10 @@ Meteor.methods({
Leitner.remove({
card_id: card_id
}, {multi: true});
});
Wozniak.remove({
card_id: card_id
}, {multi: true});
});
return result;
} else {
throw new Meteor.Error("not-authorized");
......
......@@ -352,16 +352,16 @@ Meteor.methods({
Meteor.call('updateShuffledCardsetQuantity', id);
Leitner.remove({
cardset_id: id
}, {multi: true});
});
Wozniak.remove({
cardset_id: id
}, {multi: true});
});
Notifications.remove({
link_id: id
}, {multi: true});
});
Ratings.remove({
cardset_id: id
}, {multi: true});
});
} else {
throw new Meteor.Error("not-authorized");
}
......@@ -390,10 +390,10 @@ Meteor.methods({
Meteor.call('updateShuffledCardsetQuantity', cardset._id);
Leitner.remove({
cardset_id: id
}, {multi: true});
});
Wozniak.remove({
cardset_id: id
}, {multi: true});
});
} else {
throw new Meteor.Error("not-authorized");
}
......
......@@ -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
});
......@@ -264,6 +266,7 @@ Template.deleteCardForm.events({
if (result) {
BertAlertVisuals.displayBertAlert(TAPi18n.__('deletecardSuccess'), "success", 'growl-top-left');
$('#deleteCardModal').modal('hide');
$('.modal-backdrop').css('display', 'none');
Session.set('activeCard', undefined);
$('#deleteCardModal').on('hidden.bs.modal', function () {
$('.deleteCard').removeClass("pressed");
......
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