diff --git a/app/dependencies.py b/app/dependencies.py index 8e792f1d..32350855 100644 --- a/app/dependencies.py +++ b/app/dependencies.py @@ -1,5 +1,11 @@ +import os + from app.database.database import SessionLocal +APP_PATH = os.path.dirname(os.path.realpath(__file__)) +STATIC_PATH = os.path.join(APP_PATH, "static") +TEMPLATES_PATH = os.path.join(APP_PATH, "templates") + # Dependency def get_db(): db = SessionLocal() diff --git a/app/main.py b/app/main.py index 3fe3dbca..03c149e2 100644 --- a/app/main.py +++ b/app/main.py @@ -7,17 +7,13 @@ from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates +from routers import event +from dependencies import STATIC_PATH, TEMPLATES_PATH app = FastAPI() -app_path = os.path.dirname(os.path.realpath(__file__)) -static_path = os.path.join(app_path, "static") -templates_path = os.path.join(app_path, "templates") - -app.mount("/static", StaticFiles(directory=static_path), name="static") -templates = Jinja2Templates(directory=templates_path) - -app.include_router(agenda.router) +app.mount("/static", StaticFiles(directory=STATIC_PATH), name="static") +templates = Jinja2Templates(directory=TEMPLATES_PATH) @app.get("/") @@ -30,7 +26,6 @@ def home(request: Request): @app.get("/profile") def profile(request: Request): - # Get relevant data from database upcouming_events = range(5) current_username = "Chuck Norris" @@ -40,3 +35,7 @@ def profile(request: Request): "username": current_username, "events": upcouming_events }) + + +app.include_router(event.router) +app.include_router(agenda.router) diff --git a/app/routers/event.py b/app/routers/event.py new file mode 100644 index 00000000..ea965db8 --- /dev/null +++ b/app/routers/event.py @@ -0,0 +1,17 @@ +from fastapi import APIRouter, Request +from fastapi.templating import Jinja2Templates + +from dependencies import TEMPLATES_PATH + +templates = Jinja2Templates(directory=TEMPLATES_PATH) + +router = APIRouter( + prefix="/event", + tags=["event"], + responses={404: {"description": "Not found"}}, +) + + +@router.get("/edit") +async def eventedit(request: Request): + return templates.TemplateResponse("eventedit.html", {"request": request}) diff --git a/app/static/eventedit.css b/app/static/eventedit.css new file mode 100644 index 00000000..483c219f --- /dev/null +++ b/app/static/eventedit.css @@ -0,0 +1,58 @@ +html, +body { + height: 100%; + min-width: max-content; + max-width: -moz-available; + max-width: -webkit-fill-available; + max-width: fill-available; +} + +body { + display: flex; + flex-direction: column; +} + +#event_edit_tabs { + height: 100%; + flex: 1; +} + +.tab-pane { + height: 100%; + display: flex; + flex-direction: column; +} + +form { + display: flex; + flex-direction: column; + height: 100%; +} + +.form_row, +.form_row_start, +.form_row_end { + display: flex +} + +.form_row { + flex: 1; + min-height: 2.25em; + max-height: 3.25em; +} + +.form_row.textarea { + flex: 4; + max-height: 19em; +} + +input[type="text"], +input[type="date"], +textarea, +.form_row_start { + flex: 1; +} + +input[type="submit"] { + width: 100%; +} \ No newline at end of file diff --git a/app/templates/event_details_form_tab.html b/app/templates/event_details_form_tab.html new file mode 100644 index 00000000..4c682c3e --- /dev/null +++ b/app/templates/event_details_form_tab.html @@ -0,0 +1,48 @@ +