Skip to content

Commit 1cd452c

Browse files
committed
Forum reply update.
1 parent 25d0f15 commit 1cd452c

File tree

3 files changed

+26
-25
lines changed

3 files changed

+26
-25
lines changed

Resources/translations/forum.en.yml

+1
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ reply_to: Reply to %author%:
5757
quote: Quote
5858
title_option_form_last_messages: Just display the last messages which I have contributed
5959
title_form_last_messages: Display messages
60+
please_connect_to_answer: You need to be logged on to reply on this forum

Resources/translations/forum.fr.yml

+1
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ reply_to: Répondre à %author%:
5757
quote: Citer
5858
title_option_form_last_messages: Afficher seulement les conversations auxquelles j'ai participé
5959
title_form_last_messages: Apparence des messages
60+
please_connect_to_answer: Il est nécessaire de se connecter pour participer au forum

Resources/views/Forum/messages.html.twig

+24-25
Original file line numberDiff line numberDiff line change
@@ -143,36 +143,35 @@
143143
{{ renderPager(subject.getId(), pager, max) }}
144144

145145
{% if canPost %}
146-
<btn id='fast-reply-btn' class='btn btn-primary pull-right'>{{ 'fast_reply'|trans({}, 'forum')}}</btn>
146+
<btn id='fast-reply-btn' class='btn btn-primary pull-right {% if has_role('ROLE_ANONYMOUS') %} disabled {% endif %}'>
147+
{{ 'fast_reply'|trans({}, 'forum')}}
148+
</btn>
147149
{% endif %}
148150
</div>
149151
{% if canPost %}
150-
<div class="fast-reply" style="display: none;">
151-
<h4><i class="fa fa-reply"></i> {{ 'new_message' | trans({}, 'forum') }}</h4>
152-
<div>
153-
{% if not subject.isClosed() %}
154-
<textarea class="forum-answer claroline-tiny-mce hide"></textarea>
155-
{# something may be wrong here because _token doesn't always exists #}
156-
{% if form._token is defined %} {{ form_widget(form._token) }} {% endif %}
152+
{% if has_role('ROLE_ANONYMOUS') %}
153+
<div class='pull-right alert alert-warning'> {{ 'please_connect_to_answer'|trans({}, 'forum') }}
157154
{% endif %}
155+
<div class="fast-reply" style="display: none;">
156+
<h4><i class="fa fa-reply"></i> {{ 'new_message' | trans({}, 'forum') }}</h4>
157+
<div>
158+
{% if not subject.isClosed() %}
159+
<textarea class="forum-answer claroline-tiny-mce hide"></textarea>
160+
{# something may be wrong here because _token doesn't always exists #}
161+
{% if form._token is defined %} {{ form_widget(form._token) }} {% endif %}
162+
{% endif %}
163+
</div>
164+
</br>
165+
<div class="pull-right">
166+
<a class="btn btn-default" href='{{ path('claro_forum_subjects', { 'category': category.getId() }) }}'>
167+
{{ 'back'|trans({}, 'platform') }}
168+
</a>
169+
<a id="submit-message" class="btn btn-primary">
170+
<i class="fa fa-reply"></i> {{ 'send' | trans({}, 'platform') }}
171+
</a>
172+
</div>
158173
</div>
159174
{% endif %}
160-
</div>
161-
</div>
162-
<div class="panel-footer clearfix">
163-
<div class="pull-right">
164-
{% if not subject.isClosed() %}
165-
<a class="btn btn-default" href='{{ path('claro_forum_subjects', { 'category': category.getId() }) }}'>
166-
{{ 'back'|trans({}, 'platform') }}
167-
</a>
168-
{% if canPost %}
169-
<a class="btn btn-primary">
170-
<i class="fa fa-reply"></i> {{ 'send' | trans({}, 'platform') }}
171-
</a>
172-
{% endif %}
173-
{% endif %}
174-
</div>
175-
</div>
176175
{% endblock %}
177176

178177
{% block javascripts %}
@@ -192,7 +191,7 @@
192191
<script>
193192
(function () {
194193
'use strict';
195-
$('body').on('click', '.panel-footer .btn-primary', function () {
194+
$('body').on('click', '#submit-message', function () {
196195
var content = $('textarea.claroline-tiny-mce').val();
197196
var token = $('#forum_message_form__token').val();
198197

0 commit comments

Comments
 (0)