Binding key Q to the running the query in explore view (#685)

This commit is contained in:
Maxime Beauchemin 2016-07-01 15:28:40 -07:00 committed by GitHub
parent d5b22dd86e
commit 19983147a3
2 changed files with 18 additions and 0 deletions

View File

@ -8,6 +8,8 @@ var jQuery = window.jQuery = $;
var px = require('./modules/caravel.js');
var showModal = require('./modules/utils.js').showModal;
var isQueryRunning = false;
require('jquery-ui');
$.widget.bridge('uitooltip', $.ui.tooltip); // Shutting down jq-ui tooltips
require('bootstrap');
@ -56,6 +58,10 @@ function prepForm() {
}
function query(force, pushState) {
if (isQueryRunning) {
return;
}
isQueryRunning = true;
if (force === undefined) {
force = false;
}
@ -71,6 +77,7 @@ function query(force, pushState) {
history.pushState({}, document.title, slice.querystring());
}
slice.render(force);
isQueryRunning = false;
}
function initExploreView() {
@ -482,4 +489,9 @@ $(document).ready(function () {
$('div.toggle').addClass('pull-right');
slice.bindResizeToWindowResize();
document.addEventListener("keyup", function (k) {
if (k.key === 'q' || k.key === 'Q') {
query(true);
}
});
});

View File

@ -43,3 +43,9 @@ framework, in the meantime, we've tagged a few pull requests as
visualizations.
https://github.com/airbnb/caravel/issues?q=label%3Aexample+is%3Aclosed
Is there shortcut for the Query button
--------------------------------------
Yes, `q` or `Q` will do it.