From: jordan Date: Wed, 25 Jan 2012 21:41:58 +0000 (+0000) Subject: add an ability to attach extra classes to post controls - helps to reduce redundant... X-Git-Tag: live~91 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/4b9cffea08b229497136e30063a80f180db550c8 add an ability to attach extra classes to post controls - helps to reduce redundant JSON communication git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1226 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/templatetags/node_tags.py b/forum/templatetags/node_tags.py index 104f866..aee496a 100644 --- a/forum/templatetags/node_tags.py +++ b/forum/templatetags/node_tags.py @@ -77,9 +77,13 @@ def post_classes(post): return " ".join(classes) -def post_control(text, url, command=False, withprompt=False, confirm=False, title="", copy=False): +def post_control(text, url, command=False, withprompt=False, confirm=False, title="", copy=False, extra_classes=[]): classes = (command and "ajax-command" or " ") + (withprompt and " withprompt" or " ") + (confirm and " confirm" or " ") + \ (copy and " copy" or " ") + + for extra_class in extra_classes: + classes += " %s" % extra_class + return {'text': text, 'url': url, 'classes': classes, 'title': title}