Skip to content

Commit c79bc08

Browse files
authored
Merge c1c2743 into b91708d
2 parents b91708d + c1c2743 commit c79bc08

File tree

12 files changed

+1265
-23
lines changed

12 files changed

+1265
-23
lines changed

app/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def create_tables(engine, psql_environment):
6565
google_connect,
6666
invitation,
6767
joke,
68+
keyboard_shortcuts,
6869
login,
6970
logout,
7071
profile,
@@ -114,6 +115,7 @@ async def swagger_ui_redirect():
114115
google_connect.router,
115116
invitation.router,
116117
joke.router,
118+
keyboard_shortcuts.router,
117119
login.router,
118120
logout.router,
119121
profile.router,

app/routers/keyboard_shortcuts.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from app.dependencies import templates
2+
from fastapi import APIRouter, Request
3+
from starlette.templating import _TemplateResponse
4+
5+
router = APIRouter()
6+
7+
8+
@router.get("/keyboard_shortcuts")
9+
def keyboard_shortcuts(request: Request) -> _TemplateResponse:
10+
return templates.TemplateResponse("keyboard_shortcuts.html", {
11+
"request": request})

app/static/keyboard_shortcuts/__init__.py

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import './mousetrap.js'
2+
import './mousetrap_bind_dict.js'
3+
4+
let key_shortcuts = {
5+
'alt+c+h': function() { window.open('/', '_self'); },
6+
'alt+c+i': function() { window.open('/invitations/', '_self'); },
7+
'alt+c+p': function() { window.open('/profile/', '_self'); },
8+
'alt+c+s': function() { window.open('/search/', '_self'); },
9+
'alt+c+a': function() { window.open('/agenda/', '_self'); },
10+
'ctrl+.': function() { window.open('/keyboard_shortcuts/', '_self'); }
11+
};
12+
13+
Mousetrap.bind(key_shortcuts);

0 commit comments

Comments
 (0)