From 35a1ac159d944a604f7e9f48fac4153db275fd53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C5=A1a=20Jani=C5=A1ka?= Date: Thu, 25 Aug 2016 14:51:41 +0200 Subject: [PATCH 1/5] add Croatian translation (#34) --- languages.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/languages.yaml b/languages.yaml index a2c7297..12a846a 100644 --- a/languages.yaml +++ b/languages.yaml @@ -85,6 +85,27 @@ fr: EMAIL_NEW_COMMENT_SUBJECT: "[Nouveau commentaire] de {{ form.value.name|e }}" THANK_YOU_MESSAGE: "Merci d'avoir rédigé votre commentaire !" +hr: + PLUGIN_COMMENTS: + ADD_COMMENT: Dodaj komentar + COMMENTS: Komentari + EMAIL_NOT_CONFIGURED: Email adresa nije podešena + NEW_COMMENT_EMAIL_SUBJECT: 'Novi komentar na %1$s' + NEW_COMMENT_EMAIL_BODY: '

Novi komentar je napisan na %1$s od %3$s (%4$s).

Stranica:: %2$s

Tekst: %5$s

' + EMAIL_FOOTER: '' + NAME: Ime: + EMAIL: Email: + WRITTEN_ON: Napisano je na + BY: od + NAME_LABEL: "Ime" + NAME_PLACEHOLDER: "Unesite ime" + EMAIL_LABEL: "Email adresa" + EMAIL_PLACEHOLDER: "Unesite email adresu" + MESSAGE_LABEL: "Komentar" + MESSAGE_PLACEHOLDER: "Unesite komentar" + SUBMIT_COMMENT_BUTTON_TEXT: "Pošalji" + EMAIL_NEW_COMMENT_SUBJECT: "[Novi komentar] od {{ form.value.name|e }}" + THANK_YOU_MESSAGE: "Hvala Vam što ste napisali svoj komentar!" it: PLUGIN_COMMENTS: ADD_COMMENT: Aggiungi un commento From 18b315013225bfb202b6220b29c20497605ad90b Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Thu, 25 Aug 2016 14:52:22 +0200 Subject: [PATCH 2/5] Changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aebb755..7022af6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.2.x +## 08/xx/2016 + +1. [](#improved) + * Added Croatian translation + # v1.2.2 ## 08/12/2016 From 61b7cd43d1f16b94bf9bb9dbe5253c78a8c24b78 Mon Sep 17 00:00:00 2001 From: Teknix Date: Thu, 15 Sep 2016 11:50:09 +0200 Subject: [PATCH 3/5] Added Norwegian translation (#36) Also fixed some padding between the language groups --- languages.yaml | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/languages.yaml b/languages.yaml index 12a846a..61cc568 100644 --- a/languages.yaml +++ b/languages.yaml @@ -19,6 +19,7 @@ de: SUBMIT_COMMENT_BUTTON_TEXT: "Absenden" EMAIL_NEW_COMMENT_SUBJECT: "[Neuer Kommentar] von {{ form.value.name|e }}" THANK_YOU_MESSAGE: "Vielen Dank für den Kommentar!" + en: PLUGIN_COMMENTS: ADD_COMMENT: Add a comment @@ -62,7 +63,7 @@ es: SUBMIT_COMMENT_BUTTON_TEXT: "Enviar" EMAIL_NEW_COMMENT_SUBJECT: "[Nuevo comentario] de {{ form.value.name|e }}" THANK_YOU_MESSAGE: "Gracias por escribir su comentario!" - + fr: PLUGIN_COMMENTS: ADD_COMMENT: Ajouter un commentaire @@ -84,7 +85,7 @@ fr: SUBMIT_COMMENT_BUTTON_TEXT: "Envoyer" EMAIL_NEW_COMMENT_SUBJECT: "[Nouveau commentaire] de {{ form.value.name|e }}" THANK_YOU_MESSAGE: "Merci d'avoir rédigé votre commentaire !" - + hr: PLUGIN_COMMENTS: ADD_COMMENT: Dodaj komentar @@ -96,7 +97,7 @@ hr: NAME: Ime: EMAIL: Email: WRITTEN_ON: Napisano je na - BY: od + BY: od NAME_LABEL: "Ime" NAME_PLACEHOLDER: "Unesite ime" EMAIL_LABEL: "Email adresa" @@ -106,6 +107,7 @@ hr: SUBMIT_COMMENT_BUTTON_TEXT: "Pošalji" EMAIL_NEW_COMMENT_SUBJECT: "[Novi komentar] od {{ form.value.name|e }}" THANK_YOU_MESSAGE: "Hvala Vam što ste napisali svoj komentar!" + it: PLUGIN_COMMENTS: ADD_COMMENT: Aggiungi un commento @@ -127,7 +129,7 @@ it: SUBMIT_COMMENT_BUTTON_TEXT: "Invia" EMAIL_NEW_COMMENT_SUBJECT: "[Nuovo commento] da {{ form.value.name|e }}" THANK_YOU_MESSAGE: "Grazie per il tuo commento!" - + pl: PLUGIN_COMMENTS: ADD_COMMENT: Dodaj komentarz @@ -175,6 +177,7 @@ pt-br: SUBMIT_COMMENT_BUTTON_TEXT: "Enviar" EMAIL_NEW_COMMENT_SUBJECT: "[Novo comentário] de {{ form.value.name|e }}" THANK_YOU_MESSAGE: "Obrigada por enviar seu comentário!" + ro: PLUGIN_COMMENTS: ADD_COMMENT: 'Adăugați un comentariu' @@ -196,3 +199,25 @@ ro: SUBMIT_COMMENT_BUTTON_TEXT: "Trimiteți" EMAIL_NEW_COMMENT_SUBJECT: "[Comentariu nou] from {{ form.value.name|e }}" THANK_YOU_MESSAGE: "Vă mulțumim pentru comentariu!" + +no: + PLUGIN_COMMENTS: + ADD_COMMENT: Skriv en kommentar + COMMENTS: Kommentarer + EMAIL_NOT_CONFIGURED: Epost er ikke konfigurert + NEW_COMMENT_EMAIL_SUBJECT: 'Ny kommentar på %1$s' + NEW_COMMENT_EMAIL_BODY: '

En ny kommentar er skrevet på %1$s av %3$s (%4$s).

Side: %2$s

Tekst: %5$s

' + EMAIL_FOOTER: '' + NAME: Navn: + EMAIL: Epost: + WRITTEN_ON: Skrevet på + BY: av + NAME_LABEL: "Navn" + NAME_PLACEHOLDER: "Skriv ditt navn" + EMAIL_LABEL: "Epost" + EMAIL_PLACEHOLDER: "Skriv din epost adresse" + MESSAGE_LABEL: "Kommentar" + MESSAGE_PLACEHOLDER: "Skriv din kommentar" + SUBMIT_COMMENT_BUTTON_TEXT: "Send" + EMAIL_NEW_COMMENT_SUBJECT: "[Ny kommentar] fra {{ form.value.name|e }}" + THANK_YOU_MESSAGE: "Takk for din kommentar!" From 9ade9bb63793169ffc37d409a2abc94adacf9858 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Thu, 15 Sep 2016 15:18:14 +0200 Subject: [PATCH 4/5] Allow comments to work fine on Form 2.0 too --- CHANGELOG.md | 4 +++- comments.php | 27 +++++++++++++++++++++++++-- templates/partials/comments.html.twig | 5 +++-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7022af6..2c92a63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,10 @@ # v1.2.x -## 08/xx/2016 +## 09/xx/2016 1. [](#improved) * Added Croatian translation +1. [](#bugfix) + * Fix [#35](https://github.com/getgrav/grav-plugin-comments/issues/35) Allow comments to work fine on Form 2.0 too # v1.2.2 ## 08/12/2016 diff --git a/comments.php b/comments.php index f8ae6f4..0058eff 100644 --- a/comments.php +++ b/comments.php @@ -31,6 +31,10 @@ class CommentsPlugin extends Plugin /** * Initialize form if the page has one. Also catches form processing if user posts the form. + * + * Used by Form plugin < 2.0, kept for backwards compatibility + * + * @deprecated */ public function onPageInitialized() { @@ -49,8 +53,26 @@ class CommentsPlugin extends Plugin } } + /** + * Add the comment form information to the page header dynamically + * + * Used by Form plugin >= 2.0 + */ + public function onFormPageHeaderProcessed(Event $event) + { + $header = $event['header']; + + if ($this->enable) { + if (!isset($header->form)) { + $header->form = $this->grav['config']->get('plugins.comments.form'); + } + } + + $event->header = $header; + } + public function onTwigSiteVariables() { - $this->grav['twig']->enable = $this->enable; + $this->grav['twig']->enable_comments_plugin = $this->enable; $this->grav['twig']->comments = $this->fetchComments(); } @@ -97,6 +119,7 @@ class CommentsPlugin extends Plugin $this->enable([ 'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0], 'onFormProcessed' => ['onFormProcessed', 0], + 'onFormPageHeaderProcessed' => ['onFormPageHeaderProcessed', 0], 'onPageInitialized' => ['onPageInitialized', 10], 'onTwigSiteVariables' => ['onTwigSiteVariables', 0] ]); @@ -406,4 +429,4 @@ class CommentsPlugin extends Plugin { $this->grav['admin']->dataTypesExcludedFromDataManagerPlugin[] = 'comments'; } -} +} \ No newline at end of file diff --git a/templates/partials/comments.html.twig b/templates/partials/comments.html.twig index d4d4493..6872180 100644 --- a/templates/partials/comments.html.twig +++ b/templates/partials/comments.html.twig @@ -1,4 +1,4 @@ -{% if grav.twig.enable %} +{% if grav.twig.enable_comments_plugin %}

{{'PLUGIN_COMMENTS.ADD_COMMENT'|t}}

@@ -19,7 +19,7 @@ {% else %}
{% include "forms/fields/#{field.type}/#{field.type}.html.twig" %} -
+ {% endif %} {% else %}
@@ -27,6 +27,7 @@
{% endif %} {% endfor %} + {% include "forms/fields/formname/formname.html.twig" %}
{% for button in grav.config.plugins.comments.form.buttons %} From e699df44304999f47a9ffb047954d8b36b81ead4 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Thu, 15 Sep 2016 16:47:33 +0200 Subject: [PATCH 5/5] Prepare release --- CHANGELOG.md | 4 ++-- blueprints.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c92a63..f49ee61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ -# v1.2.x -## 09/xx/2016 +# v1.2.3 +## 09/15/2016 1. [](#improved) * Added Croatian translation diff --git a/blueprints.yaml b/blueprints.yaml index 8cb8efa..ea50097 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Comments -version: 1.2.2 +version: 1.2.3 description: Adds a commenting functionality to your site icon: comment author: