diff options
author | dan <[email protected]> | 2023-03-08 19:15:26 -0500 |
---|---|---|
committer | dan <[email protected]> | 2023-03-08 19:15:26 -0500 |
commit | 7639e6188eac91a13d4188692304b9867cdfc2f0 (patch) | |
tree | 1ffa0ad62a11c74fefd94fcec72e15233caedf6d | |
parent | 1b63fdedb55c1c652c8a46afce73865ad46861f2 (diff) | |
download | 54-7639e6188eac91a13d4188692304b9867cdfc2f0.tar.gz 54-7639e6188eac91a13d4188692304b9867cdfc2f0.tar.bz2 54-7639e6188eac91a13d4188692304b9867cdfc2f0.zip |
fix: uploading blank post should not return 500; restyle image upload button
-rw-r--r-- | main.scm | 24 | ||||
-rw-r--r-- | style.css | 25 |
2 files changed, 34 insertions, 15 deletions
@@ -41,11 +41,14 @@ parent-id)] [image-or-null (if (or (not image) (eof-object? image) (equal? "" image)) (sql-null) - image)]) + image)] + [content-or-empty (if (or (not content) (eof-object? content)) + "" + content)]) (execute db "insert into posts (id, user_id, content, parent_id, jpeg_image) values (?, ?, ?, ?, ?)" - id user content parent-id-or-null image-or-null))) + id user content-or-empty parent-id-or-null image-or-null))) (define (vote-to-flush user) (execute db "insert or ignore into flush_votes (user_id) values (?)" @@ -174,7 +177,6 @@ "/") ) - (define (get-opt opt opts) (find (cut equal? <> opt) opts)) (define (post current-user p . opts) @@ -219,13 +221,15 @@ [value ""] [rows "5"] [cols "50"]))) + (div (@ [class "image-upload"]) + (label (@ [for "image"] + [style "margin-right:0.1em"]) + "Add Image") + (input (@ [type "file"] + [id "image"] + [accept "image/jpeg"] + [name "image"]))) (input (@ [id "submit"] [type "submit"] [value "Post"])) - (label (@ [for "image"] [style "margin-left:1em"]) Image:) - (input (@ [type "file"] - [id "image"] - [accept "image/jpeg"] - [name "image"] - [style "margin-left:0.5em"])) )) (define (page inner) @@ -235,8 +239,6 @@ (link (@ [rel "stylesheet"] [href "/style.css"])) (meta (@ [name "viewport"] [content "width=device-width, initial-scale=1"]))) (body -; (h1 "Title") -; (a (@ [href "/"]) "Back") ,inner )))))) @@ -163,18 +163,35 @@ textarea { height: 2em; } -#image::file-selector-button { +.image-upload { + float: right; border: 0; line-height: 2.5; - padding: 0 20px; + padding-bottom: 0.2em; + text-indent: 0.5em; font-size: 1rem; text-align: center; color: #fff; text-shadow: 1px 1px 1px #000; border-radius: 10px; - background-color: rgba(0, 0, 240, 0.6); + background-color: rgba(100, 100, 100, 0.6); background-image: linear-gradient(to top left, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2) 30%, rgba(0, 0, 0, 0)); box-shadow: inset 2px 2px 3px rgba(255, 255, 255, 0.6), inset -2px -2px 3px rgba(0, 0, 0, 0.6); - margin-top:2px; + margin-top: 0.1em; + cursor: pointer; +} + +.image-upload * { cursor: pointer; } + +@media only screen and (max-width: 450px) { + .image-upload { + float: unset; + width: 100%; + } + + #submit { + width: 100%; + } +} |