Commit 2ae528cd authored by Curtis Adam's avatar Curtis Adam

Add a transcript filter for the transcript statistics view

parent 1a60cc56
......@@ -92,7 +92,7 @@ export let Filter = class Filter {
}
}
static setActiveFilter (content, contentType = undefined) {
static setActiveFilter (content, contentType = undefined, maxItemCounter = config.itemStartingValue) {
let filter = content;
if (contentType !== undefined) {
filter = this.getActiveFilter();
......@@ -178,7 +178,7 @@ export let Filter = class Filter {
Session.set('transcriptsBonusCardsetFilter', filter);
break;
}
this.resetInfiniteBar();
this.setMaxItemCounter(maxItemCounter);
if (FilterNavigation.isDisplayWordcloudActive(FilterNavigation.getRouteId())) {
WordcloudCanvas.draw();
}
......@@ -332,6 +332,10 @@ export let Filter = class Filter {
Session.set('maxItemsCounter', config.itemStartingValue);
}
static setMaxItemCounter (size) {
Session.set('maxItemsCounter', size);
}
static incrementMaxItemCounter () {
let newCounter = Session.get('maxItemsCounter');
newCounter += config.itemIncrementValue;
......@@ -390,10 +394,6 @@ export let Filter = class Filter {
this.setActiveFilter(filter);
}
static resetInfiniteBar () {
this.resetMaxItemCounter();
}
static resetFilters () {
Session.set('maxItemsCounter', config.itemStartingValue);
Session.set('poolFilter', undefined);
......
......@@ -5,7 +5,7 @@
<thead>
<tr>
<th colspan="2">
{{getAuthorName this._id}}
<a href="" class="filterAuthorTranscripts cards-filter-element" data-id="{{this._id}}">{{getAuthorName this._id}}</a>
</th>
</tr>
</thead>
......
import "./statistics.html";
import {TranscriptBonus, TranscriptBonusList} from "../../../../api/transcriptBonus";
import {Template} from "meteor/templating";
import {Filter} from "../../../../api/filter";
import {FilterNavigation} from "../../../../api/filterNavigation";
import {Session} from "meteor/session";
/*
* ############################################################################
......@@ -8,6 +11,15 @@ import {Template} from "meteor/templating";
* ############################################################################
*/
Template.cardsetTranscriptStatistics.events({
'click .filterAuthorTranscripts': function (event) {
Session.set('transcriptViewingMode', 2);
Filter.setActiveFilter($(event.target).data('id'), "author", 30);
FilterNavigation.showDropdown();
}
});
Template.cardsetTranscriptStatistics.helpers({
transcriptBonusUser: function () {
let transcriptBonusUsers = _.uniq(TranscriptBonus.find({cardset_id: Router.current().params._id}, {
......
......@@ -5,6 +5,7 @@ import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import {Meteor} from "meteor/meteor";
import {Bonus} from "../../../api/bonus";
import {Filter} from "../../../api/filter";
import {BertAlertVisuals} from "../../../api/bertAlertVisuals";
Session.setDefault('transcriptViewingMode', 0);
......@@ -15,6 +16,10 @@ Session.setDefault('transcriptViewingMode', 0);
* ############################################################################
*/
Template.cardsetTranscript.onCreated(function () {
Filter.resetActiveFilter();
});
Template.cardsetTranscript.helpers({
isViewActive: function (id) {
return Session.get('transcriptViewingMode') === id;
......
......@@ -34,10 +34,10 @@ Template.mainNavigationTopItemDisplayModeButton.helpers({
Template.mainNavigationTopItemDisplayModeButton.events({
'click .displayModeBtn': function () {
if (Session.get('filterDisplayWordcloud')) {
Filter.resetInfiniteBar();
Filter.resetMaxItemCounter();
WordcloudCanvas.disableWordcloud();
} else {
Filter.resetInfiniteBar();
Filter.resetMaxItemCounter();
WordcloudCanvas.enableWordcloud();
}
}
......
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