Permalink
Browse files

Adding Disqus for comments

  • Loading branch information...
1 parent 470be05 commit 2982bfdb84c15f7afcc1d13e445f9119e3083062 @andmej committed Jul 5, 2011
@@ -0,0 +1,18 @@
+<div id="disqus_thread"></div>
+<script type="text/javascript">
+ var disqus_shortname = 'andmej';
+
+ var disqus_developer = 1;
+
+ var disqus_identifier = 'post_<%= @post.id %>';
+ var disqus_url = '<%= post_url(@post) %>';
+ var disqus_title = '<%= @post.title %>';
+
+ /* * * DON'T EDIT BELOW THIS LINE * * */
+ (function() {
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+ dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+ })();
+</script>
+<noscript>Please enable JavaScript to view the comments.</noscript>
@@ -15,11 +15,13 @@
</div>
<div class="footer">
<div class="comments">
- <%= link_to pluralize(post.comments.count, "comment"), post_path(post, :anchor => "comments") %>
+ <%= link_to "Comments", post_path(post, :anchor => "disqus_thread"), :"data-disqus-identifier" => "post_#{post.id}" %>
</div>
</div>
<% if logged_in? %>
<%= link_to "Edit", edit_admin_post_path(post) %>
<% end %>
</div>
-<% end %>
+<% end %>
+
+<%= render "shared/disqus_comment_count" %>
@@ -15,11 +15,9 @@
</div>
<div class="footer">
<a name="comments"></a>
- <div class="comments-count">
- <%= pluralize @post.comments.count, "comment" %>
- </div>
+ <div class="comments-count"></div>
<div class="comments">
- <%= render :partial => "comment", :collection => @post.comments %>
+ <%= render "comments" %>
</div>
<div class="comments-footer">
</div>
@@ -0,0 +1,10 @@
+<script type="text/javascript">
+ var disqus_shortname = 'andmej';
+
+ (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>
@@ -0,0 +1,36 @@
+#disqus_thread {
+ padding: 20px;
+ margin-bottom: 0px !important;
+ color: #352A45;
+
+ a {
+ text-decoration: none;
+ border-bottom: 1px dotted #553687 !important;
+ color: #553687;
+ }
+
+ a:hover {
+ background-color: #bbb3c7;
+ }
+
+ .dsq-toolbar-item {
+ opacity: 0.7;
+ }
+
+ .dsq-comment-meta, .dsq-comment-actions {
+ overflow: visible;
+ a {
+ opacity: 0.9;
+ }
+ }
+
+ #dsq-footer {
+ em {
+ text-decoration: none;
+ }
+ }
+
+ .dsq-item-trackback, .dsq-trackback-url, .dsq-item-sort, #dsq-sort-select { /* Hide some parts of Disqus that I don't like. */
+ display: none;
+ }
+}
@@ -287,6 +287,28 @@ h3 {
width: 780px;
margin: auto; }
+#disqus_thread {
+ padding: 20px;
+ margin-bottom: 0px !important;
+ color: #352A45; }
+ #disqus_thread a {
+ text-decoration: none;
+ border-bottom: 1px dotted #553687 !important;
+ color: #553687; }
+ #disqus_thread a:hover {
+ background-color: #bbb3c7; }
+ #disqus_thread .dsq-toolbar-item {
+ opacity: 0.7; }
+ #disqus_thread .dsq-comment-meta, #disqus_thread .dsq-comment-actions {
+ overflow: visible; }
+ #disqus_thread .dsq-comment-meta a, #disqus_thread .dsq-comment-actions a {
+ opacity: 0.9; }
+ #disqus_thread #dsq-footer em {
+ text-decoration: none; }
+ #disqus_thread .dsq-item-trackback, #disqus_thread .dsq-trackback-url, #disqus_thread .dsq-item-sort, #disqus_thread #dsq-sort-select {
+ /* Hide some parts of Disqus that I don't like. */
+ display: none; }
+
#footer {
height: 357px;
width: 962px;
@@ -3,4 +3,5 @@
@import "header";
@import "home";
@import "posts";
+@import "disqus";
@import "footer";

0 comments on commit 2982bfd

Please sign in to comment.