Commit d616f2c0 authored by Curtis Adam's avatar Curtis Adam

Move personal transcripts out of cardsets

parent c012250b
...@@ -290,8 +290,8 @@ ...@@ -290,8 +290,8 @@
"personal": { "personal": {
"personal": { "personal": {
"zero": "Anlegen", "zero": "Anlegen",
"one": "Meine Karten", "one": "Meine Inhalte",
"multiple": "Meine Karten" "multiple": "Meine Inhalte"
}, },
"cardsets": { "cardsets": {
"zero": "Kartei anlegen", "zero": "Kartei anlegen",
...@@ -302,6 +302,11 @@ ...@@ -302,6 +302,11 @@
"zero": "Repetitorium anlegen", "zero": "Repetitorium anlegen",
"one": "Repetitorium", "one": "Repetitorium",
"multiple": "Repetitorien" "multiple": "Repetitorien"
},
"transcripts": {
"zero": "Mitschrift Anlegen",
"one": "Meine Mitschrift",
"multiple": "Meine Mitschriften"
} }
}, },
"learndecks": "Lernpensum", "learndecks": "Lernpensum",
...@@ -551,7 +556,8 @@ ...@@ -551,7 +556,8 @@
"set-list-empty": { "set-list-empty": {
"emptytextlist": "Eine Kartei besteht aus Karten desselben Typs.", "emptytextlist": "Eine Kartei besteht aus Karten desselben Typs.",
"emptypooltextlist": "Keine Kartei vorhanden", "emptypooltextlist": "Keine Kartei vorhanden",
"newset": "Kartei anlegen (Kartenbox)" "newset": "Kartei anlegen (Kartenbox)",
"emptytexttranscripts": "Du hast noch keine Mitschrift erstellt. Informiere dich unter »Hilfe«, was du mit einer eigenen Mitschrift tun kannst."
}, },
"set-list-learn-empty": { "set-list-learn-empty": {
"emptytextlist": "Zum Lernen wähle ein Thema aus dem Themenpool oder die Karteien eines Repetitoriums.", "emptytextlist": "Zum Lernen wähle ein Thema aus dem Themenpool oder die Karteien eines Repetitoriums.",
...@@ -593,6 +599,7 @@ ...@@ -593,6 +599,7 @@
"personal": { "personal": {
"create": "Ich will eine Kartei anlegen – 'ne Kartenbox.", "create": "Ich will eine Kartei anlegen – 'ne Kartenbox.",
"cardsets": "Ich will zu meinen Kartensätzen.", "cardsets": "Ich will zu meinen Kartensätzen.",
"transcripts": "Ich will zu meinen Mitschriften",
"repetitorien": "Ich will zu meinen Repetitorien." "repetitorien": "Ich will zu meinen Repetitorien."
}, },
"pool": "Ich suche Kartensätze zu einem Thema.", "pool": "Ich suche Kartensätze zu einem Thema.",
...@@ -603,6 +610,7 @@ ...@@ -603,6 +610,7 @@
"cancel": "Danke, ich kenne mich aus.", "cancel": "Danke, ich kenne mich aus.",
"personal": { "personal": {
"cardsets": "Bring mich zu meinen Karteien!", "cardsets": "Bring mich zu meinen Karteien!",
"transcripts": "Bring mich zu meinen Mitschriften!",
"repetitorien": "Bring mich zu meinen Reps!" "repetitorien": "Bring mich zu meinen Reps!"
}, },
"pool": "Bring mich zur Karteien-Suche!", "pool": "Bring mich zur Karteien-Suche!",
...@@ -618,6 +626,51 @@ ...@@ -618,6 +626,51 @@
"sortContent": "Nach Inhalt sortieren" "sortContent": "Nach Inhalt sortieren"
} }
}, },
"transcriptForm": {
"index": {
"create": "Mitschrift erstellen",
"topic": "Thema der Mitschrift",
"tooltip": {
"edit": "Mitschrift bearbeiten",
"delete": "Mitschrift löschen"
},
"modal": {
"title": "Mitschrift löschen",
"description": "Möchtest du wirklich diese Mitschrift löschen?",
"button": {
"delete": "Löschen",
"cancel": "Abbrechen"
}
}
},
"button": {
"modal": "Zugehörigkeit festlegen",
"save": "Speichern"
},
"title": "Zugehörigkeit der Mitschrift verwalten",
"referencesLecture": {
"true": "Mit Vorlesung verknüpfen",
"false": "Private Mitschrift"
},
"selectLecture": "Vorlesung auswählen",
"bonus": {
"button": "Mitschriften",
"form": {
"title": "Bonusvergabe für Mitschriften verwalten",
"lectureTimeEnd": "Vorlesungsende",
"deadline": "Bearbeitungszeit",
"lectureDates": "Termine der Veranstaltungen",
"clock": "Uhr",
"hours": "Stunden",
"button": {
"save": "Speichern",
"cancel": "Abbrechen",
"settings": "Einstellungen",
"list": "Abgaben"
}
}
}
},
"modal-dialog": { "modal-dialog": {
"missingFields": "Bitte fülle die folgenden Felder aus", "missingFields": "Bitte fülle die folgenden Felder aus",
"newcarddeck": "Kartei anlegen (Kartenbox)", "newcarddeck": "Kartei anlegen (Kartenbox)",
......
...@@ -291,8 +291,8 @@ ...@@ -291,8 +291,8 @@
"personal": { "personal": {
"personal": { "personal": {
"zero": "Anlegen", "zero": "Anlegen",
"one": "Meine Karten", "one": "Meine Inhalte",
"multiple": "Meine Karten" "multiple": "Meine Inhalte"
}, },
"cardsets": { "cardsets": {
"zero": "Kartei anlegen", "zero": "Kartei anlegen",
...@@ -303,8 +303,13 @@ ...@@ -303,8 +303,13 @@
"zero": "Repetitorium anlegen", "zero": "Repetitorium anlegen",
"one": "Mein Repetitorium", "one": "Mein Repetitorium",
"multiple": "Meine Repetitorien" "multiple": "Meine Repetitorien"
},
"transcripts": {
"zero": "Mitschrift Anlegen",
"one": "Meine Mitschrift",
"multiple": "Meine Mitschriften"
} }
}, },
"learndecks": "Lernpensum", "learndecks": "Lernpensum",
"myprofile": "Konto", "myprofile": "Konto",
"billing": "Abrechnung", "billing": "Abrechnung",
...@@ -553,7 +558,8 @@ ...@@ -553,7 +558,8 @@
"set-list-empty": { "set-list-empty": {
"emptytextlist": "Du hast noch keine Kartei erstellt. Informiere dich unter »Hilfe«, was du mit einer eigenen Kartei tun kannst.", "emptytextlist": "Du hast noch keine Kartei erstellt. Informiere dich unter »Hilfe«, was du mit einer eigenen Kartei tun kannst.",
"emptypooltextlist": "Keine Kartei vorhanden", "emptypooltextlist": "Keine Kartei vorhanden",
"newset": "Kartei erstellen (Box für Lernkarten)" "newset": "Kartei erstellen (Box für Lernkarten)",
"emptytexttranscripts": "Du hast noch keine Mitschrift erstellt. Informiere dich unter »Hilfe«, was du mit einer eigenen Mitschrift tun kannst."
}, },
"set-list-learn-empty": { "set-list-learn-empty": {
"emptytextlist": "Zum Lernen wähle ein Thema aus dem Themen-Pool oder die Karteien eines Repetitoriums.", "emptytextlist": "Zum Lernen wähle ein Thema aus dem Themen-Pool oder die Karteien eines Repetitoriums.",
...@@ -596,6 +602,7 @@ ...@@ -596,6 +602,7 @@
"personal": { "personal": {
"create": "I want to create a card index with cards of the type:", "create": "I want to create a card index with cards of the type:",
"cardsets": "I want to see all my card indexes.", "cardsets": "I want to see all my card indexes.",
"transcripts": "I want to see my transcripts.",
"repetitorien": "Ich will Reps verwalten." "repetitorien": "Ich will Reps verwalten."
}, },
"pool": "I want to find a card index on a specific topic.", "pool": "I want to find a card index on a specific topic.",
...@@ -607,6 +614,7 @@ ...@@ -607,6 +614,7 @@
"personal": { "personal": {
"create": "Go", "create": "Go",
"cardsets": "Go", "cardsets": "Go",
"transcripts": "Go",
"repetitorien": "Go" "repetitorien": "Go"
}, },
"pool": "Go", "pool": "Go",
...@@ -622,6 +630,51 @@ ...@@ -622,6 +630,51 @@
"sortContent": "Nach Inhalt sortieren" "sortContent": "Nach Inhalt sortieren"
} }
}, },
"transcriptForm": {
"index": {
"create": "Mitschrift erstellen",
"topic": "Thema der Mitschrift",
"tooltip": {
"edit": "Mitschrift bearbeiten",
"delete": "Mitschrift löschen"
},
"modal": {
"title": "Mitschrift löschen",
"description": "Möchtest du wirklich diese Mitschrift löschen?",
"button": {
"delete": "Löschen",
"cancel": "Abbrechen"
}
}
},
"button": {
"modal": "Zugehörigkeit festlegen",
"save": "Speichern"
},
"title": "Zugehörigkeit der Mitschrift verwalten",
"referencesLecture": {
"true": "Mit Vorlesung verknüpfen",
"false": "Private Mitschrift"
},
"selectLecture": "Vorlesung auswählen",
"bonus": {
"button": "Mitschriften",
"form": {
"title": "Bonusvergabe für Mitschriften verwalten",
"lectureTimeEnd": "Vorlesungsende",
"deadline": "Bearbeitungszeit",
"lectureDates": "Termine der Veranstaltungen",
"clock": "Uhr",
"hours": "Stunden",
"button": {
"save": "Speichern",
"cancel": "Abbrechen",
"settings": "Einstellungen",
"list": "Abgaben"
}
}
}
},
"modal-dialog": { "modal-dialog": {
"missingFields": "Bitte fülle die folgenden Felder aus", "missingFields": "Bitte fülle die folgenden Felder aus",
"newcarddeck": "Kartei erstellen (Box für Lernkarten)", "newcarddeck": "Kartei erstellen (Box für Lernkarten)",
......
...@@ -8,7 +8,7 @@ export let AspectRatio = class AspectRatio { ...@@ -8,7 +8,7 @@ export let AspectRatio = class AspectRatio {
static isEnabled () { static isEnabled () {
if ((CardVisuals.isFullscreen() && !MarkdeepEditor.getMobilePreview()) || (Route.isDemo() || Route.isMakingOf())) { if ((CardVisuals.isFullscreen() && !MarkdeepEditor.getMobilePreview()) || (Route.isDemo() || Route.isMakingOf())) {
if (Route.isPresentation() && config.aspectRatioEnabled.includes(0)) { if ((Route.isPresentation() || Route.isPresentationTranscript()) && config.aspectRatioEnabled.includes(0)) {
return true; return true;
} }
if ((Route.isDemo() || Route.isMakingOf()) && config.aspectRatioEnabled.includes(1)) { if ((Route.isDemo() || Route.isMakingOf()) && config.aspectRatioEnabled.includes(1)) {
...@@ -27,7 +27,7 @@ export let AspectRatio = class AspectRatio { ...@@ -27,7 +27,7 @@ export let AspectRatio = class AspectRatio {
} }
static scaleCardNavigationWidth () { static scaleCardNavigationWidth () {
if (Route.isPresentation() && config.scaleCardNavigationWidth.includes(0)) { if ((Route.isPresentation() || Route.isPresentationTranscript()) && config.scaleCardNavigationWidth.includes(0)) {
return true; return true;
} }
if ((Route.isDemo() || Route.isMakingOf()) && config.scaleCardNavigationWidth.includes(1)) { if ((Route.isDemo() || Route.isMakingOf()) && config.scaleCardNavigationWidth.includes(1)) {
...@@ -45,7 +45,7 @@ export let AspectRatio = class AspectRatio { ...@@ -45,7 +45,7 @@ export let AspectRatio = class AspectRatio {
} }
static getDefault () { static getDefault () {
if (Route.isPresentation() || Route.isCardset()) { if (Route.isPresentation() || Route.isPresentationTranscript() || Route.isCardset()) {
if (NavigatorCheck.isIOS()) { if (NavigatorCheck.isIOS()) {
return config.defaultAspectRatioTablet[0]; return config.defaultAspectRatioTablet[0];
} else { } else {
......
...@@ -145,7 +145,16 @@ export let CardEditor = class CardEditor { ...@@ -145,7 +145,16 @@ export let CardEditor = class CardEditor {
} }
static loadEditModeContent (card) { static loadEditModeContent (card) {
let cardset = Cardsets.findOne({_id: Router.current().params._id}); let difficulty;
let cardType;
if (Route.isTranscript()) {
difficulty = card.difficulty;
cardType = card.cardType;
} else {
let cardset = Cardsets.findOne({_id: Router.current().params._id});
difficulty = cardset.difficulty;
cardType = cardset.cardType;
}
Session.set('subject', card.subject); Session.set('subject', card.subject);
Session.set('content1', card.front); Session.set('content1', card.front);
Session.set('content2', card.back); Session.set('content2', card.back);
...@@ -153,10 +162,10 @@ export let CardEditor = class CardEditor { ...@@ -153,10 +162,10 @@ export let CardEditor = class CardEditor {
Session.set('content4', card.lecture); Session.set('content4', card.lecture);
Session.set('content5', card.top); Session.set('content5', card.top);
Session.set('content6', card.bottom); Session.set('content6', card.bottom);
Session.set('cardType', cardset.cardType); Session.set('cardType', cardType);
Session.set('centerTextElement', card.centerTextElement); Session.set('centerTextElement', card.centerTextElement);
Session.set('alignType', card.alignType); Session.set('alignType', card.alignType);
Session.set('difficultyColor', cardset.difficulty); Session.set('difficultyColor', difficulty);
Session.set('learningGoalLevel', card.learningGoalLevel); Session.set('learningGoalLevel', card.learningGoalLevel);
Session.set('backgroundStyle', card.backgroundStyle); Session.set('backgroundStyle', card.backgroundStyle);
Session.set('learningUnit', card.learningUnit); Session.set('learningUnit', card.learningUnit);
...@@ -292,8 +301,12 @@ export let CardEditor = class CardEditor { ...@@ -292,8 +301,12 @@ export let CardEditor = class CardEditor {
} }
let editorsValidLength = (content1.length <= contentMaxLength && content2.length <= contentMaxLength && content3.length <= contentMaxLength && $('#subjectEditor').val().length <= subjectMaxLength && content4.length <= contentMaxLength && content5.length <= contentMaxLength && content6.length <= contentMaxLength); let editorsValidLength = (content1.length <= contentMaxLength && content2.length <= contentMaxLength && content3.length <= contentMaxLength && $('#subjectEditor').val().length <= subjectMaxLength && content4.length <= contentMaxLength && content5.length <= contentMaxLength && content6.length <= contentMaxLength);
if (gotSubject && editorsValidLength) { if (gotSubject && editorsValidLength) {
if (ActiveRoute.name('newCard')) { if (Route.isNewCard()) {
Meteor.call("addCard", Router.current().params._id, subject, content1, content2, content3, content4, content5, content6, centerTextElement, alignType, date, Number(learningGoalLevel), Number(backgroundStyle), learningIndex, learningUnit, function (error, result) { let cardset_id = "-1";
if (!Route.isTranscript()) {
cardset_id = Router.current().params._id;
}
Meteor.call("addCard", cardset_id, subject, content1, content2, content3, content4, content5, content6, centerTextElement, alignType, date, Number(learningGoalLevel), Number(backgroundStyle), learningIndex, learningUnit, function (error, result) {
if (result) { if (result) {
BertAlertVisuals.displayBertAlert(TAPi18n.__('savecardSuccess'), "success", 'growl-top-left'); BertAlertVisuals.displayBertAlert(TAPi18n.__('savecardSuccess'), "success", 'growl-top-left');
if (navigationTarget === 0) { if (navigationTarget === 0) {
...@@ -304,10 +317,14 @@ export let CardEditor = class CardEditor { ...@@ -304,10 +317,14 @@ export let CardEditor = class CardEditor {
CardEditor.setEditorButtonIndex(CardEditor.getCardNavigationNameIndex(), false); CardEditor.setEditorButtonIndex(CardEditor.getCardNavigationNameIndex(), false);
CardNavigation.selectButton(); CardNavigation.selectButton();
} else { } else {
Session.set('activeCard', result); if (Route.isTranscript()) {
Router.go('cardsetdetailsid', { Router.go('transcripts');
_id: Router.current().params._id } else {
}); Session.set('activeCard', result);
Router.go('cardsetdetailsid', {
_id: Router.current().params._id
});
}
} }
} }
}); });
...@@ -316,9 +333,13 @@ export let CardEditor = class CardEditor { ...@@ -316,9 +333,13 @@ export let CardEditor = class CardEditor {
BertAlertVisuals.displayBertAlert(TAPi18n.__('savecardSuccess'), "success", 'growl-top-left'); BertAlertVisuals.displayBertAlert(TAPi18n.__('savecardSuccess'), "success", 'growl-top-left');
Session.set('activeCard', Router.current().params.card_id); Session.set('activeCard', Router.current().params.card_id);
if (navigationTarget === 1) { if (navigationTarget === 1) {
Router.go('cardsetdetailsid', { if (Route.isTranscript()) {
_id: Router.current().params._id Router.go('transcripts');
}); } else {
Router.go('cardsetdetailsid', {
_id: Router.current().params._id
});
}
} else { } else {
CardEditor.setEditorButtonIndex(CardEditor.getCardNavigationNameIndex(), false); CardEditor.setEditorButtonIndex(CardEditor.getCardNavigationNameIndex(), false);
CardNavigation.selectButton(); CardNavigation.selectButton();
......
...@@ -59,35 +59,39 @@ export let CardIndex = class CardIndex { ...@@ -59,35 +59,39 @@ export let CardIndex = class CardIndex {
let sortQuery; let sortQuery;
let indexCards = []; let indexCards = [];
let cardset; let cardset;
if (Route.isDemo()) { if (Route.isTranscript()) {
cardset = Cardsets.findOne({kind: 'demo', name: 'DemoCardset', shuffled: true}); return 0;
} else if (Route.isMakingOf()) {
cardset = Cardsets.findOne({kind: 'demo', name: 'MakingOfCardset', shuffled: true});
} else { } else {
cardset = Cardsets.findOne(Router.current().params._id); if (Route.isDemo()) {
} cardset = Cardsets.findOne({kind: 'demo', name: 'DemoCardset', shuffled: true});
if (cardset.shuffled) { } else if (Route.isMakingOf()) {
let cardGroups = Cardsets.find({_id: {$in: cardset.cardGroups}}, { cardset = Cardsets.findOne({kind: 'demo', name: 'MakingOfCardset', shuffled: true});
sort: {name: 1}, } else {
fields: {_id: 1, cardType: 1} cardset = Cardsets.findOne(Router.current().params._id);
}); }
cardGroups.forEach(function (cardGroup) { if (cardset.shuffled) {
sortQuery = CardType.getSortQuery(cardGroup.cardType, cardGroup.sortType); let cardGroups = Cardsets.find({_id: {$in: cardset.cardGroups}}, {
indexCards = Cards.find({cardset_id: cardGroup._id}, { sort: {name: 1},
sort: sortQuery, fields: {_id: 1} fields: {_id: 1, cardType: 1}
}); });
indexCards.forEach(function (indexCard) { cardGroups.forEach(function (cardGroup) {
cardIndex.push(indexCard._id); sortQuery = CardType.getSortQuery(cardGroup.cardType, cardGroup.sortType);
indexCards = Cards.find({cardset_id: cardGroup._id}, {
sort: sortQuery, fields: {_id: 1}
});
indexCards.forEach(function (indexCard) {
cardIndex.push(indexCard._id);
});
}); });
}); } else {
} else { sortQuery = CardType.getSortQuery(cardset.cardType, cardset.sortType);
sortQuery = CardType.getSortQuery(cardset.cardType, cardset.sortType); indexCards = Cards.find({cardset_id: cardset._id}, {sort: sortQuery, fields: {_id: 1}});
indexCards = Cards.find({cardset_id: cardset._id}, {sort: sortQuery, fields: {_id: 1}}); indexCards.forEach(function (indexCard) {
indexCards.forEach(function (indexCard) { cardIndex.push(indexCard._id);}
cardIndex.push(indexCard._id);}
); );
}
return cardIndex;
} }
return cardIndex;
} }
static leitnerIndex () { static leitnerIndex () {
...@@ -193,19 +197,23 @@ export let CardIndex = class CardIndex { ...@@ -193,19 +197,23 @@ export let CardIndex = class CardIndex {
*/ */
static getCardsetCards () { static getCardsetCards () {
let query = ""; let query = "";
let cardIndexFilter = this.getCardIndexFilter(); if (Route.isPresentationTranscript()) {
if (Session.get('activeCardset').shuffled) { return Cards.find(Router.current().params.card_id).fetch();
query = Cards.find({
_id: {$in: cardIndexFilter},
cardset_id: {$in: Session.get('activeCardset').cardGroups}
}).fetch();
} else { } else {
query = Cards.find({ let cardIndexFilter = this.getCardIndexFilter();
_id: {$in: cardIndexFilter}, if (Session.get('activeCardset').shuffled) {
cardset_id: Router.current().params._id query = Cards.find({
}).fetch(); _id: {$in: cardIndexFilter},
cardset_id: {$in: Session.get('activeCardset').cardGroups}
}).fetch();
} else {
query = Cards.find({
_id: {$in: cardIndexFilter},
cardset_id: Router.current().params._id
}).fetch();
}
return this.sortQueryResult(cardIndexFilter, query);
} }
return this.sortQueryResult(cardIndexFilter, query);
} }
/** /**
...@@ -246,6 +254,10 @@ export let CardIndex = class CardIndex { ...@@ -246,6 +254,10 @@ export let CardIndex = class CardIndex {
} else { } else {
Session.set('activeCard', undefined); Session.set('activeCard', undefined);
} }
let cardset_id = -1;
if (!Route.isTranscript()) {
cardset_id = Router.current().params._id;
}
return [{ return [{
"_id": id, "_id": id,
"subject": Session.get('subject'), "subject": Session.get('subject'),
...@@ -258,7 +270,7 @@ export let CardIndex = class CardIndex { ...@@ -258,7 +270,7 @@ export let CardIndex = class CardIndex {
"lecture": Session.get('content4'), "lecture": Session.get('content4'),
"top": Session.get('content5'), "top": Session.get('content5'),
"bottom": Session.get('content6'), "bottom": Session.get('content6'),
"cardset_id": Router.current().params._id, "cardset_id": cardset_id,
"cardGroup": 0, "cardGroup": 0,
"cardType": Session.get('cardType'), "cardType": Session.get('cardType'),
"centerTextElement": Session.get('centerTextElement'), "centerTextElement": Session.get('centerTextElement'),
...@@ -307,7 +319,11 @@ export let CardIndex = class CardIndex { ...@@ -307,7 +319,11 @@ export let CardIndex = class CardIndex {
} }
static getActiveCardIndex (card_id) { static getActiveCardIndex (card_id) {
let cardIndex = this.getCardIndex(); if (Route.isTranscript()) {
return cardIndex.findIndex(item => item === card_id) + 1; return 0;
} else {
let cardIndex = this.getCardIndex();
return cardIndex.findIndex(item => item === card_id) + 1;
}
} }
}; };
...@@ -205,11 +205,13 @@ export let CardNavigation = class CardNavigation { ...@@ -205,11 +205,13 @@ export let CardNavigation = class CardNavigation {
localStorage.setItem(lastActiveCardString, JSON.stringify(lastActiveCard)); localStorage.setItem(lastActiveCardString, JSON.stringify(lastActiveCard));
} }
let cardset_id; let cardset_id;
if (Session.get('activeCard') === -1 || Session.get('activeCard') === undefined) { if (Session.get('activeCard') === -1 || Session.get('activeCard') === undefined || Route.isTranscript()) {
if (Route.isDemo()) { if (Route.isDemo()) {
Session.set('activeCardsetName', Cardsets.findOne({name: "DemoCardset", shuffled: true}).name); Session.set('activeCardsetName', Cardsets.findOne({name: "DemoCardset", shuffled: true}).name);
} else if (Route.isMakingOf()) { } else if (Route.isMakingOf()) {
Session.set('activeCardsetName', Cardsets.findOne({name: "MakingOfCardset", shuffled: true}).name); Session.set('activeCardsetName', Cardsets.findOne({name: "MakingOfCardset", shuffled: true}).name);
} else if (Route.isTranscript()) {
Session.set('activeCardsetName', "");
} else { } else {
Session.set('activeCardsetName', Cardsets.findOne({_id: Router.current().params._id}).name); Session.set('activeCardsetName', Cardsets.findOne({_id: Router.current().params._id}).name);
} }
......
...@@ -527,20 +527,27 @@ export let CardVisuals = class CardVisuals { ...@@ -527,20 +527,27 @@ export let CardVisuals = class CardVisuals {
let cardset_id = ""; let cardset_id = "";
let cardsetData; let cardsetData;
if (cards !== undefined) { if (cards !== undefined) {
for (let i = 0; i < cards.length; i++) { if (Route.isTranscript()) {
if (cardset_id !== cards[i].cardset_id) { cards[0].cardType = 2;
cardset_id = cards[i].cardset_id; cards[0].difficulty = 0;
cardsetData = Cardsets.findOne({_id: cardset_id}, { cards[0].cardset_id = -1;
fields: { return cards;
cardType: 1, } else {
difficulty: 1 for (let i = 0; i < cards.length; i++) {
} if (cardset_id !== cards[i].cardset_id) {
}); cardset_id = cards[i].cardset_id;
cardsetData = Cardsets.findOne({_id: cardset_id}, {
fields: {
cardType: 1,
difficulty: 1
}
});
}
cards[i].cardType = cardsetData.cardType;
cards[i].difficulty = cardsetData.difficulty;
} }
cards[i].cardType = cardsetData.cardType; return cards;
cards[i].difficulty = cardsetData.difficulty;
} }
return cards;
} else { } else {
return []; return [];
} }
......
...@@ -66,6 +66,22 @@ if (Meteor.isServer) { ...@@ -66,6 +66,22 @@ if (Meteor.isServer) {
this.ready(); this.ready();
} }
}); });
Meteor.publish("myTranscriptCards", function () {
if (this.userId) {
return Cards.find({owner: this.userId, cardType: 2, cardset_id: "-1"});
} else {
this.ready();
}
});
Meteor.publish("transcriptCard", function (card_id) {
if (UserPermissions.isAdmin()) {
return Cards.find({_id: card_id, cardType: 2, cardset_id: "-1"});
} else if (this.userId) {
return Cards.find({_id: card_id, owner: this.userId, cardType: 2, cardset_id: "-1"});
} else {
this.ready();
}
});
Meteor.publish("cardsetCards", function (cardset_id) { Meteor.publish("cardsetCards", function (cardset_id) {
let cardset = Cardsets.findOne({_id: cardset_id}, {fields: {_id: 1, owner: 1, cardGroups: 1, kind: 1}}); let cardset = Cardsets.findOne({_id: cardset_id}, {fields: {_id: 1, owner: 1, cardGroups: 1, kind: 1}});
if ((this.userId || ServerStyle.isLoginEnabled("guest")) && UserPermissions.isNotBlockedOrFirstLogin() && cardset !== undefined) { if ((this.userId || ServerStyle.isLoginEnabled("guest")) && UserPermissions.isNotBlockedOrFirstLogin() && cardset !== undefined) {
...@@ -193,6 +209,14 @@ var CardsSchema = new SimpleSchema({ ...@@ -193,6 +209,14 @@ var CardsSchema = new SimpleSchema({
type: Object, type: Object,
optional: true, optional: true,
blackbox: true blackbox: true
},
owner: {
type: String,