Sha256: a7f82e7065c6dbc94ebdf02aab58de5b674d8991b3a43c430b53796d66fd90d8

Contents?: true

Size: 1.45 KB

Versions: 18

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.0');
            #{"google.load('jqueryui', '1.8.9');" if options[:jquery_ui]}
          </script>".html_safe
        end
      end

    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
refinerycms-core-0.9.9.19 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.18 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.17 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.16 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.15 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.14 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.13 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.12 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.11 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.10 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.9 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.8 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.7 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.5 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.4 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.3 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.2 lib/refinery/helpers/script_helper.rb
refinerycms-core-0.9.9.1 lib/refinery/helpers/script_helper.rb