Files
DiceCloud/rpg-docs/client/views/character/printedCharacterSheet/printedCharacterSheet.js
Thaum Rystra 75c8720b04 Moved printed character sheets to their own page
This makes sure the entire printed sheet is rendered before the browser  attempts to print it, solving all manner of errors
2018-03-03 11:13:16 +02:00

39 lines
1.0 KiB
JavaScript

Template.printedCharacterSheet.onRendered(function(){
// Quickfit is only called once on rendering, text will not resize reactively
this.$(".shrink-to-fit").quickfit({
min: 7,
max: 36,
truncate: true,
});
});
Template.printedCharacterSheet.helpers({
character(){
return Characters.findOne(this._id);
},
classes: function(){
return Classes.find({charId: this._id}, {sort: {createdAt: 1}});
},
weaponProfs: function(){
var profs = Proficiencies.find({charId: this._id, type: "weapon"});
return removeDuplicateProficiencies(profs);
},
armorProfs: function(){
var profs = Proficiencies.find({charId: this._id, type: "armor"});
return removeDuplicateProficiencies(profs);
},
toolProfs: function(){
var profs = Proficiencies.find({charId: this._id, type: "tool"});
return removeDuplicateProficiencies(profs);
},
});
Template.printedCharacterSheet.events({
"click .printButton": function(event, instance){
print();
},
"click .backButton": function(event, instance){
history && history.back();
},
});