Class: Alula::Disqus

Inherits:
Object
  • Object
show all
Defined in:
lib/alula/plugins/disqus.rb

Class Method Summary collapse

Class Method Details

.install(options) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/alula/plugins/disqus.rb', line 15

def self.install(options)
  return false unless options.shortname
  
  Alula::Plugin.script(:post_bottom, ->(context) {
    <<-EOS
    var disqus_shortname = '#{options['shortname']}';
    var disqus_identifier = '#{context.item..disqus_identifier || context.item.slug}';
    (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);
      })();
    EOS
  }
  )
end

.pathObject



7
8
9
# File 'lib/alula/plugins/disqus.rb', line 7

def self.path
  File.join(File.dirname(__FILE__), %w{.. .. .. plugins disqus})
end

.versionObject



11
12
13
# File 'lib/alula/plugins/disqus.rb', line 11

def self.version
  Alula::Plugins::VERSION::STRING
end