Merge branch 'release/1.2.3'

This commit is contained in:
Flavio Copes 2016-09-15 16:47:37 +02:00
commit 816a1b9271
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 # v1.2.2
## 08/12/2016 ## 08/12/2016

View File

@ -1,5 +1,5 @@
name: Comments name: Comments
version: 1.2.2 version: 1.2.3
description: Adds a commenting functionality to your site description: Adds a commenting functionality to your site
icon: comment icon: comment
author: 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. * 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() 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() { public function onTwigSiteVariables() {
$this->grav['twig']->enable = $this->enable; $this->grav['twig']->enable_comments_plugin = $this->enable;
$this->grav['twig']->comments = $this->fetchComments(); $this->grav['twig']->comments = $this->fetchComments();
} }
@ -97,6 +119,7 @@ class CommentsPlugin extends Plugin
$this->enable([ $this->enable([
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0], 'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
'onFormProcessed' => ['onFormProcessed', 0], 'onFormProcessed' => ['onFormProcessed', 0],
'onFormPageHeaderProcessed' => ['onFormPageHeaderProcessed', 0],
'onPageInitialized' => ['onPageInitialized', 10], 'onPageInitialized' => ['onPageInitialized', 10],
'onTwigSiteVariables' => ['onTwigSiteVariables', 0] 'onTwigSiteVariables' => ['onTwigSiteVariables', 0]
]); ]);

View File

@ -19,6 +19,7 @@ de:
SUBMIT_COMMENT_BUTTON_TEXT: "Absenden" SUBMIT_COMMENT_BUTTON_TEXT: "Absenden"
EMAIL_NEW_COMMENT_SUBJECT: "[Neuer Kommentar] von {{ form.value.name|e }}" EMAIL_NEW_COMMENT_SUBJECT: "[Neuer Kommentar] von {{ form.value.name|e }}"
THANK_YOU_MESSAGE: "Vielen Dank für den Kommentar!" THANK_YOU_MESSAGE: "Vielen Dank für den Kommentar!"
en: en:
PLUGIN_COMMENTS: PLUGIN_COMMENTS:
ADD_COMMENT: Add a comment ADD_COMMENT: Add a comment
@ -85,6 +86,28 @@ fr:
EMAIL_NEW_COMMENT_SUBJECT: "[Nouveau commentaire] de {{ form.value.name|e }}" EMAIL_NEW_COMMENT_SUBJECT: "[Nouveau commentaire] de {{ form.value.name|e }}"
THANK_YOU_MESSAGE: "Merci d'avoir rédigé votre commentaire !" 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: it:
PLUGIN_COMMENTS: PLUGIN_COMMENTS:
ADD_COMMENT: Aggiungi un commento ADD_COMMENT: Aggiungi un commento
@ -154,6 +177,7 @@ pt-br:
SUBMIT_COMMENT_BUTTON_TEXT: "Enviar" SUBMIT_COMMENT_BUTTON_TEXT: "Enviar"
EMAIL_NEW_COMMENT_SUBJECT: "[Novo comentário] de {{ form.value.name|e }}" EMAIL_NEW_COMMENT_SUBJECT: "[Novo comentário] de {{ form.value.name|e }}"
THANK_YOU_MESSAGE: "Obrigada por enviar seu comentário!" THANK_YOU_MESSAGE: "Obrigada por enviar seu comentário!"
ro: ro:
PLUGIN_COMMENTS: PLUGIN_COMMENTS:
ADD_COMMENT: 'Adăugați un comentariu' ADD_COMMENT: 'Adăugați un comentariu'
@ -175,3 +199,25 @@ ro:
SUBMIT_COMMENT_BUTTON_TEXT: "Trimiteți" SUBMIT_COMMENT_BUTTON_TEXT: "Trimiteți"
EMAIL_NEW_COMMENT_SUBJECT: "[Comentariu nou] from {{ form.value.name|e }}" EMAIL_NEW_COMMENT_SUBJECT: "[Comentariu nou] from {{ form.value.name|e }}"
THANK_YOU_MESSAGE: "Vă mulțumim pentru comentariu!" 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> <h3>{{'PLUGIN_COMMENTS.ADD_COMMENT'|t}}</h3>
@ -27,6 +27,7 @@
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% include "forms/fields/formname/formname.html.twig" %}
<div class="buttons"> <div class="buttons">
{% for button in grav.config.plugins.comments.form.buttons %} {% for button in grav.config.plugins.comments.form.buttons %}