Commits

Yury Yurevich committed ba0e503

Delegate comments to FriendFeed.

  • Participants
  • Parent commits f072598

Comments (0)

Files changed (6)

themes/simpyo/base.html

   <link rel="openid.server" href="{% absolute_url openid_endpoint %}"/>
   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
   {% global_js "login-shortcuts" %}
+  {% theme_js "friendfeed" %}
   <script type="text/javascript" src="{% url processed_js %}"></script>
+
   {% block colors_css %}{% theme_css "default_colours" %}{% endblock %}
   {% block extrahead %}{% endblock %}
 </head>

themes/simpyo/blog/post_detail.html

 
 {% block extrahead %}
 {% global_css "highlight" %}
-{% global_js "highlight" %}
+{% global_js "highlight.pack" %}
 {% global_js "comments" %}
 <script type="text/javascript">initHighlightingOnLoad('html', 'css', 'python');</script>
 {% global_js "jquery.form" %}
 {% block content %}
 {% include "blog/post_entry.html" %}
 
-<span class="control-link">
-{% ifapp watchlist %}
-{% load watchlist_tags %}
-  {% if form.subscribe %} {# using CommentForm feature for detection if user is already subscribed to object #}
-  <a class="subscribe-link" href="{% subscribe_url object %}">{% trans "Subscribe" %}</a>
-  {% else %}
-  <a class="subscribe-link" href="{% unsubscribe_url object %}">{% trans "Unsubscribe" %}</a>
-  {% endif %}
-{% endifapp %}
-  <a class="comment-link" onclick="return comment();" href="#">Комментировать</a>
-</span>
+<div class="ff-comment-link comments" id="ff-comment-link-to"><a href="#">Комментарии на FriendFeed</a></div>
 
 {% block pingbacks %}
 {% if object.pingback_count %}
 </div>
 {% endif %}
 {% endblock %}
-
-{% comment_tree_for_object object as comments %}
-{% block comments %}
-<div id="comments"><h2>{% trans "Comments" %}</h2>
-  {% if not comments %}
-    <div>{% trans "No comments for this post" %}</div>
-  {% endif %}
-
-  {% for comment in comments %}
-  {% include "blog/comment.html" %}
-  {% endfor %}
-
-  {% if object.comments_open %}{% if not reply_to %}
-  {% include "blog/comment_form.html" %}
-  {% endif %}{% endif %}
-
-</div>
-{% endblock %}
+<script>
+putFFUrl('http://pyobject.ru{{ object.get_absolute_url }}', '{{ settings.FRIENDFEED_USER }}', '#ff-comment-link-to')
+</script>
 {% endblock %}
 

themes/simpyo/blog/post_entry.html

 {% load bfmarkup %}
 {% endspaceless %}
 
+<script>
+putFFUrl('http://pyobject.ru{{ object.get_absolute_url }}', '{{ settings.FRIENDFEED_USER }}', '#ff-comment-link-{{ object.id }}');
+</script>
+
 <div id="post-{{ object.id }}" class="post">
         <h2><a href="{{ object.get_absolute_url }}">{{ object.name|typogrify }}</a></h2>
     <div class="metadata">
         {{ object.date|datelinks }} {{ object.date|time }}
-      | <a href="{{ object.get_absolute_url }}#comments">{{ object.approved_comments_count }}
-        {{ object.approved_comments_count|choose_plural:_("comment, comments, comments") }}</a>
-        {% if object.pingback_count %}
-      | <a href="{{ object.get_absolute_url }}#pingbacks">{{ object.pingback_count }}
-        {{ object.pingback_count|choose_plural:_("pingback, pingbacks, pingbacks") }}</a>
-        {% endif %}
-      | {% tags_for_object object as tags %}{% render_tag_string tags %}
+        {% tags_for_object object as tags %}{% render_tag_string tags %}
+       <span class="ff-comment-link" id="ff-comment-link-{{ object.id }}">
+       | <a href="#">Комментарии на FriendFeed</a>
+       </span>
     </div>
     <div class="text">
     {% if not post_detail and object.shortable %}

themes/simpyo/blog/post_list.html

 
 {% block extrahead %}
 {% global_css "highlight" %}
-{% global_js "highlight" %}
+{% global_js "highlight.pack" %}
 <script type="text/javascript">initHighlightingOnLoad('html', 'css', 'python');</script>
 {% if tags %}
 <link rel="alternate"

themes/simpyo/static/css/style.css

     background-position: 0 50%;
     padding-left: 16px;
 }
+
+.ff-comment-link {
+    display: none;
+}
+
+#ff-comment-link-to {
+    padding-bottom: 16px;
+}

themes/simpyo/static/js/friendfeed.js

+function putFFUrl(postUrl, user, selector) {
+    $.getJSON(
+        'http://friendfeed-api.com/v2/url?url='+postUrl+'&from='+user+'&callback=?',
+        function (feed, status) {
+            if (feed.entries.length > 0) {
+                $(selector+' a').attr('href', feed.entries[0].url);
+                $(selector).fadeIn();
+            }
+        }
+    )
+}