Skip to content

Instantly share code, notes, and snippets.

@ebryn
Forked from gsmcwhirter/gist:1478455
Created December 14, 2011 21:19
Show Gist options
  • Save ebryn/1478583 to your computer and use it in GitHub Desktop.
Save ebryn/1478583 to your computer and use it in GitHub Desktop.
<script type="text/x-handlebars" data-template-name="blog-post">
{{view Blog.EditFormView contentBinding="content" classBinding="content.isEditing:editing-form"}}
{{view Blog.PostDisplayView contentBinding="content" classBinding="content.isEditing:editing-display"}}
{{#if showComments}}
<div id="disqus_thread"></div>
{{#view contentBinding="content" tagName="script" type="text/javascript"}}
var disqus_shortname = 'ideafreemonoid';
var disqus_identifier = '{{content.slug}}';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
{{/view}}
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by
<span class="logo-disqus">Disqus</span></a>
{{/if}}
</script>
Blog.PostDisplayView = Ember.View.extend({
didInsertElement: function() {
var disqus_shortname = 'ideafreemonoid';
var disqus_identifier = this.getPath('content.slug');
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment