Skip to content

Commit

Permalink
Merge pull request #71 from sometimesok/master
Browse files Browse the repository at this point in the history
Moderator thread-actions drop-down sorted
  • Loading branch information
Lanny authored Aug 4, 2019
2 parents eb94ed0 + e566e57 commit dffab0b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ISS/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,20 +313,23 @@ class RenderBBCodeForm(forms.Form):
class ThreadActionForm(forms.Form):
@classmethod
def _get_action_field(cls):
choices = [('edit-thread', 'Edit Thread'),
actions_choices = [('edit-thread', 'Edit Thread'),
('delete-posts', 'Delete Posts'),
('sticky-thread', 'Sticky Thread'),
('lock-thread', 'Lock Thread'),
('trash-thread', 'Trash Thread')]

actions_choices.sort()
moveto_choices = []
for forum in Forum.objects.all():
choices.append(('move-to-%d' % forum.pk,
moveto_choices.append(('move-to-%d' % forum.pk,
'-> Move to %s' % forum.name))
moveto_choices.sort(key=lambda name: name[1])
actions_choices.extend(moveto_choices)

return forms.ChoiceField(
label="",
required=True,
choices=choices)
choices=actions_choices)

def __init__(self, *args, **kwargs):
super(ThreadActionForm, self).__init__(*args, **kwargs)
Expand Down

0 comments on commit dffab0b

Please sign in to comment.