Commit 59449849

mo khan <mo@mokhan.ca>
2014-01-18 17:04:36
hook into disqus to post a comment to cakeside after posted to disqus.
1 parent d3aa634
Changed files (1)
app
views
app/views/shared/_disqus.html.erb
@@ -6,13 +6,18 @@ var disqus_identifier = '<%= id %>';
   var disqus_config = function(){
     this.page.remote_auth_s3 = '<%= disqus_auth %>';
     this.page.api_key = '<%= ENV['DISQUS_API_KEY'] %>';
+    this.callbacks.onNewComment = [function(comment) { 
+      $.post("/comments", { id: comment.id }, function(result){
+        console.log(result);
+      });
+    }];
   };
 <% end %>
 (function() {
-  var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
-  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-})();
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+ dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+ })();
 </script>
 <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
 <a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>