Module: Refinery::Helpers::ScriptHelper
- Defined in:
- lib/refinery/helpers/script_helper.rb
Instance Method Summary collapse
-
#jquery_include_tags(options = {}) ⇒ Object
This function helps when including both the jquery and jqueryui libraries.
Instance Method Details
#jquery_include_tags(options = {}) ⇒ Object
This function helps when including both the jquery and jqueryui libraries. If you use this function then whenever we update or relocate the version of jquery or jquery ui in use we will update the reference here and your existing application starts to use it. Use <%= jquery_include_tags %> to include it in your <head> section.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/refinery/helpers/script_helper.rb', line 9 def (={}) # Merge in options = { :caching => (Rails.root.writable? and RefinerySetting.find_or_set(:use_resource_caching, true)), :google => RefinerySetting.find_or_set(:use_google_ajax_libraries, false), :jquery_ui => true }.merge() # render the tags normally unless unless [:google] and !local_request? if [:jquery_ui] javascript_include_tag "jquery#{"-min" if Rails.env.production?}", "jquery-ui-custom-min", :cache => ("cache/jquery" if [:caching]) else javascript_include_tag "jquery#{"-min" if Rails.env.production?}" end else "#{javascript_include_tag("http://www.google.com/jsapi").gsub(".js", "")} <script> google.load('jquery', '1.5.2'); #{"google.load('jqueryui', '1.8.9');" if [:jquery_ui]} </script>".html_safe end end |