Sha256: b0ee96ff79b6a526dd9745b9a8a582ff39a9c909322ce79b5883d674695e822c

Contents?: true

Size: 1.46 KB

Versions: 9

Compression:

Stored size: 1.46 KB

Contents

module PapermillHelper
  
  def papermill_javascript_tag(options = {})
    html = []
    root_folder = options[:path] || "javascripts"
    if options[:with_jquery] || options[:with_jqueryui]
      html << %{<script src="http://www.google.com/jsapi"></script>}
      html << %{<script type="text/javascript">\n//<![CDATA[}
      html << %{google.load("jquery", "1");} if options[:with_jquery]
      html << %{google.load("jqueryui", "1");} if options[:with_jquery] || options[:with_jqueryui]
      html << %{</script>}
    end
    html << %{<script src="http://swfupload.googlecode.com/svn/swfupload/tags/swfupload_v2.2.0_core/swfupload.js"></script>}
    html << %{<script type="text/javascript">\n//<![CDATA[}
    ["SWFUPLOAD_PENDING", "SWFUPLOAD_LOADING", "SWFUPLOAD_ERROR"].each do |js_constant|
      html << %{var #{js_constant} = "#{I18n.t(js_constant, :scope => "papermill")}";}
    end
    html << %{//]]>\n</script>}
    html << javascript_include_tag("/#{root_folder}/papermill", :cache => "swfupload-papermill")
    html << '<script type="text/javascript">jQuery(document).ready(function() {'
    html << @content_for_inline_js
    html << '});</script>'
    html.join("\n")
  end
  
  def papermill_stylesheet_tag(options = {})
    html = []
    root_folder = options[:path] || "stylesheets"
    html << stylesheet_link_tag("/#{root_folder}/papermill")
    html << %{<style type="text/css">}
    html << @content_for_inline_css
    html << %{</style>}
    html.join("\n")
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
BBenezech-papermill-0.1.0 lib/papermill/papermill_helper.rb
BBenezech-papermill-0.1.1 lib/papermill/papermill_helper.rb
BBenezech-papermill-0.1.2 lib/papermill/papermill_helper.rb
BBenezech-papermill-0.1.3 lib/papermill/papermill_helper.rb
BBenezech-papermill-0.1.4 lib/papermill/papermill_helper.rb
BBenezech-papermill-0.2.0 lib/papermill/papermill_helper.rb
BBenezech-papermill-0.2.1 lib/papermill/papermill_helper.rb
BBenezech-papermill-0.2.2 lib/papermill/papermill_helper.rb
BBenezech-papermill-0.3.0 lib/papermill/papermill_helper.rb