Sha256: 87f044a5b01b192a1b38a4a700402eec233ebd93344481e244de036266ca988f
Contents?: true
Size: 1.94 KB
Versions: 11
Compression:
Stored size: 1.94 KB
Contents
module PapermillHelper # Sets all the javascript needed for papermill. # If you already loaded jQuery and JQueryUI, call papermill_javascript_tag # If you don't use jQuery or use some other library, call papermill_javascript_tag(:with_jquery => "no_conflict") # If you want to rely on this helper to load jQuery/jQueryUI and use it, call papermill_javascript_tag(:with_jquery => true) # If you loaded jQuery and need to load only jQueryUI, call papermill_javascript_tag(:with_jqueryui_only => true) def papermill_javascript_tag(options = {}) html = [] if options[:with_jquery] || options[:with_jqueryui] html << %{<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"</script>} if options[:with_jquery] html << %{<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"</script>} if options[:with_jquery] || options[:with_jqueryui_only] html << %{<script type="text/javascript">jQuery.noConflict();</script>} if options[:with_jquery] == "no_conflict" end html << %{<script type="text/javascript">} ["SWFUPLOAD_PENDING", "SWFUPLOAD_LOADING", "SWFUPLOAD_ERROR"].each do |js_constant| html << %{var #{js_constant} = "#{t("papermill.#{js_constant}")}";} end html << %{</script>} html << javascript_include_tag("/papermill/papermill", "/papermill/swfupload") unless @content_for_papermill_inline_js.blank? html << '<script type="text/javascript">jQuery(document).ready(function() {' html << @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("/papermill/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
11 entries across 11 versions & 1 rubygems