Commit 3c218af5 authored by Curtis Adam's avatar Curtis Adam

Display the create transcript button for the my bonus statistics view

parent 7ebbad15
...@@ -178,6 +178,18 @@ if (Meteor.isServer) { ...@@ -178,6 +178,18 @@ if (Meteor.isServer) {
this.ready(); this.ready();
} }
}); });
Meteor.publish("cardsetTranscriptMyBonus", function (card_id) {
if (this.userId) {
let card = TranscriptBonus.findOne({card_id: card_id}, {fields: {cardset_id: 1, _id: 1, owner: 1}});
if (UserPermissions.isAdmin() || UserPermissions.isOwner(card.owner)) {
return Cardsets.find({_id: card.cardset_id});
} else {
this.ready();
}
} else {
this.ready();
}
});
Meteor.publish("cardsetTranscriptBonusReview", function (cardset_id) { Meteor.publish("cardsetTranscriptBonusReview", function (cardset_id) {
if (this.userId) { if (this.userId) {
let cardset = Cardsets.findOne({_id: cardset_id}, {fields: {_id: 1, owner: 1}}); let cardset = Cardsets.findOne({_id: cardset_id}, {fields: {_id: 1, owner: 1}});
......
...@@ -256,7 +256,7 @@ Template.registerHelper('isMyBonusTranscriptsRoute', function () { ...@@ -256,7 +256,7 @@ Template.registerHelper('isMyBonusTranscriptsRoute', function () {
Template.registerHelper('isBonusTranscriptsRoute', function () { Template.registerHelper('isBonusTranscriptsRoute', function () {
return Route.isMyBonusTranscripts() || Route.isTranscriptBonus() || Route.isPresentationTranscriptBonusCardset() || Route.isPresentationTranscriptReview(); return Route.isMyBonusTranscripts() || Route.isTranscriptBonus() || Route.isPresentationTranscriptBonusCardset() || Route.isPresentationTranscriptBonus() || Route.isPresentationTranscriptReview();
}); });
Template.registerHelper('isPersonalTranscriptsRoute', function () { Template.registerHelper('isPersonalTranscriptsRoute', function () {
......
...@@ -764,7 +764,7 @@ Router.route('/presentation/transcripts/bonus/:card_id', { ...@@ -764,7 +764,7 @@ Router.route('/presentation/transcripts/bonus/:card_id', {
name: 'presentationTranscriptBonus', name: 'presentationTranscriptBonus',
template: 'presentation', template: 'presentation',
subscriptions: function () { subscriptions: function () {
return [Meteor.subscribe('transcriptCard', this.params.card_id), Meteor.subscribe('myTranscriptBonus'), Meteor.subscribe('cardsetTranscriptBonus', this.params._id)]; return [Meteor.subscribe('transcriptCard', this.params.card_id), Meteor.subscribe('myTranscriptBonus'), Meteor.subscribe('cardsetTranscriptMyBonus', this.params.card_id)];
}, },
data: function () { data: function () {
if (ServerStyle.gotTranscriptsEnabled()) { if (ServerStyle.gotTranscriptsEnabled()) {
......
...@@ -5,4 +5,9 @@ ...@@ -5,4 +5,9 @@
{{#each transcriptBonus}} {{#each transcriptBonus}}
{{> cardsetIndexTranscriptStatisticsItemInfo}} {{> cardsetIndexTranscriptStatisticsItemInfo}}
{{/each}} {{/each}}
{{#if isMyBonusTranscriptsRoute}}
{{#unless transcriptBonus}}
{{> noResults}}
{{/unless}}
{{/if}}
</template> </template>
...@@ -35,8 +35,9 @@ ...@@ -35,8 +35,9 @@
{{#if isActiveRoute regex='transcriptsBonus'}} {{#if isActiveRoute regex='transcriptsBonus'}}
{{> cardsetIndexTranscriptNavigation}} {{> cardsetIndexTranscriptNavigation}}
{{#if isViewActive 1}} {{#if isViewActive 1}}
<br> <div class="col-xs-12">
<br> {{> filterItemCreateTranscriptButton}}
</div>
{{> cardsetIndexTranscriptStatistics}} {{> cardsetIndexTranscriptStatistics}}
{{else}} {{else}}
{{> filterIndexTranscripts}} {{> filterIndexTranscripts}}
...@@ -77,7 +78,9 @@ ...@@ -77,7 +78,9 @@
{{> deleteTranscriptForm}} {{> deleteTranscriptForm}}
<span class="filter-index-buttons empty-button-placeholder"> <span class="filter-index-buttons empty-button-placeholder">
{{#if isTranscriptRoute}} {{#if isTranscriptRoute}}
{{> filterItemCreateTranscriptButton}} <div class="col-xs-12">
{{> filterItemCreateTranscriptButton}}
</div>
{{/if}} {{/if}}
{{#if isCardsetTranscriptBonusRoute}} {{#if isCardsetTranscriptBonusRoute}}
{{> cardsetIndexTranscriptSubmissionsItemReviewButton}} {{> cardsetIndexTranscriptSubmissionsItemReviewButton}}
......
...@@ -115,9 +115,6 @@ Template.filterIndex.helpers({ ...@@ -115,9 +115,6 @@ Template.filterIndex.helpers({
} }
}); });
Template.filterIndex.onCreated(function () {
Session.set('transcriptViewingMode', 2);
});
/* /*
* ############################################################################ * ############################################################################
......
...@@ -2,6 +2,7 @@ import {Template} from "meteor/templating"; ...@@ -2,6 +2,7 @@ import {Template} from "meteor/templating";
import {Meteor} from "meteor/meteor"; import {Meteor} from "meteor/meteor";
import {NavigatorCheck} from "../../../../../../../api/navigatorCheck"; import {NavigatorCheck} from "../../../../../../../api/navigatorCheck";
import "./bonus.html"; import "./bonus.html";
import {Session} from "meteor/session";
/* /*
* ############################################################################ * ############################################################################
...@@ -9,6 +10,13 @@ import "./bonus.html"; ...@@ -9,6 +10,13 @@ import "./bonus.html";
* ############################################################################ * ############################################################################
*/ */
Template.filterIndexPool.events({
'click #navbar-transcripts-bonus': function () {
Session.set('transcriptViewingMode', 1);
}
});
Template.mainNavigationTopItemTranscriptsItemBonus.helpers({ Template.mainNavigationTopItemTranscriptsItemBonus.helpers({
isSmartPhoneAndOwnsNoCards: function () { isSmartPhoneAndOwnsNoCards: function () {
if (NavigatorCheck.isSmartphone()) { if (NavigatorCheck.isSmartphone()) {
......
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