remove camelCase

This commit is contained in:
Swrup 2022-02-18 20:17:24 +01:00
parent e25a0891de
commit b6d31f47cf
9 changed files with 57 additions and 59 deletions

View file

@ -8,7 +8,7 @@ let f request =
<br /> <br />
<button class="btn btn-primary" id="geolocalize">Geolocalize me</button> <button class="btn btn-primary" id="geolocalize">Geolocalize me</button>
% if Option.is_some @@ Dream.session "nick" request then begin % if Option.is_some @@ Dream.session "nick" request then begin
<a class="btn btn-primary" href="/babillard/new_thread">New Thread</a> <a class="btn btn-primary" href="/new_thread">New Thread</a>
% end; % end;
</div> </div>
<div class="col-md-6"> <div class="col-md-6">

View file

@ -35,7 +35,7 @@ blockquote.blockquote {
display: table; display: table;
} }
.postInfo { .post-info {
display: block; display: block;
width: 100%; width: 100%;
} }
@ -44,23 +44,23 @@ blockquote.blockquote {
color: #FFB300; color: #FFB300;
} }
.postComment { .post-comment {
display: block; display: block;
padding-top: 10px; padding-top: 10px;
color: #333333; color: #333333;
} }
.postImageContainer { .post-image-container {
float: left; float: left;
padding: 5px 5px 5px 5px; padding: 5px 5px 5px 5px;
} }
.postImage { .post-image {
max-width: 250px; max-width: 250px;
height: auto; height: auto;
} }
.postImageBig { .post-image-big {
max-width: 750px; max-width: 750px;
height: auto; height: auto;
} }
@ -69,7 +69,7 @@ blockquote.blockquote {
color: green; color: green;
} }
.quoteLink { .quote-link {
background-color: #FCE4EC; background-color: #FCE4EC;
padding: 2px; padding: 2px;
text-align: center; text-align: center;
@ -79,7 +79,7 @@ blockquote.blockquote {
border: 2px solid DodgerBlue; border: 2px solid DodgerBlue;
} }
.quoteLink:focus { .quote-link:focus {
background-color: #FCE4EC; background-color: #FCE4EC;
padding: 2px; padding: 2px;
text-align: center; text-align: center;
@ -89,7 +89,7 @@ blockquote.blockquote {
border: 2px solid DodgerBlue; border: 2px solid DodgerBlue;
} }
.postForm { .post-form {
background-color: #FCE4EC; background-color: #FCE4EC;
margin: 5px 5px 5px 5px; margin: 5px 5px 5px 5px;
border: 2px solid #FFB300; border: 2px solid #FFB300;
@ -102,14 +102,15 @@ blockquote.blockquote {
visibility: hidden; visibility: hidden;
} }
#altLabel { #alt-label {
display:none; display:none;
} }
#alt { #alt {
display:none; display:none;
} }
.threadSubject { .thread-subject {
margin: auto; margin: auto;
width: 50%; width: 50%;
text-align: center; text-align: center;

View file

@ -15,8 +15,8 @@ let on_click e =
let lat = Jv.get lat_lng "lat" in let lat = Jv.get lat_lng "lat" in
let lng = Jv.get lat_lng "lng" in let lng = Jv.get lat_lng "lng" in
let lat_input = Jv.get Jv.global "lat_input" in let lat_input = Jv.get Jv.global "lat-input" in
let lng_input = Jv.get Jv.global "lng_input" in let lng_input = Jv.get Jv.global "lng-input" in
ignore @@ Jv.call lat_input "setAttribute" [| Jv.of_string "value"; lat |]; ignore @@ Jv.call lat_input "setAttribute" [| Jv.of_string "value"; lat |];
ignore @@ Jv.call lng_input "setAttribute" [| Jv.of_string "value"; lng |]; ignore @@ Jv.call lng_input "setAttribute" [| Jv.of_string "value"; lng |];

View file

@ -12,7 +12,7 @@ let insert_quote post_id _event =
[| Jv.of_string "\n>>"; post_id; Jv.of_string " " |] [| Jv.of_string "\n>>"; post_id; Jv.of_string " " |]
in in
ignore @@ Jv.set comment_textarea "value" new_content ) ignore @@ Jv.set comment_textarea "value" new_content )
Jv.(find global "replyComment"); Jv.(find global "reply-comment");
Jv.undefined Jv.undefined
let () = let () =
@ -20,7 +20,7 @@ let () =
let document = Jv.get Jv.global "document" in let document = Jv.get Jv.global "document" in
let quote_links = let quote_links =
Jv.to_jv_list Jv.to_jv_list
@@ Jv.call document "getElementsByClassName" [| Jv.of_string "quoteLink" |] @@ Jv.call document "getElementsByClassName" [| Jv.of_string "quote-link" |]
in in
log "quote_links leng %d@." (List.length quote_links); log "quote_links leng %d@." (List.length quote_links);
let add_click quote_link = let add_click quote_link =
@ -43,7 +43,7 @@ let () =
Option.iter Option.iter
(fun file_input -> (fun file_input ->
let alt_input = Jv.get Jv.global "alt" in let alt_input = Jv.get Jv.global "alt" in
let alt_label = Jv.get Jv.global "altLabel" in let alt_label = Jv.get Jv.global "alt-label" in
ignore ignore
@@ Jv.call file_input "addEventListener" @@ Jv.call file_input "addEventListener"
[| Jv.of_string "change"; Jv.repr (make_visible alt_input) |]; [| Jv.of_string "change"; Jv.repr (make_visible alt_input) |];

View file

@ -5,11 +5,11 @@ type image_size =
| Small | Small
let of_string = function let of_string = function
| "postImage" -> Some Small | "post-image" -> Some Small
| "postImageBig" -> Some Big | "post-image-big" -> Some Big
| _ -> None | _ -> None
let to_string = function Small -> "postImage" | Big -> "postImageBig" let to_string = function Small -> "post-image" | Big -> "post-image-big"
(*change postImage class to make it bigger/smaller on click*) (*change postImage class to make it bigger/smaller on click*)
let image_click post_image event = let image_click post_image event =
@ -56,7 +56,7 @@ let make_pretty _event =
(*add event image_click to all postImage*) (*add event image_click to all postImage*)
let post_images = let post_images =
Jv.to_jv_list Jv.to_jv_list
@@ Jv.call document "getElementsByClassName" [| Jv.of_string "postImage" |] @@ Jv.call document "getElementsByClassName" [| Jv.of_string "post-image" |]
in in
let add_click el = let add_click el =
ignore ignore

View file

@ -17,24 +17,24 @@ let f request =
</div> </div>
<div class="col-md-6" id="newthread-form"> <div class="col-md-6" id="newthread-form">
<div class="postForm"> <div class="postForm">
<%s! Dream.form_tag ~action:"/babillard/new_thread" ~enctype:`Multipart_form_data request %> <%s! Dream.form_tag ~action:"/new_thread" ~enctype:`Multipart_form_data request %>
<input type="hidden" id="lat_input" name="lat_input"> <input type="hidden" id="lat-input" name="lat-input">
<input type="hidden" id="lng_input" name="lng_input"> <input type="hidden" id="lng-input" name="lng-input">
<label for="subject" id="subjectLabel" class="form-label">Subject</label> <label for="subject" id="subject-label" class="form-label">Subject</label>
<input name="subject" type="text" class="form-control" id="subject" aria-labelledby="subjectLabel"></input> <input name="subject" type="text" class="form-control" id="subject" aria-labelledby="subject-label"></input>
<label for="threadComment" id="threadCommentLabel" class="form-label">Comment</label> <label for="thread-comment" id="thread-comment-label" class="form-label">Comment</label>
<textarea name="threadComment" type="text" class="form-control" id="threadComment" aria-labelledby="threadCommentLabel"></textarea> <textarea name="thread-comment" type="text" class="form-control" id="thread-comment" aria-labelledby="thread-comment-label"></textarea>
<label for="tags" id="tagsLabel" class="form-label">Tags</label> <label for="tags" id="tags-label" class="form-label">Tags</label>
<input name="tags" type="text" class="form-control" id="tags" aria-labelledby="tagsLabel"></input> <input name="tags" type="text" class="form-control" id="tags" aria-labelledby="tags-label"></input>
<label for="file" id="fileLabel" class="form-label">Picture:</label> <label for="file" id="file-label" class="form-label">Picture:</label>
<input id="file" name="file" aria-describedby="fileLabel" type="file" accept="image/*"> <input id="file" name="file" aria-describedby="file-label" type="file" accept="image/*">
<label for="alt" id="altLabel" class="form-label">Image description:</label> <label for="alt" id="alt-label" class="form-label">Image description:</label>
<input name="alt" type="text" class="form-control" id="alt" aria-labelledby="altLabel"></input> <input name="alt" type="text" class="form-control" id="alt" aria-labelledby="alt-label"></input>
<button type="submit" class="btn btn-primary">Make Thread</button> <button type="submit" class="btn btn-primary">Make Thread</button>
</form> </form>
</div> </div>

View file

@ -137,11 +137,11 @@ let newthread_post request =
| `Ok | `Ok
[ ("alt", [ (_, alt) ]) [ ("alt", [ (_, alt) ])
; ("file", file) ; ("file", file)
; ("lat_input", [ (_, lat) ]) ; ("lat-input", [ (_, lat) ])
; ("lng_input", [ (_, lng) ]) ; ("lng-input", [ (_, lng) ])
; ("subject", [ (_, subject) ]) ; ("subject", [ (_, subject) ])
; ("tags", [ (_, tags) ]) ; ("tags", [ (_, tags) ])
; ("threadComment", [ (_, comment) ]) ; ("thread-comment", [ (_, comment) ])
] -> ( ] -> (
match (Float.of_string_opt lat, Float.of_string_opt lng) with match (Float.of_string_opt lat, Float.of_string_opt lng) with
| None, _ -> render_unsafe "Invalide coordinate" request | None, _ -> render_unsafe "Invalide coordinate" request
@ -192,7 +192,7 @@ let reply_post request =
| `Ok | `Ok
[ ("alt", [ (_, alt) ]) [ ("alt", [ (_, alt) ])
; ("file", file) ; ("file", file)
; ("replyComment", [ (_, comment) ]) ; ("reply-comment", [ (_, comment) ])
; ("tags", [ (_, tags) ]) ; ("tags", [ (_, tags) ])
] -> ( ] -> (
let parent_id = Dream.param "thread_id" request in let parent_id = Dream.param "thread_id" request in
@ -216,9 +216,6 @@ let reply_post request =
| `Wrong_session _ | `Wrong_content_type -> | `Wrong_session _ | `Wrong_content_type ->
Dream.empty `Bad_Request ) Dream.empty `Bad_Request )
let redirect_to_babillard _request =
Dream.respond ~status:`Moved_Permanently ~headers:[ ("Location", "/") ] ""
let () = let () =
Dream.run ~secret:"yolo" ~port:3696 Dream.run ~secret:"yolo" ~port:3696
@@ Dream.logger @@ Dream.cookie_sessions @@ Dream.logger @@ Dream.cookie_sessions

View file

@ -23,9 +23,9 @@ let view_post ?is_thread_preview id =
(*TODO image info like file name and size on top of image*) (*TODO image info like file name and size on top of image*)
Format.fprintf fmt Format.fprintf fmt
{| {|
<div class="postImageContainer"> <div class="post-image-container">
<a href="/img/%s"> <a href="/img/%s">
<img class="postImage" src="/img/%s" alt="%s" title="%s" loading="lazy"> <img class="post-image" src="/img/%s" alt="%s" title="%s" loading="lazy">
</a> </a>
</div> </div>
|} |}
@ -34,7 +34,7 @@ let view_post ?is_thread_preview id =
in in
let pp_print_reply fmt reply = let pp_print_reply fmt reply =
Format.fprintf fmt {|<a class="replyLink" href="#%s">&gt;&gt;%s</a>|} reply Format.fprintf fmt {|<a class="reply-link" href="#%s">&gt;&gt;%s</a>|} reply
reply reply
in in
let pp_print_replies fmt replies = let pp_print_replies fmt replies =
@ -63,7 +63,7 @@ let view_post ?is_thread_preview id =
{| {|
<span class=postNo> <span class=postNo>
<a href="#%s" title="Link to this post" class="quote">#</a> <a href="#%s" title="Link to this post" class="quote">#</a>
<button data-id="%s" class="quoteLink" title="Reply to this post">%s</button> <button data-id="%s" class="quote-link" title="Reply to this post">%s</button>
</span> </span>
%a %a
|} |}
@ -76,7 +76,7 @@ let view_post ?is_thread_preview id =
let post_info_view fmt () = let post_info_view fmt () =
Format.fprintf fmt Format.fprintf fmt
{| {|
<div class="postInfo"> <div class="post-info">
<span class="nick">%s</span> <span class="nick">%s</span>
<span class="date" data-time="%d"></span> <span class="date" data-time="%d"></span>
%a %a
@ -102,7 +102,7 @@ let view_post ?is_thread_preview id =
<div class="post" id="%s"> <div class="post" id="%s">
%a %a
%a %a
<blockquote class="postComment">%s</blockquote> <blockquote class="post-comment">%s</blockquote>
%a %a
</div> </div>
</div> </div>
@ -117,8 +117,8 @@ let preview_thread thread_id =
let thread_preview = let thread_preview =
Format.sprintf Format.sprintf
{| {|
<div class="threadPreview"> <div class="thread-preview">
<div class="threadSubject"> <div class="thread-subject">
%s %s
</div> </div>
%s %s
@ -164,10 +164,10 @@ let view_thread thread_id =
Format.sprintf Format.sprintf
{| {|
<div class="thread"> <div class="thread">
<div class="threadSubject"> <div class="thread-subject">
%s %s
</div> </div>
<div class="threadPosts"> <div class="thread-posts">
%s %s
</div> </div>
</div> </div>

View file

@ -5,21 +5,21 @@ let f thread_view thread_id request =
% | None -> % | None ->
% | Some _ -> % | Some _ ->
<div class="postForm"> <div class="post-form">
<%s! Dream.form_tag ~action:( Format.sprintf "/%s" thread_id) <%s! Dream.form_tag ~action:( Format.sprintf "/%s" thread_id)
~enctype:`Multipart_form_data request %> ~enctype:`Multipart_form_data request %>
<label for="replyComment" id="replyCommentLabel" class="form-label">Comment:</label> <label for="reply-comment" id="reply-comment-label" class="form-label">Comment:</label>
<textarea name="replyComment" type="text" class="form-control" id="replyComment" aria-labelledby="replyCommentLabel"></textarea> <textarea name="reply-comment" type="text" class="form-control" id="reply-comment" aria-labelledby="reply-comment-label"></textarea>
<label for="tags" id="tagsLabel" class="form-label">Tags:</label> <label for="tags" id="tags-label" class="form-label">Tags:</label>
<input name="tags" type="text" class="form-control" id="tags" aria-labelledby="tagsLabel"></input> <input name="tags" type="text" class="form-control" id="tags" aria-labelledby="tags-label"></input>
<label for="file" id="fileLabel" class="form-label">Picture:</label> <label for="file" id="file-label" class="form-label">Picture:</label>
<input id="file" name="file" aria-describedby="fileLabel" type="file" accept="image/*"> <input id="file" name="file" aria-describedby="file-label" type="file" accept="image/*">
<label for="alt" id="altLabel" class="form-label">Image description:</label> <label for="alt" id="alt-label" class="form-label">Image description:</label>
<input name="alt" type="text" class="form-control" id="alt" aria-labelledby="altLabel"></input> <input name="alt" type="text" class="form-control" id="alt" aria-labelledby="alt-label"></input>
<button type="submit" class="btn btn-primary">Reply</button> <button type="submit" class="btn btn-primary">Reply</button>
</div> </div>
</form> </form>