Commit d10b1bae341c8a46f0548dd9d730c52ea785c7a8

Authored by Zambom
1 parent a7fef086

Adding confirmation message [Issue: #97]

forum/static/js/forum.js
@@ -94,7 +94,7 @@ function createForum(url, topic) { @@ -94,7 +94,7 @@ function createForum(url, topic) {
94 * Function to load edit forum's form and set the submit function 94 * Function to load edit forum's form and set the submit function
95 * 95 *
96 */ 96 */
97 -function editForum(url, forum) { 97 +function editForum(url, forum, success_message) {
98 $.ajax({ 98 $.ajax({
99 url: url, 99 url: url,
100 data: {'pk': forum}, 100 data: {'pk': forum},
@@ -114,6 +114,8 @@ function editForum(url, forum) { @@ -114,6 +114,8 @@ function editForum(url, forum) {
114 success: function (data) { 114 success: function (data) {
115 $('.forum_view').html(data); 115 $('.forum_view').html(data);
116 116
  117 + alertify.success(success_message);
  118 +
117 $("#editForum").modal('hide'); 119 $("#editForum").modal('hide');
118 }, 120 },
119 error: function(data) { 121 error: function(data) {
forum/templates/forum/forum_view.html
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 </div> 41 </div>
42 <div class="panel-body"> 42 <div class="panel-body">
43 <ul class="nav nav-pills nav-stacked"> 43 <ul class="nav nav-pills nav-stacked">
44 - <li><a href="javascript:editForum('{% url 'course:forum:update' forum.id %}', '{{ forum.id }}')">{% trans 'Edit' %}</a></li> 44 + <li><a href="javascript:editForum('{% url 'course:forum:update' forum.id %}', '{{ forum.id }}', '{% trans 'Forum edited successfully!' %}')">{% trans 'Edit' %}</a></li>
45 <li><a href="javascript:delete_forum('{% url 'course:forum:delete' forum.id %}', '{{ forum.id }}', '{% trans "Are you sure you want to delete this forum?" %}', '{% url 'course:view_subject' forum.topic.subject.slug %}')">{% trans 'Delete' %}</a></li> 45 <li><a href="javascript:delete_forum('{% url 'course:forum:delete' forum.id %}', '{{ forum.id }}', '{% trans "Are you sure you want to delete this forum?" %}', '{% url 'course:view_subject' forum.topic.subject.slug %}')">{% trans 'Delete' %}</a></li>
46 </ul> 46 </ul>
47 </div> 47 </div>