Sha256: a5067cd566c413f28759fd6937622ec43bd34d7d6e33f90a0cd7446c10ab81da

Contents?: true

Size: 1.81 KB

Versions: 2

Compression:

Stored size: 1.81 KB

Contents

# encoding: utf-8

module PapermillHelper
  
  # Sets all the javascript needed for papermill.
  # If jQuery and JQueryUI (with Sortable) are already loaded, call papermill_javascript_tag
  # If you use some other JS Framework, call papermill_javascript_tag(:with_jquery => "no_conflict")
  # If you want to rely on this helper to load jQuery and JQueryUI and use them after, call papermill_javascript_tag(:with_jquery => true)
    
  def papermill_javascript_tag(options = {})
    html = []
    html << %{<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>\
      <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js" type="text/javascript"></script>} if options[:with_jquery]
    html << %{<script type="text/javascript">}
    html << %{jQuery.noConflict();} if options[:with_jquery].to_s == "no_conflict"
    html << %{</script>}
    html << javascript_include_tag("/facebox/facebox.js", "/jgrowl/jquery.jgrowl_minimized.js", "/Jcrop/jquery.Jcrop.min.js", "/swfupload/swfupload.js", "/papermill/papermill.js", :cache => "papermill")
    unless @content_for_papermill_inline_js.blank?
      html << %{<script type="text/javascript">}
      html << %{jQuery(document).ready(function() {#{@content_for_papermill_inline_js}});}
      html << %{</script>}
    end
    html.join("\n")
  end
  
  # Sets the css tags needed for papermill.
  def papermill_stylesheet_tag(options = {})
    html = []
    html << stylesheet_link_tag("/facebox/facebox.css", "/jgrowl/jquery.jgrowl.css", "/Jcrop/jquery.Jcrop.css", "/papermill/papermill.css", :cache => "papermill")
    unless @content_for_papermill_inline_css.blank?
      html << %{<style type="text/css">}
      html << @content_for_papermill_inline_css
      html << %{</style>}
    end
    html.join("\n")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
papermill-2.1.1 lib/papermill/papermill_helper.rb
papermill-2.1.0 lib/papermill/papermill_helper.rb