diff options
author | Jefferson Julio <[email protected]> | 2021-06-02 23:38:09 -0300 |
---|---|---|
committer | Jefferson Julio <[email protected]> | 2021-06-02 23:38:09 -0300 |
commit | 7d773221e7711c4e534e89264c719b4cc5aabb1f (patch) | |
tree | baf59501215d3ee874b865c70c9b9d1408545a16 /pages | |
parent | 5caf63d3897f353717fd69be9174d028fd078b23 (diff) | |
download | blog.sh-7d773221e7711c4e534e89264c719b4cc5aabb1f.tar.bz2 blog.sh-7d773221e7711c4e534e89264c719b4cc5aabb1f.zip |
support for comments on pages
Diffstat (limited to 'pages')
-rwxr-xr-x | pages/article.sh | 46 | ||||
-rwxr-xr-x | pages/contato.sh | 28 |
2 files changed, 65 insertions, 9 deletions
diff --git a/pages/article.sh b/pages/article.sh index 3cb5ab7..b7270d8 100755 --- a/pages/article.sh +++ b/pages/article.sh @@ -2,6 +2,8 @@ source $SCRIPT_DIR/utils/parse-article.sh +COMMENTS_FOLDER="$SCRIPT_DIR/pages/$REQUEST_URI/comments" source $SCRIPT_DIR/components/comments.sh + if [ $? -gt 0 ]; then STATUS=404 cat <<ERR @@ -33,5 +35,49 @@ cat <<ARTICLE </p> </div> </section> + + <br /> + <hr /> + <section> + <h4>Deixei o seu comentário sobre este artigo</h4> + <form method="POST" action="/post" enctype="multipart/form-data"> + <input type="hidden" name="destination" value="$REQUEST_URI/comments" /> + <input type="hidden" name="redirect_to" value="$REQUEST_URI" /> + + <label for="name">Nome</label> + <input id="name" type="text" name="name" value="Anônimo" /> + <br/> + + <label for="email">Email</label> + <input id="email" type="email" name="email" /> + <br/> + + <label for="message">Mensagem *</label> + <textarea id="message" name="message" required></textarea> + <small>Campos marcados com asterisco (*) são obrigatórios</small> + <br /> + + <br /> + <label for="file-attachment">Anexar arquivo</label> + <input id="file-attachment" type="file" name="attachment" /> + + <input type="submit" value="Enviar" /> + </form> + + </section> </article> + +<div class="container"> + <hr /> + <h4 style="text-align">Discussão</h4> + <br /> + + $( + if [ -n "$PARSED_COMMENTS" ]; then + echo "$PARSED_COMMENTS" + else + echo '<p style="text-align">Sem mensagens para mostrar.</p>' + fi + ) +</div> ARTICLE diff --git a/pages/contato.sh b/pages/contato.sh index c63228f..e6bd752 100755 --- a/pages/contato.sh +++ b/pages/contato.sh @@ -1,14 +1,8 @@ #!/bin/bash -cat <<PAGE -<style> - @media screen and (max-width: 600px) { - .contato-page { - text-align: center; - } - } -</style> +COMMENTS_FOLDER="$SCRIPT_DIR/pages/contato/comments" source $SCRIPT_DIR/components/comments.sh +cat <<PAGE <article class="contato-page container"> <section> <h1>Formas de contato</h1> @@ -35,7 +29,7 @@ cat <<PAGE <h1>Ou...</h1> <p> - ...mande uma mensagem por aqui mesmo! Prencha o formulário abaixo que sua + ...mande uma mensagem por aqui mesmo! Preencha o formulário abaixo que sua mensagem será publicada. Ela por padrão será postada na área de mensagens abaixo, marque a opção "privado" se não quiser que ela seja visível publicamente, neste caso apenas a administração do site, eu, poderá ver. @@ -43,6 +37,7 @@ cat <<PAGE <form method="POST" action="/post" enctype="multipart/form-data"> <input type="hidden" name="destination" value="/contato/comments" /> + <input type="hidden" name="redirect_to" value="/contato" /> <label for="name">Nome</label> <input id="name" type="text" name="name" value="Anônimo" /> @@ -69,6 +64,21 @@ cat <<PAGE </form> </section> </article> + + +<div class="container"> + <hr /> + <h4 style="text-align: center">Mensagens</h4> + <br /> + + $( + if [ -n "$PARSED_COMMENTS" ]; then + echo "$PARSED_COMMENTS" + else + echo "<p style=\"text-align: center\">Sem mensagens para mostrar.</p>" + fi + ) +</div> PAGE # Celular e Whatsapp: +55 (81) 97326-9793 <br /> |