Commit 9ed0f152

mo khan <mo@mokhan.ca>
2013-07-06 11:07:52
add disqus comments count
1 parent 66e001c
app/views/layouts/_disqus_comments_count.html.erb
@@ -0,0 +1,9 @@
+<script type="text/javascript">
+var disqus_shortname = '<%= ENV['DISQUS_SHORTNAME'] %>';
+(function () {
+  var s = document.createElement('script'); s.async = true;
+  s.type = 'text/javascript';
+  s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
+  (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
+}());
+</script>
app/views/layouts/application.html.erb
@@ -34,6 +34,7 @@
 <%= render "layouts/mixpanel"%>
 <%= render "layouts/embedly"%>
 <%= yield :javascript %>
+<%= render "layouts/disqus_comments_count" %>
 <%= render "layouts/google_analytics" %>
 </body>
 </html>
app/views/shared/_creation_image_gallery.html.erb
@@ -7,7 +7,7 @@
       <h4><small>By <a href="<%= url_for profile_path(creation.user) %>"><%= shrink(creation.user.name, 20) %></a></small></h4>
       <p>
       <a href="<%= url_for creation_favorites_path(:creation_id => creation.id) %>"><span class="badge"><%= creation.favorites.size %> <i class="icon-heart-empty"></i></span></a>
-      <a href="<%= url_for creation %>#comments"><span class="badge badge-success" title="<%= pluralize( creation.comment_threads.size, "comments") %>"><%= creation.comment_threads.size %> <i class="icon-comments"></i></span></a>
+      <span class="badge badge-warning"><i class="icon-comments"> <a href="<%= url_for creation %>#disqus_thread" data-disqus-identifier="c-<%= creation.id %>"></a></i></span>
       </p>
     </div>
     </li>