I would like to use the universal code and have ran into difficulties getting the most basic functionality done.
I would like to create a shortname for test and one for my deployment, which I did from the Disqus admin panel.
Here is the disqus code in my show action:
# inside show.html.erb
<%= render raw 'comments' %>
# partial "comments"
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = '<%= Post::DISQUS_SHORTNAME %>';
var disqus_identifier = '<%= @post.id %>';
var disqus_url = '<%= url_for([:blog, @topic, @post])%>';
(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 <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
In my model I define Post
, I define my short name like so:
DISQUS_SHORTNAME = if Rails.env.development?
"dev-shortname".freeze
else
"shortname".freeze
end
I can confirm the loading spinner is functioning but that is it. Am I missing something obvious? When I try to include only_path: false
as a second option in my url_for call, I get an exception stating I have supplied to many arguments to the method. Otherwise my disqus just hangs.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…