Merge branch 'release/1.2.3'

This commit is contained in:
Flavio Copes 2016-09-15 16:47:37 +02:00
commit 031d45a2e4
5 changed files with 86 additions and 8 deletions

View File

@ -1,3 +1,11 @@
# v1.2.3
## 09/15/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

View File

@ -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:

View File

@ -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';
}
}
}

View File

@ -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,29 @@ 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
COMMENTS: Komentari
EMAIL_NOT_CONFIGURED: Email adresa nije podešena
NEW_COMMENT_EMAIL_SUBJECT: 'Novi komentar na %1$s'
NEW_COMMENT_EMAIL_BODY: '<p>Novi komentar je napisan na %1$s od %3$s (%4$s).</p><p>Stranica:: %2$s</p><p>Tekst: %5$s</p>'
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
@ -106,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
@ -154,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'
@ -175,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: '<p>En ny kommentar er skrevet på %1$s av %3$s (%4$s).</p><p>Side: %2$s</p><p>Tekst: %5$s</p>'
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!"

View File

@ -1,4 +1,4 @@
{% if grav.twig.enable %}
{% if grav.twig.enable_comments_plugin %}
<h3>{{'PLUGIN_COMMENTS.ADD_COMMENT'|t}}</h3>
@ -19,7 +19,7 @@
{% else %}
<div>
{% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
</div>
</div>
{% endif %}
{% else %}
<div>
@ -27,6 +27,7 @@
</div>
{% endif %}
{% endfor %}
{% include "forms/fields/formname/formname.html.twig" %}
<div class="buttons">
{% for button in grav.config.plugins.comments.form.buttons %}