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,7 +922,9 @@ Meteor.methods({ ...@@ -921,7 +922,9 @@ 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) {
totalQuantity += cardGroupsCardset[0].quantity; if (!CardType.gotTranscriptBonus(cardGroupsCardset[0].cardType)) {
totalQuantity += cardGroupsCardset[0].quantity;
}
} }
} }
Cardsets.update(cardsets[i]._id, { Cardsets.update(cardsets[i]._id, {
......
...@@ -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}}
<div class="hidden-xs col-xs-12"> {{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
{{> cardNavigation}} <div class="hidden-xs col-xs-12">
</div> {{> cardNavigation}}
<div class="hidden-xs col-xs-12"> </div>
{{> flashcards cardset=this}} <div class="hidden-xs col-xs-12">
</div> {{> flashcards cardset=this}}
</div>
{{/unless}}
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/if}} {{/if}}
......
<template name="cardsetInfoBoxItemActiveLearners"> <template name="cardsetInfoBoxItemActiveLearners">
<tr> {{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
<td>{{_ "cardset.info.workload.normal.count"}}:</td> <tr>
<td>{{getActiveLearnerCount this}}</td> <td>{{_ "cardset.info.workload.normal.count"}}:</td>
</tr> <td>{{getActiveLearnerCount this}}</td>
</tr>
{{/unless}}
</template> </template>
<template name="cardsetInfoBoxItemCardCount"> <template name="cardsetInfoBoxItemCardCount">
<tr> {{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
<td>{{_ "cardset.info.quantity"}}:</td> <tr>
<td class="cardsetCardCount" data-count="{{this.quantity}}">{{this.quantity}}</td> <td>{{_ "cardset.info.quantity"}}:</td>
</tr> <td class="cardsetCardCount" data-count="{{this.quantity}}">{{this.quantity}}</td>
</tr>
{{/unless}}
</template> </template>
<template name="cardsetInfoBoxItemDifficulty"> <template name="cardsetInfoBoxItemDifficulty">
{{#unless isShuffledCardset this._id}} {{#unless isShuffledCardset this._id}}
<tr> {{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
<td>{{#if gotNotesForDifficultyLevel}}{{_ "difficultyNotes"}}{{else}}{{_ <tr>
"difficulty"}}{{/if}}: <td>{{#if gotNotesForDifficultyLevel}}{{_ "difficultyNotes"}}{{else}}{{_
</td> "difficulty"}}{{/if}}:
<td> </td>
{{getDifficultyName}} <td>
</td> {{getDifficultyName}}
</tr> </td>
</tr>
{{/unless}}
{{/unless}} {{/unless}}
</template> </template>
<template name="cardsetInfoBoxItemLicense"> <template name="cardsetInfoBoxItemLicense">
<tr> {{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
<td>{{_ "cardset.info.license"}}:</td> <tr>
<td> <td>{{_ "cardset.info.license"}}:</td>
{{#unless isShuffledCardset _id}} <td>
{{#if isActiveRoute "home"}} {{#unless isShuffledCardset _id}}
<span class="info_license showLicense">{{getLicense this._id this.license}}</span> {{#if isActiveRoute "home"}}
<span class="info_license showLicense">{{getLicense this._id this.license}}</span>
{{else}}
<a class="info_license showLicense" href="#" data-id="{{this._id}}" data-toggle="modal"
data-target="#showLicenseModal">{{getLicense this._id this.license}}</a>
{{/if}}
{{else}} {{else}}
<a class="info_license showLicense" href="#" data-id="{{this._id}}" data-toggle="modal" {{_ "cardset.info.shuffleLicense"}}
data-target="#showLicenseModal">{{getLicense this._id this.license}}</a> {{/unless}}
{{/if}} </td>
{{else}} </tr>
{{_ "cardset.info.shuffleLicense"}} {{/unless}}
{{/unless}}
</td>
</tr>
</template> </template>
<template name="cardsetInfoBoxItemPrice"> <template name="cardsetInfoBoxItemPrice">
{{#if hasAmount}} {{#if hasAmount}}
{{#unless canViewForFree}} {{#unless canViewForFree}}
<tr> {{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
<td>{{_ "cardset.info.amount"}}:</td> <tr>
<td>{{getPrice this.price}}</td> <td>{{_ "cardset.info.amount"}}:</td>
</tr> <td>{{getPrice this.price}}</td>
</tr>
{{/unless}}
{{/unless}} {{/unless}}
{{/if}} {{/if}}
</template> </template>
<template name="cardsetLabels"> <template name="cardsetLabels">
<span class="badge" title="{{_ "cardset.info.quantity"}}"> {{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
{{getCardsetCardCount}} {{#unless gotTranscriptBonusAndIsNotShuffled this.cardset_id}}
</span> <span class="badge" title="{{_ "cardset.info.quantity"}}">
{{getCardsetCardCount}}
</span>
{{/unless}}
{{/unless}}
{{{getKind this.kind 0}}} {{{getKind this.kind 0}}}
{{{getShuffleLabel this.shuffled}}} {{{getShuffleLabel this.shuffled}}}
{{{getBonusLabel this.learningActive}}} {{{getBonusLabel this.learningActive}}}
......
...@@ -2,13 +2,15 @@ ...@@ -2,13 +2,15 @@
{{#unless isShuffledCardset this._id}} {{#unless isShuffledCardset this._id}}
{{#if this.quantity}} {{#if this.quantity}}
{{#if isCardsetOwner _id}} {{#if isCardsetOwner _id}}
<div class="hidden-xs btn-group"> {{#unless gotTranscriptBonus _id}}
<button id="delete_cards" class="btn btn-sm btn-raised deleteAllCardsBtn" <div class="hidden-xs btn-group">
data-toggle="modal" <button id="delete_cards" class="btn btn-sm btn-raised deleteAllCardsBtn"
data-target="#deleteCardsModal" {{disableIfOffline}}> data-toggle="modal"
<span class="flex-content"><i class="fa fa-trash"></i>&nbsp;{{_ "deleteCards"}}</span> data-target="#deleteCardsModal" {{disableIfOffline}}>
</button> <span class="flex-content"><i class="fa fa-trash"></i>&nbsp;{{_ "deleteCards"}}</span>
</div> </button>
</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}}
<div class="hidden-xs btn-group"> {{#unless gotTranscriptBonusAndIsNotShuffled _id}}
<button id="selectLicense" class="btn btn-sm btn-raised selectLicenseBtn" <div class="hidden-xs btn-group">
data-toggle="modal" <button id="selectLicense" class="btn btn-sm btn-raised selectLicenseBtn"
data-target="#selectLicenseModal" {{disableIfOffline}}> data-toggle="modal"
<span class="flex-content"><i class="fa fa-cc"></i>&nbsp;{{_ "sidebar-nav.license"}}</span> data-target="#selectLicenseModal" {{disableIfOffline}}>
</button> <span class="flex-content"><i class="fa fa-cc"></i>&nbsp;{{_ "sidebar-nav.license"}}</span>
</div> </button>
</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}}
<div class="hidden-xs btn-group"> {{#unless gotTranscriptBonus this._id}}
<button id="exportCardsBtn" class="btn btn-sm btn-raised exportCardsBtn"><span class="flex-content">{{{getCardsetIcons false}}}<i <div class="hidden-xs btn-group">
class="fa fa-cloud-download"></i>&nbsp;{{_ "sidebar-nav.exportcard"}}</span> <button id="exportCardsBtn" class="btn btn-sm btn-raised exportCardsBtn"><span class="flex-content">{{{getCardsetIcons false}}}<i
</button> class="fa fa-cloud-download"></i>&nbsp;{{_ "sidebar-nav.exportcard"}}</span>
</div> </button>
</div>
{{/unless}}
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/unless}} {{/unless}}
......
...@@ -2,12 +2,14 @@ ...@@ -2,12 +2,14 @@
{{#unless isIOS}} {{#unless isIOS}}
{{#if isCardsetOwner _id}} {{#if isCardsetOwner _id}}
{{#unless isShuffledCardset _id}} {{#unless isShuffledCardset _id}}
<div class="hidden-xs btn-group"> {{#unless gotTranscriptBonus _id}}
<a href="#" id="importCardsBtn" class="btn btn-sm btn-raised importCardBtn" <div class="hidden-xs btn-group">
data-toggle="modal" <a href="#" id="importCardsBtn" class="btn btn-sm btn-raised importCardBtn"
data-target="#importModal"><span class="flex-content">{{{getCardsetIcons false}}}<i data-toggle="modal"
class="fa fa-cloud-upload"></i>&nbsp;{{_ "sidebar-nav.importcard"}}</span></a> data-target="#importModal"><span class="flex-content">{{{getCardsetIcons false}}}<i
</div> class="fa fa-cloud-upload"></i>&nbsp;{{_ "sidebar-nav.importcard"}}</span></a>
</div>
{{/unless}}
{{/unless}} {{/unless}}
{{/if}} {{/if}}
{{/unless}} {{/unless}}
......
<template name="cardsetNavigationNewCard"> <template name="cardsetNavigationNewCard">
{{#if isCardsetOwner _id}} {{#if isCardsetOwner _id}}
{{#unless isShuffledCardset _id}} {{#unless isShuffledCardset _id}}
<div class="hidden-xs btn-group"> {{#unless gotTranscriptBonus _id}}
<a type="button" id="newCardBtn" class="btn btn-sm btn-raised newCardBtn" <div class="hidden-xs btn-group">
href="{{pathFor 'newCard'}}" <a type="button" id="newCardBtn" class="btn btn-sm btn-raised newCardBtn"
{{disableIfOffline}}><span class="flex-content"><i class="fa fa-plus"></i>&nbsp;{{_ "sidebar-nav.createcard"}}</span> href="{{pathFor 'newCard'}}"
</a> {{disableIfOffline}}><span class="flex-content"><i class="fa fa-plus"></i>&nbsp;{{_ "sidebar-nav.createcard"}}</span>
</div> </a>
</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}}
<div class="btn-group"> {{#unless gotTranscriptBonusAndIsNotShuffled _id}}
<button class="btn btn-sm btn-raised presentationBtn startPresentation" {{disableIfOffline}}><span class="flex-content"><img <div class="btn-group">
src="/img/projector_white.png" class="projectorIconButton" <button class="btn btn-sm btn-raised presentationBtn startPresentation" {{disableIfOffline}}><span class="flex-content"><img
title="{{_ "presentation.create"}}">&nbsp;{{_ "presentation.create"}}</span> src="/img/projector_white.png" class="projectorIconButton"
</button> title="{{_ "presentation.create"}}">&nbsp;{{_ "presentation.create"}}</span>
<button type="button" </button>
class="hidden-xs btn btn-raised dropdown-toggle setCardAspectRatio" <button type="button"
data-toggle="dropdown" class="hidden-xs btn btn-raised dropdown-toggle setCardAspectRatio"
aria-haspopup="true" aria-expanded="false"> data-toggle="dropdown"
<span class="flex-content"><span class="caret"></span> aria-haspopup="true" aria-expanded="false">
<span class="sr-only"></span></span> <span class="flex-content"><span class="caret"></span>
</button> <span class="sr-only"></span></span>
<ul class="dropdown-menu aspect-ratio-menu"> </button>
{{> mainOverlayAspectRatioContent}} <ul class="dropdown-menu aspect-ratio-menu">
</ul> {{> mainOverlayAspectRatioContent}}
</div> </ul>
</div>
{{/unless}}
{{/if}} {{/if}}
</template> </template>
<template name="cardsetNavigationTranscripts"> <template name="cardsetNavigationTranscripts">
{{#if isCardsetOwnerAndLecturer _id}} {{#if isCardsetOwnerAndLecturer _id}}
{{#if gotTranscriptBonus _id}} {{#unless isShuffledCardset _id}}
<div class="hidden-xs btn-group"> {{#if gotTranscriptBonus _id}}
<a type="button" id="transcriptBonus" class="btn btn-sm btn-raised transcriptsBtn" <div class="hidden-xs btn-group">
{{disableIfOffline}}><span class="flex-content">{{{getNavigationIcon "transcript"}}}{{_ "transcriptForm.bonus.button"}}</span> <a type="button" id="transcriptBonus" class="btn btn-sm btn-raised transcriptsBtn"
</a> {{disableIfOffline}}><span class="flex-content">{{{getNavigationIcon "transcript"}}}{{_ "transcriptForm.bonus.button"}}</span>
</div> </a>
{{/if}} </div>
{{/if}}
{{/unless}}
{{/if}} {{/if}}
</template> </template>
\ No newline at end of file
...@@ -137,14 +137,12 @@ ...@@ -137,14 +137,12 @@
{{/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="{{_ "transcriptForm.bonus.form.button.list"}}">
"transcriptForm.bonus.form.button.list"}}"> <i class="fa fa-clipboard" data-id="{{this._id}}"></i>
<i class="fa fa-clipboard" data-id="{{this._id}}"></i> </a>
</a>
{{/if}}
{{/if}} {{/if}}
{{/if}} {{/if}}
{{#if isActiveRoute regex="shuffle"}} {{#if isActiveRoute regex="shuffle"}}
...@@ -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>
<span class="badge resultBadge cardsetBadge" data-id="{{this._id}}" title="{{_ "cardset.info.quantity"}}"> {{#unless gotTranscriptBonusAndIsNotShuffled this._id}}
{{this.quantity}} <span class="badge resultBadge cardsetBadge" data-id="{{this._id}}" title="{{_ "cardset.info.quantity"}}">
</span> {{this.quantity}}
</span>
{{/unless}}
</template> </template>
<template name="noFilterResults"> <template name="noFilterResults">
......
...@@ -155,13 +155,15 @@ ...@@ -155,13 +155,15 @@
{{> difficultyEditor}} {{> difficultyEditor}}
</div> </div>
{{/if}} {{/if}}
<br> {{#unless gotTranscriptBonus}}
<label id="setSortTypeyLabel" class="col-xs-12 control-label" for="setSortType">{{_ <br>
"cardsetForm.sortType.label"}}</label> <label id="setSortTypeyLabel" class="col-xs-12 control-label" for="setSortType">{{_
<div id="setSortType" class="col-xs-12 cardtext editorElement"> "cardsetForm.sortType.label"}}</label>
<label class="radio-inline"><input type="radio" id="sortDate" name="sortType" value="1">{{_ "cardsetForm.sortType.sortDate"}}</label> <div id="setSortType" class="col-xs-12 cardtext editorElement">
<label class="radio-inline"><input type="radio" id="sortContent" name="sortType" value="0">{{_ "cardsetForm.sortType.sortContent"}}</label> <label class="radio-inline"><input type="radio" id="sortDate" name="sortType" value="1">{{_ "cardsetForm.sortType.sortDate"}}</label>
</div> <label class="radio-inline"><input type="radio" id="sortContent" name="sortType" value="0">{{_ "cardsetForm.sortType.sortContent"}}</label>
</div>
{{/unless}}
{{/unless}} {{/unless}}
{{/unless}} {{/unless}}
</div> </div>
......
...@@ -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