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