summaryrefslogtreecommitdiff
path: root/app/views/shared
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-01-18 10:04:36 -0700
committermo khan <mo@mokhan.ca>2014-01-18 10:04:36 -0700
commit59449849d08dbbae197cfcc9f60c6db6a15ebce3 (patch)
treefd2754d83d334ae005bc9e7a49fa5d8954e4c8f4 /app/views/shared
parentd3aa634c32b253c10bff5034e3a03b20c58f901e (diff)
hook into disqus to post a comment to cakeside after posted to disqus.
Diffstat (limited to 'app/views/shared')
-rw-r--r--app/views/shared/_disqus.html.erb13
1 files changed, 9 insertions, 4 deletions
diff --git a/app/views/shared/_disqus.html.erb b/app/views/shared/_disqus.html.erb
index 4844682b..f5ebff1d 100644
--- a/app/views/shared/_disqus.html.erb
+++ b/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>