We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit af43221d authored by Mitchell Rosen's avatar Mitchell Rosen

remove duplicate preview warning/buttons, added 'post' action alongside 'preview'

parent fffc2dfe
...@@ -68,29 +68,31 @@ commentForm label content = renderBootstrap3 $ NewComment ...@@ -68,29 +68,31 @@ commentForm label content = renderBootstrap3 $ NewComment
-- toVisibility True = VisPrivate -- toVisibility True = VisPrivate
-- toVisibility _ = VisPublic -- toVisibility _ = VisPublic
commentFormWidget :: SomeMessage App -> Maybe Markdown -> Widget commentFormWidget :: Text -> SomeMessage App -> Maybe Markdown -> Widget
commentFormWidget label = commentFormWidget' . commentForm label commentFormWidget post_text label content = commentFormWidget' post_text (commentForm label content)
-- intentional duplication of commentFormWidget' because some aspects -- intentional duplication of commentFormWidget' because some aspects
-- of closing and other markdown aren't identical (such as marking privacy) -- of closing and other markdown aren't identical (such as marking privacy)
closureFormWidget' :: Form NewClosure -> Widget closureFormWidget' :: Text -> Form NewClosure -> Widget
closureFormWidget' form = do closureFormWidget' post_text form = do
(widget, enctype) <- handlerToWidget $ generateFormPost form (widget, enctype) <- handlerToWidget $ generateFormPost form
[whamlet| [whamlet|
<div> <div>
<form method="POST" enctype=#{enctype}> <form method="POST" enctype=#{enctype}>
^{widget} ^{widget}
<button type="submit" name="mode" value="preview">preview <button type="submit" name="mode" value="preview">preview
<button type="submit" name="mode" value="post">#{post_text}
|] |]
commentFormWidget' :: Form a -> Widget commentFormWidget' :: Text -> Form a -> Widget
commentFormWidget' form = do commentFormWidget' post_text form = do
(widget, enctype) <- handlerToWidget $ generateFormPost form (widget, enctype) <- handlerToWidget $ generateFormPost form
[whamlet| [whamlet|
<div> <div>
<form method="POST" enctype=#{enctype}> <form method="POST" enctype=#{enctype}>
^{widget} ^{widget}
<button type="submit" name="mode" value="preview">preview <button type="submit" name="mode" value="preview">preview
<button type="submit" name="mode" value="post">#{post_text}
|] |]
closeCommentForm :: Maybe Markdown -> Form NewClosure closeCommentForm :: Maybe Markdown -> Form NewClosure
...@@ -114,13 +116,13 @@ commentNewTopicFormWidget :: Widget ...@@ -114,13 +116,13 @@ commentNewTopicFormWidget :: Widget
commentReplyFormWidget :: Widget commentReplyFormWidget :: Widget
editCommentFormWidget :: Markdown -> Widget editCommentFormWidget :: Markdown -> Widget
closeCommentFormWidget = closureFormWidget' . closeCommentForm closeCommentFormWidget = closureFormWidget' "close" . closeCommentForm
retractCommentFormWidget = closureFormWidget' . retractCommentForm retractCommentFormWidget = closureFormWidget' "retract" . retractCommentForm
claimCommentFormWidget = commentFormWidget' . claimCommentForm claimCommentFormWidget = commentFormWidget' "claim" . claimCommentForm
commentNewTopicFormWidget = commentFormWidget' commentNewTopicForm commentNewTopicFormWidget = commentFormWidget' "post" commentNewTopicForm
commentReplyFormWidget = commentFormWidget' commentReplyForm commentReplyFormWidget = commentFormWidget' "post" commentReplyForm
editCommentFormWidget = commentFormWidget' . editCommentForm editCommentFormWidget = commentFormWidget' "post" . editCommentForm
approveCommentFormWidget :: Widget approveCommentFormWidget :: Widget
approveCommentFormWidget = approveCommentFormWidget =
...@@ -177,7 +179,8 @@ flagCommentFormWidget def_reasons def_message = do ...@@ -177,7 +179,8 @@ flagCommentFormWidget def_reasons def_message = do
<form method="POST" enctype=#{enctype}> <form method="POST" enctype=#{enctype}>
<h4>Code of Conduct Violation(s): <h4>Code of Conduct Violation(s):
^{form} ^{form}
<button type="submit" name="mode" value="preview">preview flag message <button type="submit" name="mode" value="preview">preview
<button type="submit" name="mode" value="post">flag
|] |]
generateFlagCommentForm :: Maybe (Maybe [FlagReason]) -> Maybe (Maybe Markdown) -> Widget generateFlagCommentForm :: Maybe (Maybe [FlagReason]) -> Maybe (Maybe Markdown) -> Widget
......
...@@ -11,15 +11,8 @@ previewWidget form action widget = ...@@ -11,15 +11,8 @@ previewWidget form action widget =
^{widget} ^{widget}
<div .alert .alert-danger>
This is a preview; your changes have <em>not</em> been saved!
<form #edit-preview method="POST"> <form #edit-preview method="POST">
<button type="submit" name="mode" value="preview">preview
<button .preview-action-button type="submit" name="mode" value="post">#{action}
^{form} ^{form}
<button type="submit" name="mode" value="preview">preview <button type="submit" name="mode" value="preview">preview
<button .preview-action-button type="submit" name="mode" value="post">#{action} <button .preview-action-button type="submit" name="mode" value="post">#{action}
|] |]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment