Commit e180445d authored by Curtis Adam's avatar Curtis Adam

Remove the default card type for the card set form

parent 8e53b5f3
......@@ -255,6 +255,8 @@
"kind": "Kategorie",
"close": "Schließen",
"cancel": "Abbrechen",
"cardType": "Karteityp",
"cardType_required": "Wähle einen Karteityp!",
"createcarddeck": "Anlegen",
"delete": "Kartei löschen",
"confirm": "Sicher?",
......@@ -632,6 +634,7 @@
},
"card": {
"navigationDisabled": "Karte wird gewechselt…",
"chooseCardType": "Wähle den Zweck deiner Kartei aus…",
"cardType0": {
"name": "Lernkartei",
"longName": "Lernkartei (Lernziel | Vertiefung | Fazit | Literatur)",
......
......@@ -256,6 +256,8 @@
"description": "Description",
"optional": "(Optional)",
"category": "Category",
"cardType": "Card Type",
"cardType_required": "Card Type required",
"visibility": "Visible for",
"visibilityoption1": "Private",
"visibilityoption2": "Public",
......@@ -666,6 +668,7 @@
},
"card": {
"navigationDisabled": "Changing card…",
"chooseCardType": "Select the purpose of your card set…",
"cardType0": {
"name": "Flashcard",
"longName": "Flashcard",
......
......@@ -463,10 +463,18 @@ export let CardType = class CardType {
}
static getCardTypeName (cardType) {
return TAPi18n.__('card.cardType' + cardType + '.name');
if (cardType < 0) {
return TAPi18n.__('card.chooseCardType');
} else {
return TAPi18n.__('card.cardType' + cardType + '.name');
}
}
static getCardTypeLongName (cardType) {
return TAPi18n.__('card.cardType' + cardType + '.longName');
if (cardType < 0) {
return TAPi18n.__('card.chooseCardType');
} else {
return TAPi18n.__('card.cardType' + cardType + '.longName');
}
}
};
......@@ -272,6 +272,9 @@ Meteor.methods({
if (!Meteor.userId() || Roles.userIsInRole(this.userId, ["firstLogin", "blocked"])) {
throw new Meteor.Error("not-authorized");
}
if (cardType < 0) {
cardType = 0;
}
return Cardsets.insert({
name: name.trim(),
description: description,
......
......@@ -49,8 +49,8 @@ export function cleanModal() {
$('#helpSetName').html('');
if (newCardsetCourseIterationRoute()) {
$('#setCardType').html(CardType.getCardTypeLongName(5));
$('#setCardType').val(5);
$('#setCardType').html(CardType.getCardTypeLongName(-1));
$('#setCardType').val(-1);
} else {
$('#setCardType').html(CardType.getCardTypeLongName(Session.get('previousCardType')));
$('#setCardType').val(Session.get('previousCardType'));
......@@ -153,6 +153,12 @@ export function saveCardset() {
$('#setNameLabel').addClass('text-warning');
$('#helpSetName').html(TAPi18n.__('modal-dialog.name_required'));
}
if (!courseIterationRoute() && $('#setCardType').val() < 0) {
errorMessage += "<li>" + TAPi18n.__('modal-dialog.cardType') + "</li>";
bertDelayMultiplier++;
$('#setCardTypeLabel').addClass('text-warning');
$('#helpSetCardType').html(TAPi18n.__('modal-dialog.cardType_required'));
}
if ($('#contentEditor').val() === "") {
error = true;
errorMessage += "<li>" + TAPi18n.__('modal-dialog.description') + "</li>";
......
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