-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
146 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Request, Response } from "express"; | ||
import iconmapper from "../utils/iconmapper"; | ||
import { data } from "../server"; | ||
import saveChangesToNotes from "../utils/saveNotes"; | ||
export function addInfoRoute(req: Request<{ id: number }>, res: Response){ | ||
if(req.account?.roles.includes('editor')) { | ||
res.render("addInfo", { | ||
url: '../../../', | ||
mi: iconmapper, | ||
|
||
}) | ||
} | ||
else { | ||
res.send("not editor"); | ||
} | ||
} | ||
export function addInfoPOSTRoute(req: Request<{ id: number }, {}, {content: string}>, res: Response){ | ||
if(req.account?.roles.includes('editor')&&req.body.content) { | ||
data.subjects[req.params.id].infos.push({ | ||
addedBy: req.account.id, | ||
content: req.body.content, | ||
id: data.subjects[req.params.id].infos.length, | ||
updateDate: Math.floor(Date.now() / 1000) | ||
}) | ||
res.send("added info"); | ||
saveChangesToNotes() | ||
} | ||
else { | ||
res.send("not editor"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!DOCTYPE html> | ||
<html lang="pl"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Zaloguj się</title> | ||
<link rel="stylesheet" href="<%= url %>static/katex/katex.min.css"> | ||
<script defer src="<%= url %>static/katex/katex.min.js"></script> | ||
<script src="<%= url %>static/marked/marked.min.js"></script> | ||
<script defer src="<%= url %>static/marked/lib/marked.umd.js"></script> | ||
<script defer src="<%= url %>static/katex/contrib/auto-render.min.js" | ||
onload="renderMathInElement(document.body);"></script> | ||
<link rel="stylesheet" href="<%= url %>static/style-g.css"> | ||
<link rel="stylesheet" href="<%= url %>static/style.css"> | ||
<link rel="icon" type="image/x-icon" href="<%= url %>static/favicon.ico"> | ||
<title>Edytor</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<style> | ||
body { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
body > form { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
align-items: center; | ||
flex: 0; | ||
background-color: var(--md-sys-color-surface-container); | ||
padding: 32px; | ||
border-radius: 16px; | ||
gap: 16px | ||
} | ||
body > form button,input { | ||
width: 100%; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<form method="post"> | ||
<span class="MDI" headline-small> | ||
<%= mi('book-open-blank-variant') %> | ||
</span> | ||
<span headline-small>Dodaj informację</span> | ||
<textarea style="min-width: 20vw; min-height: 20vh" name="content" ></textarea> | ||
|
||
<button type="submit">Dodaj informacje</button> | ||
</form> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters