remove camelCase

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

View file

@ -8,7 +8,7 @@ let f request =
<br />
<button class="btn btn-primary" id="geolocalize">Geolocalize me</button>
% 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;
</div>
<div class="col-md-6">

View file

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

View file

@ -15,8 +15,8 @@ let on_click e =
let lat = Jv.get lat_lng "lat" in
let lng = Jv.get lat_lng "lng" in
let lat_input = Jv.get Jv.global "lat_input" in
let lng_input = Jv.get Jv.global "lng_input" in
let lat_input = Jv.get Jv.global "lat-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 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 " " |]
in
ignore @@ Jv.set comment_textarea "value" new_content )
Jv.(find global "replyComment");
Jv.(find global "reply-comment");
Jv.undefined
let () =
@ -20,7 +20,7 @@ let () =
let document = Jv.get Jv.global "document" in
let quote_links =
Jv.to_jv_list
@@ Jv.call document "getElementsByClassName" [| Jv.of_string "quoteLink" |]
@@ Jv.call document "getElementsByClassName" [| Jv.of_string "quote-link" |]
in
log "quote_links leng %d@." (List.length quote_links);
let add_click quote_link =
@ -43,7 +43,7 @@ let () =
Option.iter
(fun file_input ->
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
@@ Jv.call file_input "addEventListener"
[| Jv.of_string "change"; Jv.repr (make_visible alt_input) |];

View file

@ -5,11 +5,11 @@ type image_size =
| Small
let of_string = function
| "postImage" -> Some Small
| "postImageBig" -> Some Big
| "post-image" -> Some Small
| "post-image-big" -> Some Big
| _ -> 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*)
let image_click post_image event =
@ -56,7 +56,7 @@ let make_pretty _event =
(*add event image_click to all postImage*)
let post_images =
Jv.to_jv_list
@@ Jv.call document "getElementsByClassName" [| Jv.of_string "postImage" |]
@@ Jv.call document "getElementsByClassName" [| Jv.of_string "post-image" |]
in
let add_click el =
ignore

View file

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

View file

@ -137,11 +137,11 @@ let newthread_post request =
| `Ok
[ ("alt", [ (_, alt) ])
; ("file", file)
; ("lat_input", [ (_, lat) ])
; ("lng_input", [ (_, lng) ])
; ("lat-input", [ (_, lat) ])
; ("lng-input", [ (_, lng) ])
; ("subject", [ (_, subject) ])
; ("tags", [ (_, tags) ])
; ("threadComment", [ (_, comment) ])
; ("thread-comment", [ (_, comment) ])
] -> (
match (Float.of_string_opt lat, Float.of_string_opt lng) with
| None, _ -> render_unsafe "Invalide coordinate" request
@ -192,7 +192,7 @@ let reply_post request =
| `Ok
[ ("alt", [ (_, alt) ])
; ("file", file)
; ("replyComment", [ (_, comment) ])
; ("reply-comment", [ (_, comment) ])
; ("tags", [ (_, tags) ])
] -> (
let parent_id = Dream.param "thread_id" request in
@ -216,9 +216,6 @@ let reply_post request =
| `Wrong_session _ | `Wrong_content_type ->
Dream.empty `Bad_Request )
let redirect_to_babillard _request =
Dream.respond ~status:`Moved_Permanently ~headers:[ ("Location", "/") ] ""
let () =
Dream.run ~secret:"yolo" ~port:3696
@@ 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*)
Format.fprintf fmt
{|
<div class="postImageContainer">
<div class="post-image-container">
<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>
</div>
|}
@ -34,7 +34,7 @@ let view_post ?is_thread_preview id =
in
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
in
let pp_print_replies fmt replies =
@ -63,7 +63,7 @@ let view_post ?is_thread_preview id =
{|
<span class=postNo>
<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>
%a
|}
@ -76,7 +76,7 @@ let view_post ?is_thread_preview id =
let post_info_view fmt () =
Format.fprintf fmt
{|
<div class="postInfo">
<div class="post-info">
<span class="nick">%s</span>
<span class="date" data-time="%d"></span>
%a
@ -102,7 +102,7 @@ let view_post ?is_thread_preview id =
<div class="post" id="%s">
%a
%a
<blockquote class="postComment">%s</blockquote>
<blockquote class="post-comment">%s</blockquote>
%a
</div>
</div>
@ -117,8 +117,8 @@ let preview_thread thread_id =
let thread_preview =
Format.sprintf
{|
<div class="threadPreview">
<div class="threadSubject">
<div class="thread-preview">
<div class="thread-subject">
%s
</div>
%s
@ -164,10 +164,10 @@ let view_thread thread_id =
Format.sprintf
{|
<div class="thread">
<div class="threadSubject">
<div class="thread-subject">
%s
</div>
<div class="threadPosts">
<div class="thread-posts">
%s
</div>
</div>

View file

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