Commit 9193ce35a6c15ff86f7e70b4dc92629036485a2d

Authored by Zambom
1 parent 359b921b

Adding post edited confirmation message [Issue: #73]

courses/migrations/0004_auto_20161011_1951.py 0 → 100644
@@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
  1 +# -*- coding: utf-8 -*-
  2 +# Generated by Django 1.10 on 2016-10-11 22:51
  3 +from __future__ import unicode_literals
  4 +
  5 +from django.db import migrations, models
  6 +import django.db.models.deletion
  7 +
  8 +
  9 +class Migration(migrations.Migration):
  10 +
  11 + dependencies = [
  12 + ('courses', '0003_auto_20161007_1612'),
  13 + ]
  14 +
  15 + operations = [
  16 + migrations.AlterField(
  17 + model_name='course',
  18 + name='category',
  19 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'),
  20 + ),
  21 + ]
forum/static/js/forum.js
@@ -68,7 +68,6 @@ function createForum(url, topic) { @@ -68,7 +68,6 @@ function createForum(url, topic) {
68 url: frm.attr('action'), 68 url: frm.attr('action'),
69 data: frm.serialize(), 69 data: frm.serialize(),
70 success: function (data) { 70 success: function (data) {
71 - console.log(data);  
72 data = data.split('-'); 71 data = data.split('-');
73 72
74 $('.foruns_list').append("<a id='forum_"+data[1]+"' href='"+data[0]+"'>"+data[2]+"<br /></a>"); 73 $('.foruns_list').append("<a id='forum_"+data[1]+"' href='"+data[0]+"'>"+data[2]+"<br /></a>");
@@ -159,7 +158,7 @@ function delete_forum(url, forum, message, return_url) { @@ -159,7 +158,7 @@ function delete_forum(url, forum, message, return_url) {
159 * Function to load form to edit post 158 * Function to load form to edit post
160 * 159 *
161 */ 160 */
162 -function edit_post(url, post_id) { 161 +function edit_post(url, post_id, success_message) {
163 $.ajax({ 162 $.ajax({
164 url: url, 163 url: url,
165 success: function(data) { 164 success: function(data) {
@@ -173,6 +172,8 @@ function edit_post(url, post_id) { @@ -173,6 +172,8 @@ function edit_post(url, post_id) {
173 url: frm.attr('action'), 172 url: frm.attr('action'),
174 data: frm.serialize(), 173 data: frm.serialize(),
175 success: function (data) { 174 success: function (data) {
  175 + alertify.success(success_message);
  176 +
176 $("#post_"+post_id).parent().after(data); 177 $("#post_"+post_id).parent().after(data);
177 frm.parent().parent().remove(); 178 frm.parent().parent().remove();
178 }, 179 },
forum/templates/post/post_list.html
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 <i class="material-icons">more_horiz</i> 17 <i class="material-icons">more_horiz</i>
18 </a> 18 </a>
19 <ul class="dropdown-menu" aria-labelledby="dropdownMenu1"> 19 <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
20 - <li><a href="javascript:edit_post('{% url 'course:forum:update_post' post.id %}', '{{ post.id }}')"><i class="material-icons">create</i> {% trans 'Edit' %}</a></li> 20 + <li><a href="javascript:edit_post('{% url 'course:forum:update_post' post.id %}', '{{ post.id }}', '{% trans 'Post edited successfully!' %}')"><i class="material-icons">create</i> {% trans 'Edit' %}</a></li>
21 <li><a href="javascript:javascript:delete_post('{% url 'course:forum:delete_post' post.id %}', '{{ post.id }}')"><i class="material-icons">delete_sweep</i> {% trans 'Remove' %}</a></li> 21 <li><a href="javascript:javascript:delete_post('{% url 'course:forum:delete_post' post.id %}', '{{ post.id }}')"><i class="material-icons">delete_sweep</i> {% trans 'Remove' %}</a></li>
22 </ul> 22 </ul>
23 </div> 23 </div>
forum/templates/post/post_render.html
1 -{% load i18n permission_tags %} 1 +{% load i18n permission_tags list_post_answer %}
2 2
3 <div class="row"> 3 <div class="row">
4 <div id="post_{{ post.id }}" class="col-sm-12 col-xs-12"> 4 <div id="post_{{ post.id }}" class="col-sm-12 col-xs-12">
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 <i class="material-icons">more_horiz</i> 15 <i class="material-icons">more_horiz</i>
16 </a> 16 </a>
17 <ul class="dropdown-menu" aria-labelledby="dropdownMenu1"> 17 <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
18 - <li><a href="javascript:edit_post('{% url 'course:forum:update_post' post.id %}', '{{ post.id }}')"></li> 18 + <li><a href="javascript:edit_post('{% url 'course:forum:update_post' post.id %}', '{{ post.id }}', '{% trans 'Post edited successfully!' %}')"></li>
19 <li><a href="javascript:delete_post('{% url 'course:forum:delete_post' post.id %}', '{{ post.id }}')"><i class="material-icons">delete_sweep</i> {% trans 'Remove' %}</a></li> 19 <li><a href="javascript:delete_post('{% url 'course:forum:delete_post' post.id %}', '{{ post.id }}')"><i class="material-icons">delete_sweep</i> {% trans 'Remove' %}</a></li>
20 </ul> 20 </ul>
21 </div> 21 </div>
@@ -34,5 +34,8 @@ @@ -34,5 +34,8 @@
34 <p class="comment-text">{{ post.message|linebreaks }}</p> 34 <p class="comment-text">{{ post.message|linebreaks }}</p>
35 </div> 35 </div>
36 <div class="answer_post"></div> 36 <div class="answer_post"></div>
  37 + <div class="answer_list">
  38 + {% list_post_answer request post %}
  39 + </div>
37 </div> 40 </div>
38 </div> 41 </div>
39 \ No newline at end of file 42 \ No newline at end of file