From bf17db5d8520cde965c1fafdc1650f0c1f4ed45d Mon Sep 17 00:00:00 2001 From: jordan Date: Wed, 25 Jan 2012 19:29:57 +0000 Subject: [PATCH] add a setting that allows to control the position of the report (0) option git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1225 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/settings/moderation.py | 16 +++++++++++++++- forum/templatetags/node_tags.py | 12 ++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/forum/settings/moderation.py b/forum/settings/moderation.py index d6f1b3d..742cc05 100644 --- a/forum/settings/moderation.py +++ b/forum/settings/moderation.py @@ -3,7 +3,7 @@ from forms import StringListWidget from django.utils.encoding import smart_unicode from django.utils.translation import ugettext_lazy as _ -from django.forms.widgets import Textarea +from django.forms.widgets import Textarea, RadioSelect MODERATION_SET = SettingSet('moderation', _('Moderation settings'), _("Define the moderation workflow of your site"), 100) @@ -41,3 +41,17 @@ MODERATION_SET, dict( label = _("Close Reasons"), help_text = _("Create some close reasons to use in the close question popup."), widget=StringListWidget)) + + +# Flag control position +REPORT_OFFENSIVE_CONTROL_POSITION_CHOICES = ( + ('more', _('Position it in the "More" menu')), + ('controls', _('Position it in main controls')), +) + +REPORT_OFFENSIVE_CONTROL_POSITION = Setting('REPORT_OFFENSIVE_CONTROL_POSITION', 'more', MODERATION_SET, dict( +label = _("Position of report control"), +help_text = _("Choose the position of the \"report (0)\" control of nodes."), +widget=RadioSelect, +choices=REPORT_OFFENSIVE_CONTROL_POSITION_CHOICES, +required=False)) diff --git a/forum/templatetags/node_tags.py b/forum/templatetags/node_tags.py index 69260c4..104f866 100644 --- a/forum/templatetags/node_tags.py +++ b/forum/templatetags/node_tags.py @@ -129,8 +129,16 @@ def post_controls(post, user): if user.can_view_offensive_flags(post): label = "%s (%d)" % (label, post.flag_count) - controls.append(post_control(label, reverse('flag_post', kwargs={'id': post.id}), - command=True, withprompt=True, title=_("report as offensive (i.e containing spam, advertising, malicious text, etc.)"))) + + report_control = post_control(label, reverse('flag_post', kwargs={'id': post.id}), + command=True, withprompt=True, + title=_("report as offensive (i.e containing spam, advertising, malicious text, etc.)")) + + # Depending on the setting choose where to attach the control + if settings.REPORT_OFFENSIVE_CONTROL_POSITION.value == "more": + menu.append(report_control) + else: + controls.append(report_control) if user.can_delete_post(post): if post.nis.deleted: -- 2.39.5