]> git.openstreetmap.org Git - osqa.git/commitdiff
add a setting that allows to control the position of the report (0) option
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Wed, 25 Jan 2012 19:29:57 +0000 (19:29 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Wed, 25 Jan 2012 19:29:57 +0000 (19:29 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1225 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/settings/moderation.py
forum/templatetags/node_tags.py

index d6f1b3ddb5a8ffdaae3262a2bfcabf75341950cc..742cc051c83c0e2903e2788d513333144ef3822f 100644 (file)
@@ -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))
index 69260c4a8e2f4bcaa7876747a6e9251686179dcb..104f866323f3ca72d15b8ded5a6c78b3f6562301 100644 (file)
@@ -129,8 +129,16 @@ def post_controls(post, user):
             if user.can_view_offensive_flags(post):\r
                 label =  "%s (%d)" % (label, post.flag_count)\r
 \r
-            controls.append(post_control(label, reverse('flag_post', kwargs={'id': post.id}),\r
-                    command=True, withprompt=True, title=_("report as offensive (i.e containing spam, advertising, malicious text, etc.)")))\r
+\r
+            report_control = post_control(label, reverse('flag_post', kwargs={'id': post.id}),\r
+                    command=True, withprompt=True,\r
+                    title=_("report as offensive (i.e containing spam, advertising, malicious text, etc.)"))\r
+\r
+            # Depending on the setting choose where to attach the control\r
+            if settings.REPORT_OFFENSIVE_CONTROL_POSITION.value == "more":\r
+                menu.append(report_control)\r
+            else:\r
+                controls.append(report_control)\r
 \r
         if user.can_delete_post(post):\r
             if post.nis.deleted:\r