postsactions.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. from django.utils.translation import ungettext, ugettext_lazy, ugettext as _
  2. from misago.threads import moderation
  3. from misago.threads.views.generic.actions import ActionsBase
  4. __all__ = ['PostsActions']
  5. class PostsActions(ActionsBase):
  6. select_items_message = ugettext_lazy(
  7. "You have to select at least one post.")
  8. is_mass_action = True
  9. def get_available_actions(self, kwargs):
  10. self.thread = kwargs['thread']
  11. self.forum = self.thread.forum
  12. actions = []
  13. if self.forum.acl['can_hide_posts']:
  14. actions.append({
  15. 'action': 'unhide',
  16. 'icon': 'eye',
  17. 'name': _("Unhide posts")
  18. })
  19. actions.append({
  20. 'action': 'hide',
  21. 'icon': 'eye-slash',
  22. 'name': _("Hide posts")
  23. })
  24. if self.forum.acl['can_hide_posts'] == 2:
  25. actions.append({
  26. 'action': 'delete',
  27. 'icon': 'times',
  28. 'name': _("Delete posts"),
  29. 'confirmation': _("Are you sure you want to delete selected "
  30. "posts? This action can't be undone.")
  31. })
  32. return actions
  33. def action_unhide(self, request, posts):
  34. pass
  35. def action_hide(self, request, posts):
  36. pass
  37. def action_delete(self, request, posts):
  38. pass