Skip to content

Commit

Permalink
feat: move upload page to home page
Browse files Browse the repository at this point in the history
  • Loading branch information
jabuxas committed Oct 15, 2024
1 parent 8bf4d7e commit bdab72d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 84 deletions.
5 changes: 0 additions & 5 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,6 @@ func (app *Application) uploadHandler(w http.ResponseWriter, r *http.Request) {
app.parserHandler(w, r)
return
}

tmpl := template.Must(template.ParseFiles("templates/upload.html"))
if err := tmpl.Execute(w, app.uploadHandler); err != nil {
slog.Warn(err.Error())
}
}

func (app *Application) parserHandler(w http.ResponseWriter, r *http.Request) {
Expand Down
19 changes: 10 additions & 9 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@

<body>
<h1>abyss paste</h1>
<div class="top-down">
<div>
<a href="/tree">
<button>files uploaded</button>
</a>
<a href="/upload">
<button>go to upload</button>
</a>
</div>
<div>
<a href="/tree">
<button>all uploaded files</button>
</a>
<a href="/last">
<button>last uploaded file</button>
</a>
</div>

<form action="/upload" method="POST">
<textarea name="content" placeholder="Enter your content here..."></textarea><br />
<button type="submit">upload</button>
</form>

<footer>
abyss paste - powered by
<a href="https://github.com/jabuxas/abyss" target="_blank">abyss</a>
Expand Down
20 changes: 19 additions & 1 deletion static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,27 @@ footer a {
div {
display: flex;
gap: 10px;
align-items: center;
}

.top-down {
form {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 30px;
gap: 10px;
}

textarea {
background-color: #333;
color: #fff;
border: 1px solid #555;
padding: 10px;
width: 400px;
height: 150px;
border-radius: 5px;
}

textarea::placeholder {
color: #bbb;
}
69 changes: 0 additions & 69 deletions templates/upload.html

This file was deleted.

0 comments on commit bdab72d

Please sign in to comment.