...
 
Commits (5)
......@@ -3,19 +3,19 @@
@import '../imports/ui/impressum/impressum.scss';
@import '../imports/ui/welcome/welcome.scss';
@import '../imports/ui/wordcloud/wordcloud.scss';
@import '../imports/ui/cardsets/cardsets.scss';
@import '../imports/ui/filter/index/index.scss';
@import '../imports/ui/cardset/cardset.scss';
@import '../imports/ui/cardsets/resultItem';
@import '../imports/ui/filter/index/item/cardset';
@import '../imports/ui/card/card.scss';
@import '../imports/ui/card/sidebar/sidebar.scss';
@import '../imports/ui/card/sidebar/item/zoomText';
@import '../imports/ui/card/navigation/navigation.scss';
@import '../imports/ui/markdeepEditor/content/content';
@import '../imports/ui/markdeepEditor/navigation/navigation';
@import '../imports/ui/filter/filter.scss';
@import '../imports/ui/filter/navigation/navigation.scss';
@import '../imports/ui/forms/bonusForm.scss';
@import '../imports/ui/forms/cardsetForm.scss';
@import '../imports/ui/profile/profile.scss';
@import '../imports/ui/profile/profile';
@import '../imports/ui/learn/learn.scss';
@import '../imports/ui/learn/progress.scss';
@import '../imports/ui/pomodoroTimer/pomodoroTimer.scss';
......
import {Meteor} from "meteor/meteor";
export let CardsetNavigation = class CardsetNavigation {
/**
* Creates a web push subscription for the current device.
......
import {Leitner, Workload, Wozniak} from "./learned";
import {Cards} from "./cards";
import {WebPushSubscriptions} from "./webPushSubscriptions";
export let DatabaseIndex = class DatabaseIndex {
static initialize () {
Leitner._ensureIndex({user_id: 1, cardset_id: 1, original_cardset_id: 1});
Wozniak._ensureIndex({user_id: 1, cardset_id: 1});
Workload._ensureIndex({cardset_id: 1, user_id: 1});
Cards._ensureIndex({cardset_id: 1, subject: 1});
WebPushSubscriptions._ensureIndex({userId: 1});
}
};
......@@ -187,7 +187,7 @@ Router.route('datenschutz', {
Router.route('/alldecks', {
name: 'alldecks',
template: 'cardsets',
template: 'filterIndex',
data: function () {
Session.set('helpFilter', undefined);
Session.set('activeRouteTitle', TAPi18n.__('navbar-collapse.alldecks', {}, Session.get('activeLanguage')));
......@@ -204,7 +204,7 @@ Router.route('/alldecks', {
Router.route('/create', {
name: 'create',
template: 'cardsets',
template: 'filterIndex',
data: function () {
Session.set('helpFilter', "create");
switch (Cardsets.find({owner: Meteor.userId()}).count()) {
......@@ -230,7 +230,7 @@ Router.route('/create', {
Router.route('/repetitorium', {
name: 'repetitorium',
template: 'cardsets',
template: 'filterIndex',
data: function () {
Session.set('helpFilter', "repetitorium");
Session.set('activeRouteTitle', TAPi18n.__('navbar-collapse.course', {}, Session.get('activeLanguage')));
......@@ -247,8 +247,7 @@ Router.route('/repetitorium', {
Router.route('/learn', {
name: 'learn',
template: 'cardsets',
loadingTemplate: 'cardsets',
template: 'filterIndex',
subscriptions: function () {
return [Meteor.subscribe('userWorkload', this.params._id), Meteor.subscribe('userLeitner'), Meteor.subscribe('userWozniak')];
},
......@@ -268,7 +267,7 @@ Router.route('/learn', {
Router.route('/shuffle', {
name: 'shuffle',
template: 'cardsets',
template: 'filterIndex',
data: function () {
Session.set('helpFilter', "shuffle");
Session.set('isNewCardset', true);
......@@ -332,7 +331,7 @@ Router.route('/cardset/:_id/card/:card_id', {
Router.route('/cardset/:_id/editshuffle', {
name: 'editshuffle',
template: 'shuffle',
template: 'filterIndexShuffle',
data: function () {
Session.set('helpFilter', "shuffle");
Filter.resetMaxItemCounter();
......@@ -446,7 +445,7 @@ Router.route('/cardset/:_id/editcard/:card_id', {
Router.route('/pool', {
name: 'pool',
template: 'pool',
template: 'filterIndex',
data: function () {
Session.set('helpFilter', "pool");
Session.set('activeRouteTitle', TAPi18n.__('navbar-collapse.pool', {}, Session.get('activeLanguage')));
......
......@@ -4,13 +4,13 @@ import {Meteor} from "meteor/meteor";
import {Template} from "meteor/templating";
import {Notifications} from "../../api/notifications.js";
import "./admin.html";
import "./admin_dashboard/admin_dashboard.js";
import "./admin_users/admin_users.js";
import "./admin_learningStatistics/admin_learningStatistics.js";
import "./admin_apiAccess/admin_apiAccess.js";
import "./admin_notifications/admin_notifications.js";
import "./admin_university/admin_university.js";
import "./admin_settings/admin_settings.js";
import "./dashboard/dashboard.js";
import "./users/index.js";
import "./learningStatistics/learningStatistics.js";
import "./apiAccess/apiAccess.js";
import "./notifications/notifications.js";
import "./university/university.js";
import "./settings/settings.js";
import "../learn/progress.js";
......
......@@ -4,7 +4,7 @@ import {Meteor} from "meteor/meteor";
import {Session} from "meteor/session";
import {APIAccess} from "../../../api/cardsetAPI.js";
import {Cardsets} from "../../../api/cardsets.js";
import "./admin_apiAccess.html";
import "./apiAccess.html";
import {Template} from "meteor/templating";
/*
......
//------------------------ IMPORTS
import {Template} from "meteor/templating";
import "./admin_dashboard.html";
import "./dashboard.html";
Template.admin_dashboard.helpers({
totalCardsets: function () {
......
//------------------------ IMPORTS
import "./admin_learningStatistics.html";
import "./learningStatistics.html";
......@@ -3,7 +3,7 @@ import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import {Cardsets} from "../../../api/cardsets.js";
import {Notifications} from "../../../api/notifications.js";
import "./admin_notifications.html";
import "./notifications.html";
/*
* ############################################################################
......
import {Meteor} from "meteor/meteor";
import {AdminSettings} from "../../../api/adminSettings.js";
import "./admin_settings.html";
import "./settings.html";
Template.admin_settings.events({
'click #enableWordcloudPomodoro': function () {
......
import "./admin_university.html";
import "./university.html";
import {Meteor} from "meteor/meteor";
import {CollegesCourses} from "../../../api/colleges_courses.js";
import {Session} from "meteor/session";
......
......@@ -4,8 +4,8 @@ import {Meteor} from "meteor/meteor";
import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import {Cardsets} from "../../../api/cardsets.js";
import "./admin_users.html";
import "./admin_user.js";
import "./index.html";
import "./user.js";
import DOMPurify from 'dompurify';
import {DOMPurifyConfig} from "../../../api/dompurify.js";
......
......@@ -4,7 +4,7 @@ import {Meteor} from "meteor/meteor";
import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import {Cardsets} from "../../../api/cardsets.js";
import "./admin_user.html";
import "./user.html";
/*
......
......@@ -5,6 +5,7 @@ import {Session} from "meteor/session";
import {Cardsets} from "../../api/cardsets.js";
import {CardNavigation} from "../../api/cardNavigation";
import {BertAlertVisuals} from "../../api/bertAlertVisuals";
import {CardsetNavigation} from "../../api/cardsetNavigation";
import {Bonus} from "../../api/bonus";
import "../card/card.js";
import "../learn/learn.js";
......@@ -77,7 +78,7 @@ Template.cardset.rendered = function () {
Template.cardset.helpers({
'selectedForLearning': function () {
if (Session.get('selectingCardsetToLearn')) {
CardNavigation.addToLeitner(this._id);
CardsetNavigation.addToLeitner(this._id);
Meteor.call("addWozniakCards", this._id);
Session.set("selectingCardsetToLearn", false);
BertAlertVisuals.displayBertAlert(TAPi18n.__('cardset.alert.addedToWorkload'), 'success', 'growl-top-left');
......
//------------------------ IMPORTS
import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import "../../modal/license.js";
import "./license.html";
/*
......
<template name="showLicense">
<div class="modal fade" id="showLicenseModal" tabindex="-1" role="dialog"
aria-labelledby="showLicenseTitle">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 id="showLicenseTitle" class="modal-title">{{_ "sidebar-nav.poolLicense"}}: {{getTopic}}
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</h4>
</div>
<div class="modal-body">
<div class="form-horizontal">
<div class="form-group">
<div id=cc-description class="col-md-12">
{{#if getLicenseCount}}
{{#if getLicenseType 'by'}}
<img class="col-md-2" src="/img/by.large.png" alt="Namensnennung"/>
<p class="col-md-10">{{_ "modal-dialog.by-desc"}}</p>
{{/if}}
{{#if getLicenseType 'nc'}}
<img class="col-md-2" src="/img/nc-eu.large.png" alt="Nicht kommerziell"/>
<p class="col-md-10">{{_ "modal-dialog.nc-desc"}}</p>
{{/if}}
{{#if getLicenseType 'nd'}}
<img class="col-md-2" src="/img/nd.large.png" alt="Keine Bearbeitung"/>
<p class="col-md-10">{{_ "modal-dialog.nd-desc"}}</p>
{{/if}}
{{#if getLicenseType 'sa'}}
<img class="col-md-2" src="/img/sa.large.png"
alt="Weitergabe unter gleichen Bedingungen"/>
<p class="col-md-10">{{_ "modal-dialog.sa-desc"}}</p>
{{/if}}
{{else}}
<img class="col-md-2" src="/img/zero.large.png" alt="Keine Lizenz"/>
<p class="col-md-10">{{_ "modal-dialog.zero-desc"}}</p>
{{/if}}
</div>
</div>
</div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</template>
//------------------------ IMPORTS
import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import {Cardsets} from "../../../../api/cardsets.js";
import "./license.html";
/*
* ############################################################################
* showLicense
* ############################################################################
*/
Template.showLicense.helpers({
getTopic: function () {
if (Session.get('selectedCardset')) {
let item = Cardsets.findOne({_id: Session.get('selectedCardset')});
return item.name;
}
},
getLicenseCount: function () {
if (Session.get('selectedCardset')) {
let item = Cardsets.findOne({_id: Session.get('selectedCardset')});
return (item.license.length > 0);
}
},
getLicenseType: function (type) {
if (Session.get('selectedCardset')) {
let item = Cardsets.findOne({_id: Session.get('selectedCardset')});
return (item.license.includes(type));
}
}
});
......@@ -71,52 +71,3 @@
</div>
<!-- /.modal -->
</template>
<template name="showLicense">
<div class="modal fade" id="showLicenseModal" tabindex="-1" role="dialog"
aria-labelledby="showLicenseTitle">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 id="showLicenseTitle" class="modal-title">{{_ "sidebar-nav.poolLicense"}} {{_ "set-list.topic"}}
: {{getTopic}}
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</h4>
</div>
<div class="modal-body">
<div class="form-horizontal">
<div class="form-group">
<div id=cc-description class="col-md-12">
{{#if getLicenseCount}}
{{#if getLicenseType 'by'}}
<img class="col-md-2" src="/img/by.large.png" alt="Namensnennung"/>
<p class="col-md-10">{{_ "modal-dialog.by-desc"}}</p>
{{/if}}
{{#if getLicenseType 'nc'}}
<img class="col-md-2" src="/img/nc-eu.large.png" alt="Nicht kommerziell"/>
<p class="col-md-10">{{_ "modal-dialog.nc-desc"}}</p>
{{/if}}
{{#if getLicenseType 'nd'}}
<img class="col-md-2" src="/img/nd.large.png" alt="Keine Bearbeitung"/>
<p class="col-md-10">{{_ "modal-dialog.nd-desc"}}</p>
{{/if}}
{{#if getLicenseType 'sa'}}
<img class="col-md-2" src="/img/sa.large.png"
alt="Weitergabe unter gleichen Bedingungen"/>
<p class="col-md-10">{{_ "modal-dialog.sa-desc"}}</p>
{{/if}}
{{else}}
<img class="col-md-2" src="/img/zero.large.png" alt="Keine Lizenz"/>
<p class="col-md-10">{{_ "modal-dialog.zero-desc"}}</p>
{{/if}}
</div>
</div>
</div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</template>
//------------------------ IMPORTS
import {Meteor} from "meteor/meteor";
import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import {FilterNavigation} from "../../api/filterNavigation";
import "./filter.html";
import './item/displayModeButton.js';
import './item/resetButton.js';
import './item/sortResults.js';
import './item/filterAuthor.js';
import './item/filterCardType.js';
import './item/filterDifficulty.js';
import './item/filterBonus.js';
import './item/filterWordcloud.js';
import './item/filterKind.js';
import {Filter} from "../../api/filter";
import {Cardsets} from "../../api/cardsets";
Meteor.subscribe("cardsets");
/*
* ############################################################################
* filterNavigation
* ############################################################################
*/
Template.filterNavigation.helpers({
gotResetButton: function () {
return FilterNavigation.gotResetButton(FilterNavigation.getRouteId());
},
gotDisplayModeButton: function () {
return FilterNavigation.gotDisplayModeButton(FilterNavigation.getRouteId());
},
gotSortButton: function () {
return FilterNavigation.gotSortButton(FilterNavigation.getRouteId());
},
gotAuthorFilter: function () {
return FilterNavigation.gotAuthorFilter(FilterNavigation.getRouteId());
},
gotCardTypeFilter: function () {
return FilterNavigation.gotCardTypeFilter(FilterNavigation.getRouteId());
},
gotDifficultyFilter: function () {
return FilterNavigation.gotDifficultyFilter(FilterNavigation.getRouteId());
},
gotBonusFilter: function () {
return FilterNavigation.gotBonusFilter(FilterNavigation.getRouteId());
},
gotWordcloudFilter: function () {
return FilterNavigation.gotWordCloudFilter(FilterNavigation.getRouteId());
},
gotKindFilter: function () {
return FilterNavigation.gotKindFilter(FilterNavigation.getRouteId());
},
selectingCardsetToLearn: function () {
return Session.get('selectingCardsetToLearn');
}
});
Template.filterNavigation.greeting = function () {
return Session.get('authors');
};
Template.filterNavigation.events({
'click .resetFilters': function () {
Filter.resetActiveFilter();
}
});
Template.infiniteScroll.helpers({
moreResults: function () {
return Filter.getMaxItemCounter() < Cardsets.find(Filter.getFilterQuery()).count();
},
getCurrentResults: function () {
return TAPi18n.__('infinite-scroll.remainingCardsets', {
current: Filter.getMaxItemCounter(),
total: Cardsets.find(Filter.getFilterQuery()).count()
});
}
});
/*
* ############################################################################
* infiniteScroll
* ############################################################################
*/
Template.infiniteScroll.events({
'click .showMoreResults': function () {
Filter.incrementMaxItemCounter();
}
});
import "./index/index.js";
import "./navigation/navigation.js";
<template name="cardsets">
<template name="filterIndex">
{{#if isInRole 'firstLogin'}}
{{> first_login_content_only}}
{{else}}
......@@ -12,28 +12,52 @@
{{#if isActiveRoute regex='alldecks|create'}}
{{> cardsetDeleteForm}}
{{> cardsetForm}}
{{> create}}
{{> filterIndexCreate}}
{{/if}}
{{#if isActiveRoute regex='repetitorium'}}
{{> cardsetDeleteForm}}
{{> cardsetForm}}
{{> repetitorium}}
{{> filterIndexRepetitorium}}
{{/if}}
{{#if isActiveRoute 'learn'}}
{{> learn}}
{{> filterIndexWorkload}}
{{/if}}
{{#if isActiveRoute 'shuffle'}}
{{> cardsetForm}}
{{> shuffle}}
{{> filterIndexShuffle}}
{{/if}}
{{#if isActiveRoute 'pool'}}
{{> filterIndexPool}}
{{/if}}
{{/if}}
{{/if}}
</template>
<template name="shuffle">
<template name="filterIndexPool">
{{#if getDecks 0}}
{{> filterNavigation}}
{{#if displayWordcloud}}
{{> wordcloud}}
{{else}}
{{#if getDecks 1}}
{{#each getDecks 2}}
{{> filterIndexItemCardset extendContext 'index' @index}}
{{/each}}
{{> infiniteScroll}}
{{else}}
{{> noFilterResults}}
{{/if}}
{{/if}}
{{else}}
{{> noResults}}
{{/if}}
</template>
<template name="filterIndexShuffle">
{{#if canShuffle}}
<div class="container" id="set-list-region">
<div class="bs-callout bs-callout-info selectionInfo">
......@@ -57,7 +81,7 @@
{{#if shuffleList 1}}
{{#each shuffleList 2}}
{{#unless isActiveCardset}}
{{> cardsetCourseIterationResultRow extendContext 'index' @index}}
{{> filterIndexItemCardset extendContext 'index' @index}}
{{/unless}}
{{/each}}
{{> infiniteScroll}}
......@@ -68,7 +92,7 @@
{{/if}}
</template>
<template name="create">
<template name="filterIndexCreate">
<div class="container" id="set-list-region">
{{#if isActiveRoute 'create'}}
<button id="newCardSet" type="button"
......@@ -87,7 +111,7 @@
{{else}}
{{#if cardsetList 1}}
{{#each cardsetList 2}}
{{> cardsetCourseIterationResultRow extendContext 'index' @index}}
{{> filterIndexItemCardset extendContext 'index' @index}}
{{/each}}
{{> infiniteScroll}}
{{else}}
......@@ -100,7 +124,7 @@
</div>
</template>
<template name="repetitorium">
<template name="filterIndexRepetitorium">
<div class="container" id="set-list-region">
{{#unless selectingCardsetToLearn}}
{{#if canCreateContent}}
......@@ -119,7 +143,7 @@
{{else}}
{{#if cardsetList 1}}
{{#each cardsetList 2}}
{{> cardsetCourseIterationResultRow extendContext 'index' @index}}
{{> filterIndexItemCardset extendContext 'index' @index}}
{{/each}}
{{> infiniteScroll}}
{{else}}
......@@ -132,7 +156,7 @@
</div>
</template>
<template name="learn">
<template name="filterIndexWorkload">
{{> selectModeForm}}
{{> cardsetsConfirmLearnForm}}
<div id="learn-list-region" class="container">
......@@ -144,7 +168,7 @@
{{> filterNavigation}}
{{#if learnList 1}}
{{#each learnList 2}}
{{> cardsetCourseIterationResultRow extendContext 'index' @index}}
{{> filterIndexItemCardset extendContext 'index' @index}}
{{/each}}
{{> infiniteScroll}}
{{else}}
......@@ -155,88 +179,3 @@
{{/if}}
</div>
</template>
<template name="selectModeForm">
<div class="modal fade" id="selectModeToLearnModal" tabindex="-1" role="dialog"
aria-labelledby="selectModeToLearnTitle">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 id="selectModeToLearnTitle" class="modal-title">{{_ "learn"}}
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</h4>
</div>
<div class="modal-body">
<hr/>
<button id="learnBox"
class="btn btn-raised btn-success learn" {{disableIfOffline}} data-dismiss="modal">{{_
"learnfile"}}</button>
<button id="learnMemo"
class="btn btn-raised btn-success memo pull-right" {{disableIfOffline}}
data-dismiss="modal">{{_
"memo"}}</button>
</div>
<br>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</template>
<template name="cardsetsConfirmLearnForm">
<div class="modal fade" id="bonusFormModal" tabindex="-1" role="dialog"
aria-labelledby="bonusFormModalTitle">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 id="bonusFormModalTitle" class="modal-title">{{_ "confirm-form-learn.title"}}
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</h4>
</div>
<div class="modal-body">
<p>{{_ "confirm-form-learn.text"}}</p>
<br/>
<hr/>
<button id="learnDelete" class="btn btn-danger btn-raised btn-setDelete" {{disableIfOffline}}>{{_
"confirm-form-learn.title"}}</button>
<button id="learnCancel" class="btn btn-raised pull-right" data-dismiss="modal">{{_
"modal-dialog.cancel"}}</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</template>
<template name="cardsetDeleteForm">
<div class="modal fade" id="confirmDeleteCardsetModal" tabindex="-1" role="dialog"
aria-labelledby="confirmDeleteCardsetModalTitle">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 id="confirmDeleteCardsetModalTitle" class="modal-title">{{_
"cardset.confirm-form-delete.title"}}
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</h4>
</div>
<div class="modal-body">
<p>{{_ "cardset.confirm-form-delete.text"}}</p>
<hr/>
<button id="deleteCardset"
class="btn btn-danger btn-raised btn-setDelete" {{disableIfOffline}}>{{_
"cardset.confirm-form-delete.title"}}</button>
<button id="cancelDelete" class="btn btn-raised pull-right" data-dismiss="modal">{{_
"modal-dialog.cancel"}}</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</template>
......@@ -3,16 +3,19 @@
import {Meteor} from "meteor/meteor";
import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import {Cardsets} from "../../api/cardsets.js";
import "../cardset/cardset.js";
import "./cardsets.html";
import {Filter} from "../../api/filter";
import {Route} from "../../api/route";
import {BertAlertVisuals} from "../../api/bertAlertVisuals";
import {Workload} from "../../api/learned";
import {SweetAlertMessages} from "../../api/sweetAlert";
import {Profile} from "../../api/profile";
import {FilterNavigation} from "../../api/filterNavigation";
import {Cardsets} from "../../../api/cardsets.js";
import {Filter} from "../../../api/filter";
import {Route} from "../../../api/route";
import {BertAlertVisuals} from "../../../api/bertAlertVisuals";
import {SweetAlertMessages} from "../../../api/sweetAlert";
import {Profile} from "../../../api/profile";
import {FilterNavigation} from "../../../api/filterNavigation";
import {firstLoginBertAlert} from "../../../startup/client/routes";
import "./item/cardset.js";
import "../modal/deleteWorkload.js";
import "../modal/deleteCardset.js";
import "../modal/selectWorkload.js";
import "./index.html";
Session.setDefault('cardsetId', undefined);
Session.set('moduleActive', true);
......@@ -21,11 +24,50 @@ Meteor.subscribe("cardsets");
/*
* ############################################################################
* create
* filterIndexPool
* ############################################################################
*/
Template.create.helpers({
Template.filterIndexPool.helpers({
getDecks: function (resultType) {
let query = {};
if (resultType !== 0) {
query = Filter.getFilterQuery();
}
switch (resultType) {
case 0:
case 1:
return Cardsets.find(query, {
sort: Filter.getSortFilter(),
limit: Filter.getMaxItemCounter()
}).count();
case 2:
return Cardsets.find(query, {sort: Filter.getSortFilter(), limit: Filter.getMaxItemCounter()});
}
},
displayWordcloud: function () {
return FilterNavigation.gotDisplayModeButton(FilterNavigation.getRouteId()) && Session.get('filterDisplayWordcloud');
}
});
Template.filterIndexPool.events({
'click #cancelSelection': function () {
Session.set('selectingCardsetToLearn', false);
Router.go('learn');
}
});
Template.filterIndexPool.onRendered(function () {
firstLoginBertAlert();
});
/*
* ############################################################################
* filterIndexCreate
* ############################################################################
*/
Template.filterIndexCreate.helpers({
cardsetList: function (returnType) {
let query = {};
if (returnType !== 0) {
......@@ -54,7 +96,7 @@ Template.create.helpers({
}
});
Template.create.events({
Template.filterIndexCreate.events({
'click #newCardSet': function () {
if (Profile.isCompleted()) {
Session.set('isNewCardset', true);
......@@ -103,17 +145,17 @@ Template.create.events({
}
});
Template.create.onDestroyed(function () {
Template.filterIndexCreate.onDestroyed(function () {
Filter.resetMaxItemCounter();
});
/*
* ############################################################################
* repetitorium
* filterIndexRepetitorium
* ############################################################################
*/
Template.repetitorium.helpers({
Template.filterIndexRepetitorium.helpers({
cardsetList: function (returnType) {
let query = {};
if (returnType !== 0) {
......@@ -142,7 +184,7 @@ Template.repetitorium.helpers({
}
});
Template.repetitorium.events({
Template.filterIndexRepetitorium.events({
'click #newRepetitorium': function () {
if (Profile.isCompleted()) {
Session.set('isNewCardset', true);
......@@ -153,21 +195,21 @@ Template.repetitorium.events({
}
});
Template.repetitorium.onDestroyed(function () {
Template.filterIndexRepetitorium.onDestroyed(function () {
Filter.resetMaxItemCounter();
});
/*
* ############################################################################
* learn
* filterIndexWorkload
* ############################################################################
*/
Template.learn.onCreated(function () {
Template.filterIndexWorkload.onCreated(function () {
Filter.updateWorkloadFilter();
});
Template.learn.helpers({
Template.filterIndexWorkload.helpers({
learnList: function (returnType) {
let query = {};
if (returnType !== 0) {
......@@ -186,7 +228,7 @@ Template.learn.helpers({
}
});
Template.learn.events({
Template.filterIndexWorkload.events({
'click .deleteLearned': function (event) {
Session.set('cardsetId', $(event.target).data('id'));
},
......@@ -200,17 +242,17 @@ Template.learn.events({
}
});
Template.learn.onDestroyed(function () {
Template.filterIndexWorkload.onDestroyed(function () {
Filter.resetMaxItemCounter();
});
/*
* ############################################################################
* shuffle
* filterIndexShuffle
* ############################################################################
*/
Template.shuffle.events({
Template.filterIndexShuffle.events({
'click #updateShuffledCardset': function () {
let removedCardsets = $(Cardsets.findOne({_id: Router.current().params._id}).cardGroups).not(Session.get("ShuffledCardsets")).get();
Meteor.call("updateShuffleGroups", Router.current().params._id, Session.get("ShuffledCardsets"), removedCardsets, function (error, result) {
......@@ -232,7 +274,7 @@ Template.shuffle.events({
}
});
Template.shuffle.helpers({
Template.filterIndexShuffle.helpers({
selectShuffleCardset: function () {
return Session.get('selectingCardsetToLearn');
},
......@@ -286,7 +328,7 @@ Template.shuffle.helpers({
}
});
Template.shuffle.onCreated(function () {
Template.filterIndexShuffle.onCreated(function () {
if (Route.isEditShuffle()) {
Session.set("ShuffledCardsets", Cardsets.findOne({_id: Router.current().params._id}).cardGroups);
} else {
......@@ -297,11 +339,11 @@ Template.shuffle.onCreated(function () {
/*
* ############################################################################
* cardsets
* filterIndex
* ############################################################################
*/
Template.cardsets.onCreated(function () {
Template.filterIndex.onCreated(function () {
Session.set('ratingsLoaded', false);
Meteor.subscribe('ratings', function () {
Session.set('ratingsLoaded', true);
......@@ -309,85 +351,9 @@ Template.cardsets.onCreated(function () {
Session.set("selectingCardsetToLearn", false);
});
Template.cardsets.events({
Template.filterIndex.events({
'click #cancelSelection': function () {
Session.set('selectingCardsetToLearn', false);
Router.go('learn');
}
});
/*
* ############################################################################
* cardsetsConfirmLearnForm
* ############################################################################
*/
Template.cardsetsConfirmLearnForm.events({
'click #learnDelete': function () {
$('#bonusFormModal').on('hidden.bs.modal', function () {
let workload = Workload.findOne({user_id: Meteor.userId(), cardset_id: Session.get('cardsetId')}, {fields: {_id: 1, 'leitner.bonus': 1}});
if (workload !== undefined && workload.leitner.bonus === true) {
Meteor.call("leaveBonus", Session.get('cardsetId'), function (error, result) {
if (result) {
Filter.updateWorkloadFilter();
}
});
} else {
Meteor.call("deleteLeitner", Session.get('cardsetId'), function (error, result) {
if (result) {
Filter.updateWorkloadFilter();
}
});
}
Meteor.call("deleteWozniak", Session.get('cardsetId'), function (error, result) {
if (result) {
Filter.updateWorkloadFilter();
}
});
}).modal('hide');
}
});
/*
* ############################################################################
* selectModeForm
* ############################################################################
*/
Template.selectModeForm.events({
'click #learnBox': function () {
$('#selectModeToLearnModal').on('hidden.bs.modal', function () {
Session.set("workloadFullscreenMode", true);
Router.go('box', {
_id: Session.get("activeCardset")._id
});
}).modal('hide');
},
'click #learnMemo': function () {
$('#selectModeToLearnModal').on('hidden.bs.modal', function () {
Session.set("workloadFullscreenMode", true);
Router.go('memo', {
_id: Session.get("activeCardset")._id
});
}).modal('hide');
}
});
/*
* ############################################################################
* cardsetDeleteForm
* ############################################################################
*/
Template.cardsetDeleteForm.events({
'click #deleteCardset': function () {
Meteor.call("deleteCardset", Session.get('cardsetId'), (error) => {
if (error) {
BertAlertVisuals.displayBertAlert(TAPi18n.__('cardset.confirm-form-delete.failure'), "danger", 'growl-top-left');
} else {
BertAlertVisuals.displayBertAlert(TAPi18n.__('cardset.confirm-form-delete.success'), "success", 'growl-top-left');
}
$('#confirmDeleteCardsetModal').modal('hide');
});
}
});
<template name="cardsetCourseIterationResultRow">
<template name="filterIndexItemCardset">
{{#if firstItem this.index}}
{{#if isActiveRoute regex="learn"}}
<div class="hidden-xs col-sm-2 resultsHeader">
......
......@@ -3,12 +3,12 @@
import {Meteor} from "meteor/meteor";
import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import {Cardsets} from "../../api/cardsets.js";
import {Leitner, Wozniak} from "../../api/learned.js";
import "../cardset/cardset.js";
import "../cardsets/resultItem.html";
import {CardType} from "../../api/cardTypes";
import {BertAlertVisuals} from "../../api/bertAlertVisuals";
import {Cardsets} from "../../../../api/cardsets.js";
import {Leitner, Wozniak} from "../../../../api/learned.js";
import {CardType} from "../../../../api/cardTypes";
import {BertAlertVisuals} from "../../../../api/bertAlertVisuals";
import "../../../cardset/cardset.js";
import "./cardset.html";
Session.setDefault('cardsetId', undefined);
Session.set('moduleActive', true);
......@@ -36,11 +36,11 @@ function getWozniakCount(cardset) {
/*
* ############################################################################
* cardsetCourseIterationResultRow
* filterIndexItemCardset
* ############################################################################
*/
Template.cardsetCourseIterationResultRow.events({
Template.filterIndexItemCardset.events({
"click .addShuffleCardset": function (event) {
let array = Session.get("ShuffledCardsets");
let arrayExclude = Session.get("ShuffledCardsetsExclude");
......@@ -163,7 +163,7 @@ Template.cardsetCourseIterationResultRow.events({
}
});
Template.cardsetCourseIterationResultRow.helpers({
Template.filterIndexItemCardset.helpers({
inShuffleSelection: function (cardset_id) {
if (Session.get("ShuffledCardsets").includes(cardset_id) || Session.get("ShuffledCardsetsExclude").includes(cardset_id)) {
return true;
......
<template name="cardsetDeleteForm">
<div class="modal fade" id="confirmDeleteCardsetModal" tabindex="-1" role="dialog"
aria-labelledby="confirmDeleteCardsetModalTitle">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 id="confirmDeleteCardsetModalTitle" class="modal-title">{{_
"cardset.confirm-form-delete.title"}}
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</h4>
</div>
<div class="modal-body">
<p>{{_ "cardset.confirm-form-delete.text"}}</p>
<hr/>
<button id="deleteCardset"
class="btn btn-danger btn-raised btn-setDelete" {{disableIfOffline}}>{{_
"cardset.confirm-form-delete.title"}}</button>
<button id="cancelDelete" class="btn btn-raised pull-right" data-dismiss="modal">{{_
"modal-dialog.cancel"}}</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</template>
//------------------------ IMPORTS
import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import "./deleteCardset.html";
import {BertAlertVisuals} from "../../../api/bertAlertVisuals";
/*
* ############################################################################
* cardsetDeleteForm
* ############################################################################
*/
Template.cardsetDeleteForm.events({
'click #deleteCardset': function () {
Meteor.call("deleteCardset", Session.get('cardsetId'), (error) => {
if (error) {
BertAlertVisuals.displayBertAlert(TAPi18n.__('cardset.confirm-form-delete.failure'), "danger", 'growl-top-left');
} else {
BertAlertVisuals.displayBertAlert(TAPi18n.__('cardset.confirm-form-delete.success'), "success", 'growl-top-left');
}
$('#confirmDeleteCardsetModal').modal('hide');
});
}
});
<template name="cardsetsConfirmLearnForm">
<div class="modal fade" id="bonusFormModal" tabindex="-1" role="dialog"
aria-labelledby="bonusFormModalTitle">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 id="bonusFormModalTitle" class="modal-title">{{_ "confirm-form-learn.title"}}
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</h4>
</div>
<div class="modal-body">
<p>{{_ "confirm-form-learn.text"}}</p>
<br/>
<hr/>
<button id="learnDelete" class="btn btn-danger btn-raised btn-setDelete" {{disableIfOffline}}>{{_
"confirm-form-learn.title"}}</button>
<button id="learnCancel" class="btn btn-raised pull-right" data-dismiss="modal">{{_
"modal-dialog.cancel"}}</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</template>
//------------------------ IMPORTS
import {Meteor} from "meteor/meteor";
import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import {Workload} from "../../../api/learned";
import {Filter} from "../../../api/filter";
import "./deleteWorkload.html";
/*
* ############################################################################
* cardsetsConfirmLearnForm
* ############################################################################
*/
Template.cardsetsConfirmLearnForm.events({
'click #learnDelete': function () {
$('#bonusFormModal').on('hidden.bs.modal', function () {
let workload = Workload.findOne({user_id: Meteor.userId(), cardset_id: Session.get('cardsetId')}, {fields: {_id: 1, 'leitner.bonus': 1}});
if (workload !== undefined && workload.leitner.bonus === true) {
Meteor.call("leaveBonus", Session.get('cardsetId'), function (error, result) {
if (result) {
Filter.updateWorkloadFilter();
}
});
} else {
Meteor.call("deleteLeitner", Session.get('cardsetId'), function (error, result) {
if (result) {
Filter.updateWorkloadFilter();
}
});
}
Meteor.call("deleteWozniak", Session.get('cardsetId'), function (error, result) {
if (result) {
Filter.updateWorkloadFilter();
}
});
}).modal('hide');
}
});
<template name="selectModeForm">
<div class="modal fade" id="selectModeToLearnModal" tabindex="-1" role="dialog"
aria-labelledby="selectModeToLearnTitle">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 id="selectModeToLearnTitle" class="modal-title">{{_ "learn"}}
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</h4>
</div>
<div class="modal-body">
<hr/>
<button id="learnBox"
class="btn btn-raised btn-success learn" {{disableIfOffline}} data-dismiss="modal">{{_
"learnfile"}}</button>
<button id="learnMemo"
class="btn btn-raised btn-success memo pull-right" {{disableIfOffline}}
data-dismiss="modal">{{_
"memo"}}</button>
</div>
<br>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</template>
//------------------------ IMPORTS
import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import "./selectWorkload.html";
/*
* ############################################################################
* selectModeForm
* ############################################################################
*/
Template.selectModeForm.events({
'click #learnBox': function () {
$('#selectModeToLearnModal').on('hidden.bs.modal', function () {
Session.set("workloadFullscreenMode", true);
Router.go('box', {
_id: Session.get("activeCardset")._id
});
}).modal('hide');
},
'click #learnMemo': function () {
$('#selectModeToLearnModal').on('hidden.bs.modal', function () {
Session.set("workloadFullscreenMode", true);
Router.go('memo', {
_id: Session.get("activeCardset")._id
});
}).modal('hide');
}
});
import "./displayModeButton.html";
import {Session} from "meteor/session";
import {Filter} from "../../../api/filter";
import {Route} from "../../../api/route";
import {WordcloudCanvas} from "../../../api/wordcloudCanvas";
import ResizeSensor from "../../../../client/resize_sensor/ResizeSensor";
import {Filter} from "../../../../api/filter";
import {Route} from "../../../../api/route";
import {WordcloudCanvas} from "../../../../api/wordcloudCanvas";
import ResizeSensor from "../../../../../client/resize_sensor/ResizeSensor";
Session.setDefault('filterDisplayWordcloud', false);
/*
......
import "./filterAuthor.html";
import {Template} from "meteor/templating";
import {Meteor} from "meteor/meteor";
import {Filter} from "../../../api/filter";
import {Cardsets} from "../../../api/cardsets";
import {getAuthorName} from "../../../api/userdata";
import {Filter} from "../../../../api/filter";
import {Cardsets} from "../../../../api/cardsets";
import {getAuthorName} from "../../../../api/userdata";
/*
* ############################################################################
......
import "./filterBonus.html";
import {Template} from "meteor/templating";
import {Filter} from "../../../api/filter";
import {Cardsets} from "../../../api/cardsets";
import {Filter} from "../../../../api/filter";
import {Cardsets} from "../../../../api/cardsets";
/*
* ############################################################################
......
import "./filterCardType.html";
import {Template} from "meteor/templating";
import {Filter} from "../../../api/filter";
import {Filter} from "../../../../api/filter";
/*
* ############################################################################
......
import "./filterDifficulty.html";
import {Template} from "meteor/templating";
import {Filter} from "../../../api/filter";
import {Cardsets} from "../../../api/cardsets";
import {Filter} from "../../../../api/filter";
import {Cardsets} from "../../../../api/cardsets";
/*
* ############################################################################
......
import "./filterKind.html";
import {Template} from "meteor/templating";
import {FilterNavigation} from "../../../api/filterNavigation";
import {Filter} from "../../../api/filter";
import {FilterNavigation} from "../../../../api/filterNavigation";
import {Filter} from "../../../../api/filter";
/*
* ############################################################################
......
import "./filterWordcloud.html";
import {Template} from "meteor/templating";
import {Filter} from "../../../api/filter";
import {Cardsets} from "../../../api/cardsets";
import {Filter} from "../../../../api/filter";
import {Cardsets} from "../../../../api/cardsets";
/*
* ############################################################################
......
import "./sortResults.html";
import {Template} from "meteor/templating";
import {Filter} from "../../../api/filter";
import {Filter} from "../../../../api/filter";
/*
* ############################################################################
......
//------------------------ IMPORTS
import {Meteor} from "meteor/meteor";
import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import {FilterNavigation} from "../../../api/filterNavigation";
import {Filter} from "../../../api/filter";
import {Cardsets} from "../../../api/cardsets";
import "./navigation.html";
import './item/displayModeButton.js';
import './item/resetButton.js';
import './item/sortResults.js';
import './item/filterAuthor.js';
import './item/filterCardType.js';
import './item/filterDifficulty.js';
import './item/filterBonus.js';
import './item/filterWordcloud.js';
import './item/filterKind.js';
Meteor.subscribe("cardsets");
/*
* ############################################################################
* filterNavigation
* ############################################################################
*/
Template.filterNavigation.helpers({
gotResetButton: function () {
return FilterNavigation.gotResetButton(FilterNavigation.getRouteId());
},
gotDisplayModeButton: function () {
return FilterNavigation.gotDisplayModeButton(FilterNavigation.getRouteId());
},
gotSortButton: function () {
return FilterNavigation.gotSortButton(FilterNavigation.getRouteId());
},
gotAuthorFilter: function () {
return FilterNavigation.gotAuthorFilter(FilterNavigation.getRouteId());
},
gotCardTypeFilter: function () {
return FilterNavigation.gotCardTypeFilter(FilterNavigation.getRouteId());
},
gotDifficultyFilter: function () {
return FilterNavigation.gotDifficultyFilter(FilterNavigation.getRouteId());
},
gotBonusFilter: function () {
return FilterNavigation.gotBonusFilter(FilterNavigation.getRouteId());
},
gotWordcloudFilter: function () {
return FilterNavigation.gotWordCloudFilter(FilterNavigation.getRouteId());
},
gotKindFilter: function () {
return FilterNavigation.gotKindFilter(FilterNavigation.getRouteId());
},
selectingCardsetToLearn: function () {
return Session.get('selectingCardsetToLearn');
}
});
Template.filterNavigation.greeting = function () {