Просмотр исходного кода

Confirmation on threads deletion.

Rafał Pitoń 10 лет назад
Родитель
Сommit
0b4032d732

+ 9 - 0
misago/static/misago/js/misago-threads-lists.js

@@ -4,6 +4,15 @@ function threadsMassActions(select_message) {
   var $master = $('.master-checkbox');
   var $threads = $('.table-panel .list-group-item');
 
+  $form.find('li button').click(function() {
+    if ($(this).data('confirmation')) {
+      var confirmation = confirm($(this).data('confirmation'));
+      return confirmation;
+    } else {
+      return true;
+    }
+  });
+
   $master.click(function() {
     if ($threads.filter('.active').length == $threads.length) {
       $threads.removeClass('active');

+ 3 - 1
misago/threads/views/generic/forum.py

@@ -104,7 +104,9 @@ class ForumActions(Actions):
             actions.append({
                 'action': 'delete',
                 'icon': 'times',
-                'name': _("Delete threads")
+                'name': _("Delete threads"),
+                'confirmation': _("Are you sure you want to delete selected "
+                                  "threads? This action can't be undone.")
             })
 
         return actions