Save query when pressing Cmd+S.

This commit is contained in:
Arik Fraimovich 2014-01-11 20:04:27 +02:00
parent 7282f61133
commit fd1acd6533
3 changed files with 11 additions and 1 deletions

View File

@ -101,6 +101,8 @@
<script src="/bower_components/angular-growl/build/angular-growl.js"></script>
<script src="/bower_components/pivottable/examples/pivot.js"></script>
<script src="/bower_components/cornelius/src/cornelius.js"></script>
<script src="/bower_components/mousetrap/mousetrap.js"></script>
<script src="/bower_components/mousetrap/plugins/global-bind/mousetrap-global-bind.js"></script>
<!-- endbuild -->
<!-- build:js({.tmp,app}) /scripts/scripts.js -->

View File

@ -39,6 +39,11 @@
}
}
Mousetrap.bindGlobal("meta+s", function(e) {
e.preventDefault();
$scope.saveQuery();
});
$scope.$on('$locationChangeStart', function(event, next, current) {
if (next.split("#")[0] == current.split("#")[0]) {
return;
@ -48,6 +53,8 @@
!confirm(leavingPageText + "\n\nAre you sure you want to leave this page?")) {
event.preventDefault();
}
Mousetrap.unbind("meta+s");
});
$scope.$parent.pageTitle = "Query Fiddle";

View File

@ -17,7 +17,8 @@
"angular-growl": "0.3.1",
"pivottable": "git@github.com:arikfr/pivottable.git#master",
"cornelius": "git@github.com:restorando/cornelius.git",
"gridster": "0.2.0"
"gridster": "0.2.0",
"mousetrap": "~1.4.6"
},
"devDependencies": {
"angular-mocks": "~1.0.7",