Sha256: c3213f8d09c3267a4850cb2f33f4d6def2c848ca8ad0ce9e5a1b91403954e244

Contents?: true

Size: 1.46 KB

Versions: 9

Compression:

Stored size: 1.46 KB

Contents

module Refinery
  module Helpers
    module ScriptHelper

      # 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.
      def jquery_include_tags(options={})
        # Merge in options
        options = {
          :caching => RefinerySetting.find_or_set(:use_resource_caching, Rails.root.writable?),
          :google => RefinerySetting.find_or_set(:use_google_ajax_libraries, false),
          :jquery_ui => true
        }.merge(options)

        # render the tags normally unless
        unless options[:google] and !local_request?
          if options[:jquery_ui]
            javascript_include_tag  "jquery#{"-min" if Rails.env.production?}", "jquery-ui-custom-min",
                                    :cache => (options[:caching] ? "cache/jquery" : nil)
          else
            javascript_include_tag "jquery#{"-min" if Rails.env.production?}"
          end
        else
          "#{javascript_include_tag("http://www.google.com/jsapi").gsub(".js", "")}
          <script type='text/javascript'>
            google.load('jquery', '1.4');
            #{"google.load('jqueryui', '1.8');" if options[:jquery_ui]}
          </script>".html_safe
        end
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
refinerycms-0.9.8.9 vendor/refinerycms/core/lib/refinery/helpers/script_helper.rb
refinerycms-0.9.8.8 vendor/refinerycms/core/lib/refinery/helpers/script_helper.rb
refinerycms-0.9.8.7 vendor/refinerycms/core/lib/refinery/helpers/script_helper.rb
refinerycms-0.9.8.6 vendor/refinerycms/core/lib/refinery/helpers/script_helper.rb
refinerycms-0.9.8.5 vendor/refinerycms/core/lib/refinery/helpers/script_helper.rb
refinerycms-0.9.8.4 vendor/refinerycms/core/lib/refinery/helpers/script_helper.rb
refinerycms-0.9.8.3 vendor/refinerycms/core/lib/refinery/helpers/script_helper.rb
refinerycms-0.9.8.2 vendor/refinerycms/core/lib/refinery/helpers/script_helper.rb
refinerycms-0.9.8.1 vendor/refinerycms/core/lib/refinery/helpers/script_helper.rb