Sha256: 80154a07c0f4f2a846b1185c5d4d58b86c4596fbbee816123c2d65ca09344657

Contents?: true

Size: 644 Bytes

Versions: 1

Compression:

Stored size: 644 Bytes

Contents

module Phrase::ViewHelpers
  
  def phrase_javascript(auth_token=nil)
    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

1 entries across 1 versions & 1 rubygems

Version Path
phrase-0.1 lib/phrase/view_helpers.rb