Module: IntenseDebateCommentsPortletHelper
- Defined in:
- lib/bcms_intensedebate/intense_debate_comments_portlet_helper.rb
Instance Method Summary collapse
-
#id_comments(obj, options = {}) ⇒ Object
Add the full comments list to a page.
-
#id_comments_link(obj, options = {}) ⇒ Object
Add a comments counter and link to the item.
Instance Method Details
#id_comments(obj, options = {}) ⇒ Object
Add the full comments list to a page.
Options
-
:url - The URL to the page. Optional.
-
:intensedebate_account - Probably already configured in the initializer. Optional.
-
:title - The title of the page. Optional.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bcms_intensedebate/intense_debate_comments_portlet_helper.rb', line 10 def id_comments(obj, = {}) .symbolize_keys! .assert_valid_keys(:intensedebate_account, :url, :title) [:intensedebate_account] = acct_no unless [:intensedebate_account] raise ArgumentError, "You must specify an IntenseDebate account number", if [:intensedebate_account].nil? raise "Intense Debate account no. doesn't look valid" unless [:intensedebate_account] =~ /[\w]{32}/ %Q| <script type="text/javascript"> var idcomments_acct = "#{ [:intensedebate_account] }"; var idcomments_post_id = "#{obj.class.name}-#{ obj.id }"; var idcomments_post_url #{ "='%s'" % [:url] unless [:url].nil? }; var idcomments_post_title #{ "='%s'" % [:title] unless [:title].nil? }; </script> <span id="IDCommentsPostTitle" style="display:none"></span> <script type="text/javascript" src="http://www.intensedebate.com/js/genericCommentWrapperV2.js"></script> | end |
#id_comments_link(obj, options = {}) ⇒ Object
Add a comments counter and link to the item.
Options
-
:intensedebate_account - Probably already configured in the initializer. Optional.
-
:url - The URL. Optional, but required if obj is not RESTful.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/bcms_intensedebate/intense_debate_comments_portlet_helper.rb', line 35 def id_comments_link(obj, = {}) .symbolize_keys! .assert_valid_keys(:intensedebate_account, :url) [:intensedebate_account] = acct_no unless [:intensedebate_account] raise ArgumentError, "You must specify an IntenseDebate account number", if [:intensedebate_account].nil? raise "Intense Debate account no. doesn't look valid" unless [:intensedebate_account] =~ /[\w]{32}/ %Q| <script type="text/javascript"> var idcomments_acct = "#{ [:intensedebate_account] }"; var idcomments_post_id = "#{ obj.id }"; var idcomments_post_url = "#{ [:url] ? [:url] : self.send( :"#{obj.class.to_s.underscore}_path", obj ) }"; </script> <script type="text/javascript" src="http://www.intensedebate.com/js/genericLinkWrapperV2.js"></script> | end |