/:thread_id -> /thread/:thread_id, delete old /post_pic route
This commit is contained in:
parent
275c5353a2
commit
a255086a16
3 changed files with 12 additions and 9 deletions
|
|
@ -130,7 +130,7 @@ module Marker = struct
|
|||
let thread_preview_div = Jv.get Jv.global "thread_preview_div" in
|
||||
ignore @@ Jv.set thread_preview_div "innerHTML" thread_preview;
|
||||
let thread_link = Jv.get Jv.global "thread_link" in
|
||||
let link = Format.sprintf "/%s" thread_id in
|
||||
let link = Format.sprintf "/thread/%s" thread_id in
|
||||
ignore @@ Jv.set thread_link "href" (Jv.of_string link);
|
||||
ignore @@ Jv.set thread_link "innerText" (Jv.of_string "[View Thread]");
|
||||
let _ = Js_pretty_post.make_pretty () in
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ let newthread_post request =
|
|||
in
|
||||
match res with
|
||||
| Ok thread_id ->
|
||||
let adress = Format.asprintf "/%s" thread_id in
|
||||
let adress = Format.asprintf "/thread/%s" thread_id in
|
||||
Dream.respond ~status:`See_Other
|
||||
~headers:[ ("Location", adress) ]
|
||||
"Your thread was posted!"
|
||||
|
|
@ -206,7 +206,7 @@ let reply_post request =
|
|||
in
|
||||
match res with
|
||||
| Ok post_id ->
|
||||
let adress = Format.sprintf "/%s#%s" parent_id post_id in
|
||||
let adress = Format.sprintf "/thread/%s#%s" parent_id post_id in
|
||||
Dream.respond ~status:`See_Other
|
||||
~headers:[ ("Location", adress) ]
|
||||
"Your reply was posted!"
|
||||
|
|
@ -238,12 +238,15 @@ let routes =
|
|||
; get_ "/user" user
|
||||
; get_ "/user/:user" user_profile
|
||||
; get_ "/user/:user/avatar" avatar_image
|
||||
; get_ "/thread/:thread_id" thread_get
|
||||
; post "/thread/:thread_id" reply_post
|
||||
]
|
||||
@ ( if App.open_registration then
|
||||
[ get_ "/register" register_get; post "/register" register_post ]
|
||||
else [] )
|
||||
@ (* TODO: rename these two routes *)
|
||||
[ get_ "/:thread_id" thread_get; post "/:thread_id" reply_post ]
|
||||
@
|
||||
if App.open_registration then
|
||||
[ get_ "/register" register_get; post "/register" register_post ]
|
||||
else []
|
||||
|
||||
|
||||
|
||||
let () =
|
||||
let logger = if App.log then Dream.logger else Fun.id in
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ let f thread_view thread_id request =
|
|||
|
||||
% | Some _ ->
|
||||
<div class="post-form">
|
||||
<%s! Dream.form_tag ~action:( Format.sprintf "/%s" thread_id)
|
||||
<%s! Dream.form_tag ~action:( Format.sprintf "/thread/%s" thread_id)
|
||||
~enctype:`Multipart_form_data request %>
|
||||
|
||||
<label for="reply-comment" id="reply-comment-label" class="form-label">Comment:</label>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue