Commit 7d96db64 authored by Curtis Adam's avatar Curtis Adam

Hide most of the navigation elements for the card type "Vorlesung"

parent 54bb4535
...@@ -1527,26 +1527,8 @@ ...@@ -1527,26 +1527,8 @@
} }
}, },
"cardType19": { "cardType19": {
"name": "Vorlesung mit Bonus-Mitschriften", "name": "Vorlesung",
"longName": "Vorlesung mit Bonus-Mitschriften: A | B | C | D | E | F", "longName": "Vorlesung mit Bonus-Mitschriften"
"content1": "A",
"content2": "B",
"content3": "C",
"content4": "D",
"content5": "E",
"content6": "F",
"placeholders": {
"subject": "Gib das Thema des Würfels an!",
"content1": "Vorne",
"content2": "Rechts",
"content3": "Hinten",
"content4": "Links",
"content5": "Oben",
"content6": "Unten"
},
"editorLabels": {
"subject": "Thema"
}
}, },
"tooltip": { "tooltip": {
"toggle3D": "3D-Ansicht aktivieren / deaktivieren", "toggle3D": "3D-Ansicht aktivieren / deaktivieren",
......
...@@ -1529,26 +1529,8 @@ ...@@ -1529,26 +1529,8 @@
} }
}, },
"cardType19": { "cardType19": {
"name": "Vorlesung mit Bonus-Mitschriften", "name": "Vorlesung",
"longName": "Vorlesung mit Bonus-Mitschriften: A | B | C | D | E | F", "longName": "Vorlesung mit Bonus-Mitschriften"
"content1": "A",
"content2": "B",
"content3": "C",
"content4": "D",
"content5": "E",
"content6": "F",
"placeholders": {
"subject": "Gib das Thema des Würfels an!",
"content1": "Vorne",
"content2": "Rechts",
"content3": "Hinten",
"content4": "Links",
"content5": "Oben",
"content6": "Unten"
},
"editorLabels": {
"subject": "Thema"
}
}, },
"tooltip": { "tooltip": {
"contrast": "Setze die Präsentation in den Kontrastmodus", "contrast": "Setze die Präsentation in den Kontrastmodus",
......
...@@ -24,6 +24,10 @@ export let CardType = class CardType { ...@@ -24,6 +24,10 @@ export let CardType = class CardType {
return config.cardTypesWithDifficultyLevel; return config.cardTypesWithDifficultyLevel;
} }
static getCardTypesWithTranscriptBonus () {
return config.cardTypesWithTranscriptBonus;
}
static isCardTypesWithSwapAnswerQuestionButton (cardType) { static isCardTypesWithSwapAnswerQuestionButton (cardType) {
return config.cardTypesWithSwapAnswerQuestionButton.includes(cardType); return config.cardTypesWithSwapAnswerQuestionButton.includes(cardType);
} }
......
...@@ -122,10 +122,17 @@ if (Meteor.isServer) { ...@@ -122,10 +122,17 @@ if (Meteor.isServer) {
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) {
let paidCardsets = Paid.findOne({user_id: this.userId, cardset_id: cardset._id}); let paidCardsets = Paid.findOne({user_id: this.userId, cardset_id: cardset._id});
let filteredCardGroups = [];
for (let i = 0; i < cardset.cardGroups; i++) {
let tempCardset = Cardsets.findOne({_id: cardset.cardGroups[i]}, {fields: {cardType: 1}});
if (!CardType.gotTranscriptBonus(tempCardset.cardType)) {
filteredCardGroups.push(cardset.cardGroups[i]);
}
}
let filterQuery = { let filterQuery = {
$or: [ $or: [
{cardset_id: cardset._id}, {cardset_id: cardset._id},
{cardset_id: {$in: cardset.cardGroups}} {cardset_id: {$in: filteredCardGroups}}
] ]
}; };
if (Roles.userIsInRole(this.userId, [ if (Roles.userIsInRole(this.userId, [
......
...@@ -853,6 +853,7 @@ Meteor.methods({ ...@@ -853,6 +853,7 @@ Meteor.methods({
cardType: cardType cardType: cardType
} }
}, {trimStrings: false}); }, {trimStrings: false});
Meteor.call('updateShuffledCardsetQuantity', cardset._id);
} else { } else {
throw new Meteor.Error("not-authorized"); throw new Meteor.Error("not-authorized");
} }
...@@ -921,9 +922,11 @@ Meteor.methods({ ...@@ -921,9 +922,11 @@ Meteor.methods({
for (let k = 0; k < cardsets[i].cardGroups.length; k++) { for (let k = 0; k < cardsets[i].cardGroups.length; k++) {
cardGroupsCardset = Cardsets.find(cardsets[i].cardGroups[k]).fetch(); cardGroupsCardset = Cardsets.find(cardsets[i].cardGroups[k]).fetch();
if (cardGroupsCardset.length > 0) { if (cardGroupsCardset.length > 0) {
if (!CardType.gotTranscriptBonus(cardGroupsCardset[0].cardType)) {
totalQuantity += cardGroupsCardset[0].quantity; totalQuantity += cardGroupsCardset[0].quantity;
} }
} }
}
Cardsets.update(cardsets[i]._id, { Cardsets.update(cardsets[i]._id, {
$set: { $set: {
quantity: totalQuantity, quantity: totalQuantity,
......
...@@ -982,4 +982,11 @@ Template.registerHelper("gotTranscriptBonus", function (cardset_id) { ...@@ -982,4 +982,11 @@ Template.registerHelper("gotTranscriptBonus", function (cardset_id) {
} }
}); });
Template.registerHelper("gotTranscriptBonusAndIsNotShuffled", function (cardset_id) {
let cardset = Cardsets.findOne({_id: cardset_id}, {fields: {_id: 1, cardGroups: 1, shuffled: 1, cardType: 1}});
if (cardset !== undefined && !cardset.shuffled) {
return CardType.gotTranscriptBonus(cardset.cardType);
}
});
Template.registerHelper('markdeep', markdeepHelper.getTemplate()); Template.registerHelper('markdeep', markdeepHelper.getTemplate());
...@@ -35,12 +35,14 @@ ...@@ -35,12 +35,14 @@
{{#if isActiveRoute regex='cardsetdetailsid|cardsetcard'}} {{#if isActiveRoute regex='cardsetdetailsid|cardsetcard'}}
{{#if isCardsetOwner this._id}} {{#if isCardsetOwner this._id}}
{{#if this.quantity}} {{#if this.quantity}}
{{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
<div class="hidden-xs col-xs-12"> <div class="hidden-xs col-xs-12">
{{> cardNavigation}} {{> cardNavigation}}
</div> </div>
<div class="hidden-xs col-xs-12"> <div class="hidden-xs col-xs-12">
{{> flashcards cardset=this}} {{> flashcards cardset=this}}
</div> </div>
{{/unless}}
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/if}} {{/if}}
......
<template name="cardsetInfoBoxItemActiveLearners"> <template name="cardsetInfoBoxItemActiveLearners">
{{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
<tr> <tr>
<td>{{_ "cardset.info.workload.normal.count"}}:</td> <td>{{_ "cardset.info.workload.normal.count"}}:</td>
<td>{{getActiveLearnerCount this}}</td> <td>{{getActiveLearnerCount this}}</td>
</tr> </tr>
{{/unless}}
</template> </template>
<template name="cardsetInfoBoxItemCardCount"> <template name="cardsetInfoBoxItemCardCount">
{{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
<tr> <tr>
<td>{{_ "cardset.info.quantity"}}:</td> <td>{{_ "cardset.info.quantity"}}:</td>
<td class="cardsetCardCount" data-count="{{this.quantity}}">{{this.quantity}}</td> <td class="cardsetCardCount" data-count="{{this.quantity}}">{{this.quantity}}</td>
</tr> </tr>
{{/unless}}
</template> </template>
<template name="cardsetInfoBoxItemDifficulty"> <template name="cardsetInfoBoxItemDifficulty">
{{#unless isShuffledCardset this._id}} {{#unless isShuffledCardset this._id}}
{{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
<tr> <tr>
<td>{{#if gotNotesForDifficultyLevel}}{{_ "difficultyNotes"}}{{else}}{{_ <td>{{#if gotNotesForDifficultyLevel}}{{_ "difficultyNotes"}}{{else}}{{_
"difficulty"}}{{/if}}: "difficulty"}}{{/if}}:
...@@ -9,4 +10,5 @@ ...@@ -9,4 +10,5 @@
</td> </td>
</tr> </tr>
{{/unless}} {{/unless}}
{{/unless}}
</template> </template>
<template name="cardsetInfoBoxItemLicense"> <template name="cardsetInfoBoxItemLicense">
{{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
<tr> <tr>
<td>{{_ "cardset.info.license"}}:</td> <td>{{_ "cardset.info.license"}}:</td>
<td> <td>
...@@ -14,4 +15,5 @@ ...@@ -14,4 +15,5 @@
{{/unless}} {{/unless}}
</td> </td>
</tr> </tr>
{{/unless}}
</template> </template>
<template name="cardsetInfoBoxItemPrice"> <template name="cardsetInfoBoxItemPrice">
{{#if hasAmount}} {{#if hasAmount}}
{{#unless canViewForFree}} {{#unless canViewForFree}}
{{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
<tr> <tr>
<td>{{_ "cardset.info.amount"}}:</td> <td>{{_ "cardset.info.amount"}}:</td>
<td>{{getPrice this.price}}</td> <td>{{getPrice this.price}}</td>
</tr> </tr>
{{/unless}} {{/unless}}
{{/unless}}
{{/if}} {{/if}}
</template> </template>
<template name="cardsetLabels"> <template name="cardsetLabels">
{{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
{{#unless gotTranscriptBonusAndIsNotShuffled this.cardset_id}}
<span class="badge" title="{{_ "cardset.info.quantity"}}"> <span class="badge" title="{{_ "cardset.info.quantity"}}">
{{getCardsetCardCount}} {{getCardsetCardCount}}
</span> </span>
{{/unless}}
{{/unless}}
{{{getKind this.kind 0}}} {{{getKind this.kind 0}}}
{{{getShuffleLabel this.shuffled}}} {{{getShuffleLabel this.shuffled}}}
{{{getBonusLabel this.learningActive}}} {{{getBonusLabel this.learningActive}}}
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
{{#unless isShuffledCardset this._id}} {{#unless isShuffledCardset this._id}}
{{#if this.quantity}} {{#if this.quantity}}
{{#if isCardsetOwner _id}} {{#if isCardsetOwner _id}}
{{#unless gotTranscriptBonus _id}}
<div class="hidden-xs btn-group"> <div class="hidden-xs btn-group">
<button id="delete_cards" class="btn btn-sm btn-raised deleteAllCardsBtn" <button id="delete_cards" class="btn btn-sm btn-raised deleteAllCardsBtn"
data-toggle="modal" data-toggle="modal"
...@@ -9,6 +10,7 @@ ...@@ -9,6 +10,7 @@
<span class="flex-content"><i class="fa fa-trash"></i>&nbsp;{{_ "deleteCards"}}</span> <span class="flex-content"><i class="fa fa-trash"></i>&nbsp;{{_ "deleteCards"}}</span>
</button> </button>
</div> </div>
{{/unless}}
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/unless}} {{/unless}}
......
<template name="cardsetNavigationEditLicense"> <template name="cardsetNavigationEditLicense">
{{#unless isShuffledCardset this._id}} {{#unless isShuffledCardset this._id}}
{{#if isCardsetOwner _id}} {{#if isCardsetOwner _id}}
{{#unless gotTranscriptBonusAndIsNotShuffled _id}}
<div class="hidden-xs btn-group"> <div class="hidden-xs btn-group">
<button id="selectLicense" class="btn btn-sm btn-raised selectLicenseBtn" <button id="selectLicense" class="btn btn-sm btn-raised selectLicenseBtn"
data-toggle="modal" data-toggle="modal"
...@@ -8,6 +9,7 @@ ...@@ -8,6 +9,7 @@
<span class="flex-content"><i class="fa fa-cc"></i>&nbsp;{{_ "sidebar-nav.license"}}</span> <span class="flex-content"><i class="fa fa-cc"></i>&nbsp;{{_ "sidebar-nav.license"}}</span>
</button> </button>
</div> </div>
{{/unless}}
{{/if}} {{/if}}
{{/unless}} {{/unless}}
</template> </template>
...@@ -3,11 +3,13 @@ ...@@ -3,11 +3,13 @@
{{#unless isShuffledCardset this._id}} {{#unless isShuffledCardset this._id}}
{{#if this.quantity}} {{#if this.quantity}}
{{#if isCardsetOwner _id}} {{#if isCardsetOwner _id}}
{{#unless gotTranscriptBonus this._id}}
<div class="hidden-xs btn-group"> <div class="hidden-xs btn-group">
<button id="exportCardsBtn" class="btn btn-sm btn-raised exportCardsBtn"><span class="flex-content">{{{getCardsetIcons false}}}<i <button id="exportCardsBtn" class="btn btn-sm btn-raised exportCardsBtn"><span class="flex-content">{{{getCardsetIcons false}}}<i
class="fa fa-cloud-download"></i>&nbsp;{{_ "sidebar-nav.exportcard"}}</span> class="fa fa-cloud-download"></i>&nbsp;{{_ "sidebar-nav.exportcard"}}</span>
</button> </button>
</div> </div>
{{/unless}}
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/unless}} {{/unless}}
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
{{#unless isIOS}} {{#unless isIOS}}
{{#if isCardsetOwner _id}} {{#if isCardsetOwner _id}}
{{#unless isShuffledCardset _id}} {{#unless isShuffledCardset _id}}
{{#unless gotTranscriptBonus _id}}
<div class="hidden-xs btn-group"> <div class="hidden-xs btn-group">
<a href="#" id="importCardsBtn" class="btn btn-sm btn-raised importCardBtn" <a href="#" id="importCardsBtn" class="btn btn-sm btn-raised importCardBtn"
data-toggle="modal" data-toggle="modal"
...@@ -9,6 +10,7 @@ ...@@ -9,6 +10,7 @@
class="fa fa-cloud-upload"></i>&nbsp;{{_ "sidebar-nav.importcard"}}</span></a> class="fa fa-cloud-upload"></i>&nbsp;{{_ "sidebar-nav.importcard"}}</span></a>
</div> </div>
{{/unless}} {{/unless}}
{{/unless}}
{{/if}} {{/if}}
{{/unless}} {{/unless}}
</template> </template>
<template name="cardsetNavigationNewCard"> <template name="cardsetNavigationNewCard">
{{#if isCardsetOwner _id}} {{#if isCardsetOwner _id}}
{{#unless isShuffledCardset _id}} {{#unless isShuffledCardset _id}}
{{#unless gotTranscriptBonus _id}}
<div class="hidden-xs btn-group"> <div class="hidden-xs btn-group">
<a type="button" id="newCardBtn" class="btn btn-sm btn-raised newCardBtn" <a type="button" id="newCardBtn" class="btn btn-sm btn-raised newCardBtn"
href="{{pathFor 'newCard'}}" href="{{pathFor 'newCard'}}"
...@@ -8,5 +9,6 @@ ...@@ -8,5 +9,6 @@
</a> </a>
</div> </div>
{{/unless}} {{/unless}}
{{/unless}}
{{/if}} {{/if}}
</template> </template>
\ No newline at end of file
<template name="cardsetNavigationPresentation"> <template name="cardsetNavigationPresentation">
{{#if this.quantity}} {{#if this.quantity}}
{{#unless gotTranscriptBonusAndIsNotShuffled _id}}
<div class="btn-group"> <div class="btn-group">
<button class="btn btn-sm btn-raised presentationBtn startPresentation" {{disableIfOffline}}><span class="flex-content"><img <button class="btn btn-sm btn-raised presentationBtn startPresentation" {{disableIfOffline}}><span class="flex-content"><img
src="/img/projector_white.png" class="projectorIconButton" src="/img/projector_white.png" class="projectorIconButton"
...@@ -16,5 +17,6 @@ ...@@ -16,5 +17,6 @@
{{> mainOverlayAspectRatioContent}} {{> mainOverlayAspectRatioContent}}
</ul> </ul>
</div> </div>
{{/unless}}
{{/if}} {{/if}}
</template> </template>
<template name="cardsetNavigationTranscripts"> <template name="cardsetNavigationTranscripts">
{{#if isCardsetOwnerAndLecturer _id}} {{#if isCardsetOwnerAndLecturer _id}}
{{#unless isShuffledCardset _id}}
{{#if gotTranscriptBonus _id}} {{#if gotTranscriptBonus _id}}
<div class="hidden-xs btn-group"> <div class="hidden-xs btn-group">
<a type="button" id="transcriptBonus" class="btn btn-sm btn-raised transcriptsBtn" <a type="button" id="transcriptBonus" class="btn btn-sm btn-raised transcriptsBtn"
...@@ -7,5 +8,6 @@ ...@@ -7,5 +8,6 @@
</a> </a>
</div> </div>
{{/if}} {{/if}}
{{/unless}}
{{/if}} {{/if}}
</template> </template>
\ No newline at end of file
...@@ -137,7 +137,6 @@ ...@@ -137,7 +137,6 @@
{{/if}} {{/if}}
{{/if}} {{/if}}
{{#if gotTranscriptBonus this._id}} {{#if gotTranscriptBonus this._id}}
{{#if gotBonus this.transcriptBonus.enabled}}
{{#if isCardsetOwner this._id}} {{#if isCardsetOwner this._id}}
<a class="resultNavigationElement bonusTranscriptProgress" data-id="{{this._id}}" <a class="resultNavigationElement bonusTranscriptProgress" data-id="{{this._id}}"
title="{{_ title="{{_
...@@ -146,7 +145,6 @@ ...@@ -146,7 +145,6 @@
</a> </a>
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/if}}
{{#if isActiveRoute regex="shuffle"}} {{#if isActiveRoute regex="shuffle"}}
{{#if inShuffleSelection this._id}} {{#if inShuffleSelection this._id}}
<a class="btn btn-xs btn-raised btn-danger shuffleButton removeShuffleCardset" <a class="btn btn-xs btn-raised btn-danger shuffleButton removeShuffleCardset"
...@@ -266,9 +264,11 @@ ...@@ -266,9 +264,11 @@
class="col-xs-12 resultName" data-id="{{this._id}}"> class="col-xs-12 resultName" data-id="{{this._id}}">
{{this.name}} {{this.name}}
</a> </a>
{{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
<span class="badge resultBadge cardsetBadge" data-id="{{this._id}}" title="{{_ "cardset.info.quantity"}}"> <span class="badge resultBadge cardsetBadge" data-id="{{this._id}}" title="{{_ "cardset.info.quantity"}}">
{{this.quantity}} {{this.quantity}}
</span> </span>
{{/unless}}
</template> </template>
<template name="noFilterResults"> <template name="noFilterResults">
......
...@@ -155,6 +155,7 @@ ...@@ -155,6 +155,7 @@
{{> difficultyEditor}} {{> difficultyEditor}}
</div> </div>
{{/if}} {{/if}}
{{#unless gotTranscriptBonus}}
<br> <br>
<label id="setSortTypeyLabel" class="col-xs-12 control-label" for="setSortType">{{_ <label id="setSortTypeyLabel" class="col-xs-12 control-label" for="setSortType">{{_
"cardsetForm.sortType.label"}}</label> "cardsetForm.sortType.label"}}</label>
...@@ -164,6 +165,7 @@ ...@@ -164,6 +165,7 @@
</div> </div>
{{/unless}} {{/unless}}
{{/unless}} {{/unless}}
{{/unless}}
</div> </div>
<div class="form-group setdetails description module"> <div class="form-group setdetails description module">
{{> markdeepNavigation}} {{> markdeepNavigation}}
......
...@@ -300,6 +300,9 @@ Template.cardsetFormContent.helpers({ ...@@ -300,6 +300,9 @@ Template.cardsetFormContent.helpers({
}, },
gotNotesForDifficultyLevel: function () { gotNotesForDifficultyLevel: function () {
return CardType.gotNotesForDifficultyLevel(Session.get('cardType')); return CardType.gotNotesForDifficultyLevel(Session.get('cardType'));
},
gotTranscriptBonus: function () {
return CardType.gotTranscriptBonus(Session.get('cardType'));
} }
}); });
......
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