|
143 | 143 | {{ renderPager(subject.getId(), pager, max) }}
|
144 | 144 |
|
145 | 145 | {% 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> |
147 | 149 | {% endif %}
|
148 | 150 | </div>
|
149 | 151 | {% 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') }} |
157 | 154 | {% 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> |
158 | 173 | </div>
|
159 | 174 | {% 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> |
176 | 175 | {% endblock %}
|
177 | 176 |
|
178 | 177 | {% block javascripts %}
|
|
192 | 191 | <script>
|
193 | 192 | (function () {
|
194 | 193 | 'use strict';
|
195 |
| - $('body').on('click', '.panel-footer .btn-primary', function () { |
| 194 | + $('body').on('click', '#submit-message', function () { |
196 | 195 | var content = $('textarea.claroline-tiny-mce').val();
|
197 | 196 | var token = $('#forum_message_form__token').val();
|
198 | 197 |
|
|
0 commit comments