Permalink
Browse files

Add a phileo_widget_brief tag

  • Loading branch information...
1 parent 8af1ad7 commit 0a5ea5c1ddfbe28ffbfeedc679d53fbea2d63b46 @paltman paltman committed Nov 19, 2012
Showing with 28 additions and 1 deletion.
  1. +7 −0 docs/templatetags.rst
  2. +12 −0 phileo/templates/phileo/_widget_brief.html
  3. +5 −0 phileo/templatetags/phileo_tags.py
  4. +4 −1 phileo/views.py
View
@@ -62,6 +62,13 @@ are the user and the object.::
It renders "phileo/_widget.html" and can be overridden as desired.
+phileo_widget_brief
+-------------------
+
+Same, functionally, as `phileo_widget`, except that it renders
+"phileo/_widget_brief.html" instead.
+
+
liked
-----
@@ -0,0 +1,12 @@
+<div class="phileo">
+ {% if can_like %}
+ <a class="btn ajax"
+ data-method="post"
+ data-replace-closest=".phileo"
+ data-spinner="off"
+ href="{{ like_url }}?t=b"
+ title="{{ like_text }}">
+ <i class="icon {{ like_class }}"></i>
+ </a>
+ {% endif %}
+</div>
@@ -133,6 +133,11 @@ def phileo_widget(user, obj):
return widget_context(user, obj)
+@register.inclusion_tag("phileo/_widget_brief.html")
+def phileo_widget_brief(user, obj):
+ return widget_context(user, obj)
+
+
class LikedObjectsNode(template.Node):
def __init__(self, objects, user, varname):
View
@@ -40,9 +40,12 @@ def like_toggle(request, content_type_id, object_id):
if request.is_ajax():
html_ctx = widget_context(request.user, obj)
+ template = "phileo/_widget.html"
+ if request.GET.get("t") == "b":
+ template = "phileo/_widget_brief.html"
data = {
"html": render_to_string(
- "phileo/_widget.html",
+ template,
html_ctx,
context_instance=RequestContext(request)
),

0 comments on commit 0a5ea5c

Please sign in to comment.