Module: RailsJqueryBundle::JqueryJsHelper

Includes:
Constants::Jquery, Constants::Jquery::Ui
Defined in:
app/helpers/rails_jquery_bundle/jquery_js_helper.rb

Constant Summary

Constants included from Constants::Jquery::Ui

Constants::Jquery::Ui::JQUERY_UI_ALL_FILENAME, Constants::Jquery::Ui::JQUERY_UI_ALL_I18N_FILENAME, Constants::Jquery::Ui::JQUERY_UI_BASE, Constants::Jquery::Ui::JQUERY_UI_EFFECTS_FILE_PATTERN, Constants::Jquery::Ui::JQUERY_UI_EFFECTS_FILE_PATTERN_MIN, Constants::Jquery::Ui::JQUERY_UI_I18N_FILE_PATTERN, Constants::Jquery::Ui::JQUERY_UI_THEMES_BASE, Constants::Jquery::Ui::JQUERY_UI_UI_FILE_PATTERN, Constants::Jquery::Ui::JQUERY_UI_UI_FILE_PATTERN_MIN, Constants::Jquery::Ui::JQUERY_UI_VERSION, Constants::Jquery::Ui::STYLESHEETS_BASE, Constants::Jquery::Ui::STYLESHEET_FILNAME

Constants included from Constants::Jquery

Constants::Jquery::JQUERY_BASE, Constants::Jquery::JQUERY_FILENAME, Constants::Jquery::JQUERY_FILENAME_MIN, Constants::Jquery::JQUERY_VERSION, Constants::Jquery::PRODUCTION_SUB_FOLDER

Instance Method Summary collapse

Instance Method Details

#jquery_js_tagString

Creates a includetag for only for jQuery: for production environment:

  • javascripts/jquery/JQUERY_VERSION/minified/jquery.js

all other environments:

  • javascripts/jquery/JQUERY_VERSION/jquery.js

Examples:

include jQuery

javascript_include_tag

Returns:

  • (String)

    Javascript includetag for jquery



23
24
25
# File 'app/helpers/rails_jquery_bundle/jquery_js_helper.rb', line 23

def jquery_js_tag
  javascript_include_tag([JQUERY_BASE,JQUERY_VERSION,production_folder, jquery_filename].compact.join('/')).html_safe
end

#jquery_ui_js_tag(wanted_parts = :all) ⇒ String

Creates a includetag(s) for jQuery and jQuery-Ui: for production environment:

  • javascripts/jquery/ui/JQUERY_UI_VERSION/minified/*js

all other environments:

  • javascripts/jquery/ui/JQUERY_UI_VERSION/*js

jquery.ui.core.js is included in evry case

Examples:

include some effects, ui and i18n

jquery_ui_js_tag :ui => [:datepicker], :effects => [:shake] , :i18n => "datepicker-de"

include all effects, all ui and all i18n

jquery_ui_js_tag :all

Parameters:

  • wanted_parts (Hash, Symbol) (defaults to: :all)

Options Hash (wanted_parts):

  • :all (Symbol)

    includes jquery-ui.all.js, jquery-ui-i18n.js

  • :ui (Array)

    Ui-Files which should all be included

  • :effects (Array)

    Effect-Files which should all be included

  • :i18n (Array)

    i18n-Files which should be included

Returns:

  • (String)

    Javascript includetag for jquery-ui and i18n



45
46
47
48
49
50
51
# File 'app/helpers/rails_jquery_bundle/jquery_js_helper.rb', line 45

def jquery_ui_js_tag(wanted_parts=:all)
  [jquery_js_tag,
   jquery_ui_js_tags(wanted_parts)
  ].flatten.
    join("\n").
    html_safe
end