Module: Settlebox::ViewHelpers
- Defined in:
- lib/settlebox/view_helpers.rb
Instance Method Summary collapse
- #settlebox_card_tag(email) ⇒ Object
- #settlebox_include_tag(async = true) ⇒ Object
- #settlebox_listing_tag(email, href = false) ⇒ Object
- #settlebox_reputation_tag(email) ⇒ Object
Instance Method Details
#settlebox_card_tag(email) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/settlebox/view_helpers.rb', line 53 def settlebox_card_tag(email) demail = crypt_email(email) unless email =~ /^demo_.*@settlebox.com$/ "<div class='settlebox-card' data-sb-email='#{demail}' data-sb-email-plain=#{email}></div>".html_safe else "<div class='settlebox-card' data-sb-demo='true'></div>".html_safe end end |
#settlebox_include_tag(async = true) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/settlebox/view_helpers.rb', line 11 def settlebox_include_tag(async=true) ret = "" api_key = Settlebox.configuration.api_key language = Settlebox.configuration.language api_version = Settlebox::API_VERSION url = Settlebox.configuration.url ? Settlebox.configuration.url : "https://settlebox.com" src = "#{url}/assets/widgets/reputation.js"; ret += "\n<script>\n"; ret += "(function(w,d,t,u,o,k,l,v,e,p){"; ret += "w[o]=w[o]||{};"; ret += "w[o].key=k;"; ret += "w[o].lang=l;"; ret += "w[o].ver=v;"; ret += "e=d.createElement(t);"; ret += "p=d.getElementsByTagName(t)[0];"; if async ret += "e.async=1;"; else ret += "w[o].sync=!0;"; end ret += "e.src=u;"; ret += "p.parentNode.insertBefore(e,p);"; ret += "}(window,document,'script','#{src}','SB','#{api_key}', '#{language}', '#{api_version}'));"; ret += "\n</script>\n"; ret.html_safe end |
#settlebox_listing_tag(email, href = false) ⇒ Object
47 48 49 50 51 |
# File 'lib/settlebox/view_helpers.rb', line 47 def settlebox_listing_tag(email, href = false) demail = crypt_email(email) href = href ? href : "https://settlebox.com" "<div class='settlebox-listing' data-sb-email='#{demail}' data-sb-href='#{href}'></div>".html_safe end |
#settlebox_reputation_tag(email) ⇒ Object
42 43 44 45 |
# File 'lib/settlebox/view_helpers.rb', line 42 def settlebox_reputation_tag(email) demail = crypt_email(email) "<div id='settlebox-reputation' data-sb-email='#{demail}'></div>".html_safe end |