From 9b30fb9c0da84e482ead0d7d34840b10f86ca857 Mon Sep 17 00:00:00 2001 From: ngodfraind Date: Mon, 10 Aug 2015 10:57:54 +0200 Subject: [PATCH 1/2] Minor fixes for count messages & _token field. --- Resources/translations/forum.en.yml | 1 + Resources/translations/forum.es.yml | 1 + Resources/translations/forum.fr.yml | 1 + Resources/views/Forum/messages.html.twig | 2 +- Resources/views/Forum/subjects.html.twig | 4 ++-- 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Resources/translations/forum.en.yml b/Resources/translations/forum.en.yml index 88dec2b..9db4855 100644 --- a/Resources/translations/forum.en.yml +++ b/Resources/translations/forum.en.yml @@ -39,6 +39,7 @@ started_by: Initiated by stick: Stick stuck: Stuck subject: Topic +subjects: Topics subjets_per_page: Subjects per page subscribe_mail_list: Subscribe to notifications unstick: Unstick diff --git a/Resources/translations/forum.es.yml b/Resources/translations/forum.es.yml index d4692ba..ff104f0 100644 --- a/Resources/translations/forum.es.yml +++ b/Resources/translations/forum.es.yml @@ -38,6 +38,7 @@ started_by: 'Iniciado por' stick: Anclar stuck: Anclado subject: Tema +subjects: Temas subjets_per_page: 'Temas por pagina' subscribe_mail_list: 'Suscríbase a las notificaciones' unstick: Desanclar diff --git a/Resources/translations/forum.fr.yml b/Resources/translations/forum.fr.yml index 0d2049f..e244b1c 100644 --- a/Resources/translations/forum.fr.yml +++ b/Resources/translations/forum.fr.yml @@ -39,6 +39,7 @@ started_by: Initié par stick: Épingler stuck: Épinglé subject: Sujet +subjects: Sujets subjets_per_page: Sujets par page subscribe_mail_list: Recevoir les notifications unstick: Désépingler diff --git a/Resources/views/Forum/messages.html.twig b/Resources/views/Forum/messages.html.twig index d0f4707..6f95b80 100644 --- a/Resources/views/Forum/messages.html.twig +++ b/Resources/views/Forum/messages.html.twig @@ -149,7 +149,7 @@ {% if not subject.isClosed() %} {# something may be wrong here because _token doesn't always exists #} - {{ form_widget(form._token) }} + {% if form._token is defined %} {{ form_widget(form._token) }} {% endif %} {% endif %} {% endif %} diff --git a/Resources/views/Forum/subjects.html.twig b/Resources/views/Forum/subjects.html.twig index 71e672b..12ec3a7 100644 --- a/Resources/views/Forum/subjects.html.twig +++ b/Resources/views/Forum/subjects.html.twig @@ -128,7 +128,7 @@ {{ subject['subject_created']|intl_date_format() }} - {{ subject['count_messages'] }} + {{ subject['count_messages'] - 1 }} {% if lastMessages[subject['id']] is defined and lastMessages[subject['id']] is not empty %} @@ -145,7 +145,7 @@ {{ lastMessages[subject['id']].getAuthor() }}
{{ lastMessages[subject['id']].getModificationDate()|intl_date_format() }} - + {% if isNew %} {% endif %} From 924977dd61e5835ecc36c1c49a78c670bc125fb1 Mon Sep 17 00:00:00 2001 From: ngodfraind Date: Mon, 10 Aug 2015 11:01:21 +0200 Subject: [PATCH 2/2] Updating topics count. --- Repository/ForumRepository.php | 3 +-- Resources/views/index.html.twig | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Repository/ForumRepository.php b/Repository/ForumRepository.php index 314ad9e..fa0e805 100644 --- a/Repository/ForumRepository.php +++ b/Repository/ForumRepository.php @@ -79,11 +79,10 @@ public function findCategories(Forum $forum, $getQuery = false) { $dql = " SELECT c.id as id, - count(m) as count_messages, + count(s) as count_subjects, c.name as name FROM Claroline\ForumBundle\Entity\Category c LEFT JOIN c.subjects s - LEFT JOIN s.messages m JOIN c.forum forum WHERE forum.id = :forumId GROUP BY c diff --git a/Resources/views/index.html.twig b/Resources/views/index.html.twig index 80e8b2d..24e0a8b 100644 --- a/Resources/views/index.html.twig +++ b/Resources/views/index.html.twig @@ -90,7 +90,7 @@ {{ 'category'|trans({}, 'forum') }} - {{ 'messages'|trans({}, 'forum') }} + {{ 'subjects'|trans({}, 'forum') }} {{ 'last_message'|trans({}, 'forum') }} {% if isModerator %} @@ -113,7 +113,7 @@ {% endif %}
- {{ category['count_messages'] }} + {{ category['count_subjects'] }} {{ category['last_message_author'] }}