Commit b059b48c authored by Curtis Adam's avatar Curtis Adam

Add a filter option for the new lecturer authorized label

parent da2cb46c
......@@ -1245,6 +1245,9 @@
"wordcloudTrue": "von der Redaktion in die Themen-Wolke aufgenommen",
"wordcloudFalse": "von Studierenden für die Community freigegeben",
"wordcloudEveryting": "Alle",
"lecturerAuthorized": "Prüfung",
"lecturerAuthorizedTrue": "Zur Prüfungsvorbereitung geeignet",
"lecturerAuthorizedEveryting": "Alle",
"from": "Ab",
"noResults": "Keine Kartei oder Repetitorium ausgewählt oder Filtern liefert kein Ergebnis.",
"sort": "Sortieren ",
......
......@@ -1247,6 +1247,9 @@
"wordcloudTrue": "von der Redaktion in die Themen-Wolke aufgenommen",
"wordcloudFalse": "von Studierenden für die Community freigegeben",
"wordcloudEveryting": "Alle",
"lecturerAuthorized": "Prüfung",
"lecturerAuthorizedTrue": "Zur Prüfungsvorbereitung geeignet",
"lecturerAuthorizedEveryting": "Alle",
"from": "Ab",
"noResults": "Keine Kartei oder Repetitorium ausgewählt oder Filtern liefert kein Ergebnis.",
"sort": "Sortieren ",
......
......@@ -115,6 +115,9 @@ export let Filter = class Filter {
case "wordcloud":
filter.wordcloud = content;
break;
case "lecturerAuthorized":
filter.lecturerAuthorized = content;
break;
case "noBonus":
filter.learningActive = undefined;
filter.learningEnd = undefined;
......@@ -286,6 +289,9 @@ export let Filter = class Filter {
if (FilterNavigation.gotWordCloudFilter(FilterNavigation.getRouteId()) && activeFilter.wordcloud !== undefined) {
query.wordcloud = activeFilter.wordcloud;
}
if (FilterNavigation.gotLecturerAuthorizedFilter(FilterNavigation.getRouteId()) && activeFilter.lecturerAuthorized !== undefined) {
query.lecturerAuthorized = activeFilter.lecturerAuthorized;
}
if (FilterNavigation.gotKindFilter(FilterNavigation.getRouteId()) && activeFilter.kind !== undefined) {
query.kind = {$in: activeFilter.kind};
}
......
......@@ -45,6 +45,10 @@ export let FilterNavigation = class FilterNavigation {
return config.filtersWithWordcloud.includes(filterType);
}
static gotLecturerAuthorizedFilter (filterType) {
return config.filtersWithLecturerAuthorized.includes(filterType);
}
static gotKindFilter (filterType) {
return config.filtersWithKind.includes(filterType);
}
......
......@@ -31,6 +31,7 @@ let filtersWithCourse = [];
let filtersWithModule = [];
let filtersWithBonus = [0, 2, 3, 4, 5, 6, 7];
let filtersWithWordcloud = [0, 1, 2, 4, 5, 6, 7];
let filtersWithLecturerAuthorized = [0, 1, 2, 4, 5, 6, 7];
let filtersWithKind = [0, 1, 2, 3, 4, 5, 6, 7];
let filtersWithPersonalKind = [1, 3, 4, 5, 6, 7];
let filtersWithFreeKind = [0, 1, 2, 3, 4, 5, 6, 7];
......@@ -56,6 +57,7 @@ module.exports = {
filtersWithModule,
filtersWithBonus,
filtersWithWordcloud,
filtersWithLecturerAuthorized,
filtersWithKind,
filtersWithPersonalKind,
filtersWithFreeKind,
......
......@@ -116,6 +116,10 @@ Template.registerHelper('gotWordcloudFilter', function () {
return FilterNavigation.gotWordCloudFilter(FilterNavigation.getRouteId());
});
Template.registerHelper('gotLecturerAuthorizedFilter', function () {
return FilterNavigation.gotLecturerAuthorizedFilter(FilterNavigation.getRouteId());
});
Template.registerHelper('gotKindFilter', function () {
return FilterNavigation.gotKindFilter(FilterNavigation.getRouteId());
});
......
<template name="filterItemFilterLecturerAuthorized">
<li class="dropdown cards-filter-element">
<a href="#" class="dropdown-toggle lecturerAuthorizedBtn lecturerAuthorizedFilter cards-filter-element"
data-toggle="dropdown"
role="button"
aria-haspopup="true" aria-expanded="false">
{{_ "filter-pool.lecturerAuthorized"}}
{{#if hasLecturerAuthorizedFilter}}
<i class="fa fa-filter navigationFilterIcon cards-filter-element"></i>
{{/if}}
</a>
<ul class="dropdown-menu cards-filter-element">
<li class="cards-filter-element">
<a href="#" class="noFilterLecturerAuthorized cards-filter-element">{{_
"filter-pool.lecturerAuthorizedEveryting"}}</a>
</li>
{{#if gotLecturerAuthorizedCardsets}}
<li class="cards-filter-element">
<a href="#" class="filterLecturerAuthorized cards-filter-element"
data-id="true">{{_ "filter-pool.lecturerAuthorizedTrue"}}
{{#if resultsFilterLecturerAuthorized true}}
<i class="fa fa-filter navigationFilterIcon cards-filter-element"></i>
{{/if}}
</a>
</li>
{{/if}}
</ul>
</li>
</template>
import "./filterLecturerAuthorized.html";
import {Template} from "meteor/templating";
import {Filter} from "../../../../api/filter";
import {Cardsets} from "../../../../api/cardsets";
/*
* ############################################################################
* filterItemFilterLecturerAuthorized
* ############################################################################
*/
Template.filterItemFilterLecturerAuthorized.helpers({
hasLecturerAuthorizedFilter: function () {
return Filter.getFilterQuery().lecturerAuthorized !== undefined;
},
resultsFilterLecturerAuthorized: function (lecturerAuthorized) {
return Filter.getFilterQuery().lecturerAuthorized === lecturerAuthorized;
},
gotLecturerAuthorizedCardsets: function () {
let query = Filter.getFilterQuery();
query.lecturerAuthorized = true;
return Cardsets.findOne(query);
},
gotNotLecturerAuthorizedCardsets: function () {
let query = Filter.getFilterQuery();
query.lecturerAuthorized = false;
return Cardsets.findOne(query);
}
});
Template.filterItemFilterLecturerAuthorized.events({
'click .noFilterLecturerAuthorized': function () {
Filter.setActiveFilter(undefined, "lecturerAuthorized");
},
'click .filterLecturerAuthorized': function (event) {
Filter.setActiveFilter($(event.target).data('id'), "lecturerAuthorized");
}
});
......@@ -23,6 +23,9 @@
{{#if gotWordcloudFilter}}
{{> filterItemFilterWordcloud}}
{{/if}}
{{#if gotLecturerAuthorizedFilter}}
{{> filterItemFilterLecturerAuthorized}}
{{/if}}
{{#if gotBonusFilter}}
{{> filterItemFilterBonus}}
{{/if}}
......@@ -48,6 +51,9 @@
{{#if gotWordcloudFilter}}
{{> filterItemFilterWordcloud}}
{{/if}}
{{#if gotLecturerAuthorizedFilter}}
{{> filterItemFilterLecturerAuthorized}}
{{/if}}
{{#if gotBonusFilter}}
{{> filterItemFilterBonus}}
{{/if}}
......
......@@ -14,6 +14,7 @@ import './item/filterAuthor.js';
import './item/filterCardType.js';
import './item/filterDifficulty.js';
import './item/filterBonus.js';
import './item/filterLecturerAuthorized.js';
import './item/filterWordcloud.js';
import './item/filterKind.js';
......
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