Permalink
Browse files

lib: rename GitHelper -> MainHelper.

Clean (disqus_show). Move it to main helper. The method
supports arguments to specify the Disqus shortname
  • Loading branch information...
1 parent 38d6ce8 commit 71f674a7c4de0528f1767d532b23570e80ae6e88 @icy icy committed Jul 25, 2012
Showing with 20 additions and 18 deletions.
  1. +0 −16 lib/default.rb
  2. +19 −1 lib/helpers/{git_helper.rb → main_helper.rb}
  3. +1 −1 lib/helpers_.rb
View
@@ -6,19 +6,3 @@
include Nanoc::Helpers::HTMLEscape
include Nanoc::Helpers::LinkTo
include Nanoc::Helpers::Tagging
-
-def disqus_show
- <<-EOF
- <div id="disqus_thread"></div>
- <script type="text/javascript">
- var disqus_shortname = 'archlinuxvn';
- (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">comments powered by <span class="logo-disqus">Disqus</span></a>
- EOF
-end
@@ -5,7 +5,25 @@
require 'cgi'
-module GitHelper
+module MainHelper
+
+ # @purpose: print the Disqus comment form
+ # @id : the short name of your disqus identity
+ # @return : string
+ def disqus_show(id = "archlinuxvn")
+ <<EOF
+ <div id="disqus_thread"></div>
+ <script type="text/javascript">
+ (function() {
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+ dsq.src = 'http://#{id}.disqus.com/embed.js';
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+ })();
+ </script>
+ <noscript>Javascript is required to view comment(s).</a></noscript>
+ <a href="http://disqus.com" class="dsq-brlink">comments powered by Disqus</a>
+EOF
+ end
# @purpose: Find the file name associated to an item
# @author : Anh K. Huynh
View
@@ -3,4 +3,4 @@
# all changes will be simply ignored by server #
########################################################################
-include GitHelper
+include MainHelper

0 comments on commit 71f674a

Please sign in to comment.