Commit bc259b46ca34a6597973d2604870b7139655387c

Authored by Zambom
1 parent 9193ce35

Adding answer edited confirmation message [Issue: #164]

forum/static/js/forum.js
... ... @@ -259,7 +259,7 @@ function answer(id, url) {
259 259 * Function to load form to edit post answer
260 260 *
261 261 */
262   -function edit_post_answer(url, answer_id) {
  262 +function edit_post_answer(url, answer_id, success_message) {
263 263 $.ajax({
264 264 url: url,
265 265 success: function(data) {
... ... @@ -273,6 +273,8 @@ function edit_post_answer(url, answer_id) {
273 273 url: frm.attr('action'),
274 274 data: frm.serialize(),
275 275 success: function (data) {
  276 + alertify.success(success_message);
  277 +
276 278 $("#answer_"+answer_id).parent().after(data);
277 279 frm.parent().parent().remove();
278 280 },
... ...
forum/templates/post_answers/post_answer_list.html
... ... @@ -14,7 +14,7 @@
14 14 <i class="material-icons">more_horiz</i>
15 15 </a>
16 16 <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
17   - <li><a href="javascript:edit_post_answer('{% url 'course:forum:update_post_answer' answer.id %}', '{{ answer.id }}')"><i class="material-icons">create</i> {% trans 'Edit' %}</a></li>
  17 + <li><a href="javascript:edit_post_answer('{% url 'course:forum:update_post_answer' answer.id %}', '{{ answer.id }}', '{% trans 'Answer edited sucessfully!' %}')"><i class="material-icons">create</i> {% trans 'Edit' %}</a></li>
18 18 <li><a href="javascript:delete_answer('{% url 'course:forum:delete_answer' answer.id %}', '{{ answer.id }}', '{% trans "Are you sure you want to delete this answer?" %}')"><i class="material-icons">delete_sweep</i> {% trans 'Remove' %}</a></li>
19 19 </ul>
20 20 </div>
... ...
forum/templates/post_answers/post_answer_render.html
... ... @@ -12,7 +12,7 @@
12 12 <i class="material-icons">more_horiz</i>
13 13 </a>
14 14 <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
15   - <li><a href="javascript:edit_post_answer('{% url 'course:forum:update_post_answer' answer.id %}', '{{ answer.id }}')"><i class="material-icons">create</i> {% trans 'Edit' %}</a></li>
  15 + <li><a href="javascript:edit_post_answer('{% url 'course:forum:update_post_answer' answer.id %}', '{{ answer.id }}', '{% trans 'Answer edited sucessfully!' %}')"><i class="material-icons">create</i> {% trans 'Edit' %}</a></li>
16 16 <li><a href="javascript:delete_answer('{% url 'course:forum:delete_answer' answer.id %}', '{{ answer.id }}', '{% trans "Are you sure you want to delete this answer?" %}')"><i class="material-icons">delete_sweep</i> {% trans 'Remove' %}</a></li>
17 17 </ul>
18 18 </div>
... ...