Open a modal (or a new page) based on context

This feature is also sometime named the Pinterest-style route, which is further explained in this react-router example:

  cf0419f70e/examples/pinterest
This commit is contained in:
Maxime Quandalle 2015-08-27 00:27:23 +02:00
parent 95dcd8a146
commit 31c4aa01bd
6 changed files with 57 additions and 24 deletions

View file

@ -1,35 +1,37 @@
// XXX Pressing `?` should display a list of all shortcuts available.
//
// XXX There is no reason to define these shortcuts globally, they should be
// attached to a template (most of them will go in the `board` template).
Mousetrap.bind('w', function() {
Mousetrap.bind('?', () => {
FlowRouter.go('shortcuts');
});
Mousetrap.bind('w', () => {
Sidebar.toogle();
});
Mousetrap.bind('q', function() {
var currentBoardId = Session.get('currentBoard');
var currentUserId = Meteor.userId();
Mousetrap.bind('q', () => {
const currentBoardId = Session.get('currentBoard');
const currentUserId = Meteor.userId();
if (currentBoardId && currentUserId) {
Filter.members.toogle(currentUserId);
}
});
Mousetrap.bind('x', function() {
Mousetrap.bind('x', () => {
if (Filter.isActive()) {
Filter.reset();
}
});
Mousetrap.bind(['down', 'up'], function(evt, key) {
Mousetrap.bind(['down', 'up'], (evt, key) => {
if (! Session.get('currentCard')) {
return;
}
var nextFunc = (key === 'down' ? 'next' : 'prev');
var nextCard = $('.js-minicard.is-selected')[nextFunc]('.js-minicard').get(0);
const nextFunc = (key === 'down' ? 'next' : 'prev');
const nextCard = $('.js-minicard.is-selected')[nextFunc]('.js-minicard').get(0);
if (nextCard) {
var nextCardId = Blaze.getData(nextCard)._id;
const nextCardId = Blaze.getData(nextCard)._id;
Utils.goCardId(nextCardId);
}
});