Files
makemeahanzi/client/modal.js
2015-10-28 23:07:10 -04:00

28 lines
634 B
JavaScript

"use strict";
Template.modal.helpers({
percent: () => {
const value = Session.get('modal.value');
return Math.round(100*(value === undefined ? 1 : value));
},
text: () => Session.get('modal.text'),
});
Tracker.autorun(function() {
if (Session.get('modal.show')) {
$('#modal').modal({background: 'static', keyboard: false});
} else {
$('#modal').modal('hide');
}
});
Tracker.autorun(function() {
const value = Session.get('modal.value');
Session.set('modal.show', value !== undefined);
});
Meteor.startup(function() {
Session.set('modal.show', false);
Session.set('modal.value', undefined);
});