Sha256: 77eab6ced529f2f6abe8ca56e398da122539cfa84d113a94a64fbfeb94d55d79

Contents?: true

Size: 1.45 KB

Versions: 13

Compression:

Stored size: 1.45 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 => (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(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 => ("cache/jquery" if options[: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 options[:jquery_ui]}
          </script>".html_safe
        end
      end

    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
refinerycms-core-1.0.11 lib/refinery/helpers/script_helper.rb
refinerycms-core-1.0.10 lib/refinery/helpers/script_helper.rb
refinerycms-core-1.0.9 lib/refinery/helpers/script_helper.rb
refinerycms-core-1.0.8 lib/refinery/helpers/script_helper.rb
refinerycms-core-1.0.7 lib/refinery/helpers/script_helper.rb
refinerycms-core-1.0.5 lib/refinery/helpers/script_helper.rb
refinerycms-core-1.0.4 lib/refinery/helpers/script_helper.rb
refinerycms-core-1.0.3 lib/refinery/helpers/script_helper.rb
refinerycms-core-1.0.1 lib/refinery/helpers/script_helper.rb
refinerycms-core-1.0.0 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.22 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.21 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.20 lib/refinery/helpers/script_helper.rb