-
Notifications
You must be signed in to change notification settings - Fork 52
Feature/keyboard shortcuts #160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 9 commits
07fe63f
f9cc030
9813dfb
9aa7e78
ab47c1e
d70c329
da42ebb
9c29e96
1cdbfd1
b257545
3615ddc
5dba38f
f5e397d
c1c2743
b0a5938
2973ec8
0c83116
91e50ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from app.dependencies import templates | ||
from fastapi import APIRouter, Request | ||
from starlette.templating import _TemplateResponse | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.get("/keyboard_shortcuts") | ||
def keyboard_shortcuts(request: Request) -> _TemplateResponse: | ||
return templates.TemplateResponse("keyboard_shortcuts.html", { | ||
"request": request}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import './mousetrap.js' | ||
import './mousetrap_bind_dict.js' | ||
|
||
let key_shortcuts = { | ||
'alt+c+h': function() { window.open('/', '_self'); }, | ||
'alt+c+i': function() { window.open('/invitations/', '_self'); }, | ||
'alt+c+p': function() { window.open('/profile/', '_self'); }, | ||
'alt+c+s': function() { window.open('/search/', '_self'); }, | ||
'alt+c+a': function() { window.open('/agenda/', '_self'); }, | ||
'ctrl+.': function() { window.open('/keyboard_shortcuts/', '_self'); } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you open this using modal instead? It's actually not too hard :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not understand, I need to open the page itself , not? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's better not to move the user to a whole new page, but to show him the keyboard shortcuts in the same page. Just like Jupyter Notebook does. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh, do you mean just the /keyboard_shortcuts to open like modal instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey, I created Modal instead of page by using the button in profile page and It's definitely more beautiful, but I was not able to run it nicely by keyboard shortcut. so I removed that shortcut it for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What have you tried? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. $(#keyboard-shortcuts).modal('show') - It did not work There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does not work because it assumes jQuery is imported (and also syntactically wrong - there are no quote signs wrapping |
||
}; | ||
|
||
Mousetrap.bind(key_shortcuts); |
Uh oh!
There was an error while loading. Please reload this page.