]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/templatetags/node_tags.py
add an ability to attach extra classes to post controls - helps to reduce redundant...
[osqa.git] / forum / templatetags / node_tags.py
index 69260c4a8e2f4bcaa7876747a6e9251686179dcb..aee496a8e4f2982f63c6d39679cdb36a542237e1 100644 (file)
@@ -77,9 +77,13 @@ def post_classes(post):
 \r
     return " ".join(classes)\r
 \r
-def post_control(text, url, command=False, withprompt=False, confirm=False, title="", copy=False):\r
+def post_control(text, url, command=False, withprompt=False, confirm=False, title="", copy=False, extra_classes=[]):\r
     classes = (command and "ajax-command" or " ") + (withprompt and " withprompt" or " ") + (confirm and " confirm" or " ") + \\r
         (copy and " copy" or " ")\r
+\r
+    for extra_class in extra_classes:\r
+        classes += " %s" % extra_class\r
+\r
     return {'text': text, 'url': url, 'classes': classes, 'title': title}\r
 \r
 \r
@@ -129,8 +133,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