Sha256: fdd21249947541d0b3549d823b4c5924f883a67368dc2141f253e20445b48936
Contents?: true
Size: 686 Bytes
Versions: 22
Compression:
Stored size: 686 Bytes
Contents
module Phrase::ViewHelpers def phrase_javascript(auth_token=nil) return "" unless Phrase.enabled? auth_token ||= Phrase.auth_token js = %{<script> //<![CDATA[ var phrase_auth_token = '#{auth_token}'; (function() { var phraseapp = document.createElement('script'); phraseapp.type = 'text/javascript'; phraseapp.async = true; phraseapp.src = ['#{Phrase.js_use_ssl ? 'https' : 'http'}://', '#{Phrase.js_host}/assets/phrase/#{Phrase.client_version}/app.js?', new Date().getTime()].join(''); var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(phraseapp, s); })(); //]]> </script>} js.html_safe end end
Version data entries
22 entries across 22 versions & 1 rubygems
Version | Path |
---|---|
phrase-0.1.2 | lib/phrase/view_helpers.rb |
phrase-0.1.1 | lib/phrase/view_helpers.rb |