compass-jquery-plugin 0.3.2.3 → 0.3.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +54 -37
- data/VERSION.yml +1 -1
- data/lib/handle_attributes.rb +4 -4
- data/lib/handle_js_files.rb +5 -5
- data/lib/jqtouch_theme.rb +2 -2
- data/lib/jquery/dynatree.rb +2 -2
- data/lib/jquery/emulators.rb +1 -1
- data/lib/jquery/flash_messages.rb +6 -6
- data/lib/jquery/graphics.rb +5 -0
- data/lib/jquery/gridify/assertions.rb +1 -1
- data/lib/jquery/gridify/grid.rb +76 -59
- data/lib/jquery/gridify/grid_column.rb +73 -67
- data/lib/jquery/gridify/grid_finder.rb +79 -79
- data/lib/jquery/gridify/grid_options.rb +154 -149
- data/lib/jquery/gridify/grid_view.rb +143 -143
- data/lib/jquery/gridify.rb +25 -25
- data/lib/jquery/ical/calendar.rb +2 -2
- data/lib/jquery/ical/event.rb +48 -44
- data/lib/jquery/ical/helpers/ui_event_helper.rb +3 -3
- data/lib/jquery/jqgrid/jqgrid.rb +58 -58
- data/lib/jquery/jqgrid.rb +1 -1
- data/lib/jquery/jqtouch.rb +1 -1
- data/lib/jquery/jquery.rb +117 -117
- data/lib/jquery/jquery_auto_complete.rb +9 -9
- data/lib/jquery/jquery_json_response.rb +12 -12
- data/lib/jquery/jquery_selector_assertions.rb +55 -53
- data/lib/jquery/jstree.rb +2 -2
- data/lib/jquery/mobile.rb +1 -1
- data/lib/jquery/ribbon.rb +2 -2
- data/lib/jquery/secret_sauce/controller/ui_dialog_controls.rb +5 -5
- data/lib/jquery/secret_sauce/controller/ui_grid_controls.rb +5 -5
- data/lib/jquery/secret_sauce/helpers/ui_dialog_helper.rb +1 -1
- data/lib/jquery/secret_sauce/helpers/ui_form_helper.rb +39 -39
- data/lib/jquery/secret_sauce/helpers/ui_grid_helper.rb +74 -74
- data/lib/jquery/secret_sauce/model/find_for_grid.rb +21 -21
- data/lib/jquery/secret_sauce.rb +1 -1
- data/lib/jquery/tools.rb +1 -1
- data/lib/jquery_mobile_theme.rb +2 -2
- data/lib/jquery_ui_theme.rb +12 -12
- data/templates/dynatree/config/initializers/dynatree.rb +3 -3
- data/templates/dynatree/jquery/dynatree/aero.scss +16 -16
- data/templates/dynatree/jquery/dynatree/aqua.scss +16 -16
- data/templates/dynatree/jquery/dynatree/crystal.scss +16 -16
- data/templates/dynatree/jquery/dynatree/xp.scss +17 -17
- data/templates/dynatree/jquery.dynatree.js +2926 -2912
- data/templates/emulators/config/initializers/emulators.rb +6 -6
- data/templates/graphics/config/initializers/graphics.rb +5 -0
- data/templates/graphics/jquery/ganttView.scss +89 -0
- data/templates/graphics/jquery.ganttView.js +1669 -0
- data/templates/graphics/jquery.ganttView.min.js +70 -0
- data/templates/{jquery → graphics}/jquery.sparkline.js +466 -438
- data/templates/{jquery → graphics}/jquery.sparkline.min.js +0 -0
- data/templates/graphics/manifest.rb +9 -0
- data/templates/jqgrid/config/initializers/jqgrid.rb +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-ar.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-bg.js +135 -131
- data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +135 -131
- data/templates/jqgrid/i18n/jqgrid/locale-cat.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-cn.js +137 -131
- data/templates/jqgrid/i18n/jqgrid/locale-cs.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-da.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-de.js +138 -132
- data/templates/jqgrid/i18n/jqgrid/locale-el.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-en.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-es.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-fa.js +19 -16
- data/templates/jqgrid/i18n/jqgrid/locale-fi.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-fr.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-gl.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-he.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-hu.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-is.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-it.js +8 -1
- data/templates/jqgrid/i18n/jqgrid/locale-ja.js +139 -136
- data/templates/jqgrid/i18n/jqgrid/locale-nl.js +4 -1
- data/templates/jqgrid/i18n/jqgrid/locale-no.js +14 -1
- data/templates/jqgrid/i18n/jqgrid/locale-pl.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-pt.js +130 -124
- data/templates/jqgrid/i18n/jqgrid/locale-ro.js +144 -138
- data/templates/jqgrid/i18n/jqgrid/locale-ru.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-sk.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-sr.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-sv.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-tr.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-ua.js +132 -126
- data/templates/jqgrid/jquery.jqGrid.js +12735 -10444
- data/templates/jqgrid/jquery.jqGrid.min.js +477 -469
- data/templates/jqgrid/public/stylesheets/ellipsis-xbl.xml +12 -10
- data/templates/jqtouch/config/initializers/jqtouch.rb +3 -3
- data/templates/jqtouch/jquery/touch/jqtouch.scss +1 -1
- data/templates/jqtouch/jquery.jqtouch.js +10025 -10043
- data/templates/jquery/config/initializers/jquery.rb +2 -4
- data/templates/jquery/history.adapter.jquery.js +71 -0
- data/templates/jquery/history.adapter.jquery.min.js +4 -0
- data/templates/jquery/history.html4.js +690 -0
- data/templates/jquery/history.html4.min.js +21 -0
- data/templates/jquery/history.js +1297 -0
- data/templates/jquery/history.min.js +29 -0
- data/templates/jquery/i18n/jquery.ui/datepicker-af.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ar-DZ.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-ar.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-az.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-bg.js +8 -8
- data/templates/jquery/i18n/jquery.ui/datepicker-bs.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ca.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-cs.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-da.js +14 -14
- data/templates/jquery/i18n/jquery.ui/datepicker-de.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-el.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-AU.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-GB.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-NZ.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-eo.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-es.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-et.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-eu.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fa.js +18 -18
- data/templates/jquery/i18n/jquery.ui/datepicker-fi.js +15 -15
- data/templates/jquery/i18n/jquery.ui/datepicker-fo.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fr-CH.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fr.js +22 -22
- data/templates/jquery/i18n/jquery.ui/datepicker-gl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-he.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hu.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hu.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-hy.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-id.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-is.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-it.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ja.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ko.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-kz.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-lt.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-lv.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ml.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ms.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-nl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-no.js +16 -16
- data/templates/jquery/i18n/jquery.ui/datepicker-no.min.js +2 -2
- data/templates/jquery/i18n/jquery.ui/datepicker-pl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-pt-BR.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-pt.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-rm.js +18 -18
- data/templates/jquery/i18n/jquery.ui/datepicker-ro.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ru.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sk.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sq.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sr-SR.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sv.js +14 -14
- data/templates/jquery/i18n/jquery.ui/datepicker-ta.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-th.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-tr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-uk.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-vi.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-CN.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-HK.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-TW.js +20 -20
- data/templates/jquery/{partials → jquery/ui}/_flash_messages.scss +0 -0
- data/templates/jquery/jquery/ui/_theme.scss +14 -13
- data/templates/jquery/jquery/ui/contextMenu/configure.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/copy.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/cut.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/delete.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/edit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/exit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/new.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/paste.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/rename.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/show.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/trash.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu.scss +16 -10
- data/templates/jquery/jquery-ui.js +11839 -23066
- data/templates/jquery/jquery-ui.min.js +401 -795
- data/templates/jquery/jquery.bgiframe.js +27 -25
- data/templates/jquery/jquery.contextMenu.js +209 -196
- data/templates/jquery/jquery.cookie.js +3 -1
- data/templates/jquery/jquery.dotimeout.js +236 -228
- data/templates/jquery/jquery.dst.js +154 -151
- data/templates/jquery/jquery.farbtastic.js +293 -293
- data/templates/jquery/jquery.flashMessages.js +26 -0
- data/templates/jquery/jquery.flashMessages.min.js +1 -0
- data/templates/jquery/jquery.form.js +803 -786
- data/templates/jquery/jquery.haml.js +248 -247
- data/templates/jquery/jquery.hotkeys.js +89 -89
- data/templates/jquery/jquery.js +8141 -8106
- data/templates/jquery/jquery.layout.js +2451 -2415
- data/templates/jquery/jquery.min.js +167 -166
- data/templates/jquery/jquery.mousewheel.js +62 -54
- data/templates/jquery/jquery.offline.js +171 -171
- data/templates/jquery/jquery.pngFix.js +76 -76
- data/templates/jquery/jquery.replacetext.js +83 -83
- data/templates/jquery/jquery.themeswitchertool.js +202 -177
- data/templates/jquery/jquery.tmpl.js +478 -473
- data/templates/jquery/jquery.tmplPlus.js +82 -81
- data/templates/jquery/jrails.js +178 -175
- data/templates/jquery/json.js +77 -7
- data/templates/jquery/json2.js +480 -0
- data/templates/jquery/json2.min.js +7 -0
- data/templates/jquery/lib/tasks/haml.rake +2 -2
- data/templates/jquery/manifest.rb +21 -17
- data/templates/jstree/jquery.jstree.js +5967 -4536
- data/templates/mobile/config/initializers/mobile.rb +1 -1
- data/templates/mobile/jquery/mobile/_base.scss +944 -927
- data/templates/mobile/jquery/mobile/default.scss +61 -48
- data/templates/mobile/jquery/mobile/valencia.scss +56 -42
- data/templates/mobile/jquery.mobile.js +4461 -4347
- data/templates/mobile/jquery.mobile.min.js +11 -2
- data/templates/mobile/lib/tasks/jquery.mobile.rake +12 -12
- data/templates/ribbon/config/initializers/ribbon.rb +2 -2
- data/templates/ribbon/jquery.ribbon.js +50 -29
- data/templates/secret_sauce/secret_sauce.js +8 -8
- data/templates/tools/flowplayer.js +945 -1
- data/templates/tools/jquery.tools.js +4645 -4335
- data/templates/tools/jquery.tools.min.js +37 -37
- data/templates/tools/lib/tasks/jquery.tools.rake +4 -4
- data/templates/tools/swfobject.js +813 -773
- metadata +33 -21
- data/templates/jquery/haml.js +0 -506
- data/templates/jquery/haml.min.js +0 -5
- data/templates/jquery/jquery/ui/contextMenu/door.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_copy.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_delete.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_edit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_new.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_paste.png +0 -0
- data/templates/jquery/jquery.compat-1.3.js +0 -291
- data/templates/jquery/jquery.compat-1.3.min.js +0 -6
- data/templates/jquery/jquery.flash_messages.js +0 -5
- data/templates/jquery/jquery.flash_messages.min.js +0 -1
- data/templates/jquery/jquery.history.js +0 -194
- data/templates/jquery/jquery.history.min.js +0 -5
data/lib/jquery/jqgrid.rb
CHANGED
data/lib/jquery/jqtouch.rb
CHANGED
data/lib/jquery/jquery.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
module ActionView
|
2
|
-
module Helpers
|
3
|
-
|
2
|
+
module Helpers
|
3
|
+
|
4
4
|
def jquery_javascripts(locale)
|
5
5
|
if locale != 'en'
|
6
6
|
else
|
7
|
-
js = capture { javascript_include_tag "i18n/jquery.ui/datepicker-#{locale}.min.js" }
|
8
|
-
js << capture { '<script type="text/javascript">' }
|
9
|
-
js << capture { " jQuery.datepicker.setDefaults(jQuery.datepicker.regional['#{locale}']);" }
|
7
|
+
js = capture { javascript_include_tag "i18n/jquery.ui/datepicker-#{locale}.min.js" }
|
8
|
+
js << capture { '<script type="text/javascript">' }
|
9
|
+
js << capture { " jQuery.datepicker.setDefaults(jQuery.datepicker.regional['#{locale}']);" }
|
10
10
|
js << capture { '</script>' }
|
11
11
|
end
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
module JavaScriptHelper
|
15
|
-
|
15
|
+
|
16
16
|
# This function can be used to render rjs inline
|
17
17
|
#
|
18
18
|
# <%= javascript_function do |page|
|
@@ -27,49 +27,49 @@ module ActionView
|
|
27
27
|
function = update_page(&block) if block_given?
|
28
28
|
javascript_tag(function)
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
def jquery_id(id)
|
32
32
|
id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def jquery_ids(ids)
|
36
|
-
Array(ids).map{|id| jquery_id(id)}.join(',')
|
36
|
+
Array(ids).map { |id| jquery_id(id) }.join(',')
|
37
37
|
end
|
38
38
|
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
module PrototypeHelper
|
42
|
-
|
42
|
+
|
43
43
|
USE_PROTECTION = const_defined?(:DISABLE_JQUERY_FORGERY_PROTECTION) ? !DISABLE_JQUERY_FORGERY_PROTECTION : true
|
44
44
|
|
45
45
|
unless const_defined? :JQUERY_VAR
|
46
46
|
JQUERY_VAR = 'jQuery'
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
unless const_defined? :JQCALLBACKS
|
50
|
-
JQCALLBACKS = Set.new([
|
50
|
+
JQCALLBACKS = Set.new([:beforeSend, :complete, :error, :success] + (100..599).to_a)
|
51
51
|
#instance_eval { remove_const :AJAX_OPTIONS }
|
52
52
|
remove_const(:AJAX_OPTIONS) if const_defined?(:AJAX_OPTIONS)
|
53
|
-
AJAX_OPTIONS = Set.new([
|
54
|
-
|
55
|
-
|
53
|
+
AJAX_OPTIONS = Set.new([:before, :after, :condition, :url,
|
54
|
+
:asynchronous, :method, :insertion, :position,
|
55
|
+
:form, :with, :update, :script]).merge(JQCALLBACKS)
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
def periodically_call_remote(options = {})
|
59
59
|
frequency = options[:frequency] || 10 # every ten seconds by default
|
60
60
|
code = "setInterval(function() {#{remote_function(options)}}, #{frequency} * 1000)"
|
61
61
|
javascript_tag(code)
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
def remote_function(options)
|
65
65
|
javascript_options = options_for_ajax(options)
|
66
66
|
|
67
67
|
update = ''
|
68
68
|
if options[:update] && options[:update].is_a?(Hash)
|
69
|
-
update
|
69
|
+
update = []
|
70
70
|
update << "success:'#{options[:update][:success]}'" if options[:update][:success]
|
71
71
|
update << "failure:'#{options[:update][:failure]}'" if options[:update][:failure]
|
72
|
-
update
|
72
|
+
update = '{' + update.join(',') + '}'
|
73
73
|
elsif options[:update]
|
74
74
|
update << "'#{options[:update]}'"
|
75
75
|
end
|
@@ -77,38 +77,38 @@ module ActionView
|
|
77
77
|
function = "#{JQUERY_VAR}.ajax(#{javascript_options})"
|
78
78
|
|
79
79
|
function = "#{options[:before]}; #{function}" if options[:before]
|
80
|
-
function = "#{function}; #{options[:after]}"
|
80
|
+
function = "#{function}; #{options[:after]}" if options[:after]
|
81
81
|
function = "if (#{options[:condition]}) { #{function}; }" if options[:condition]
|
82
82
|
function = "if (confirm('#{escape_javascript(options[:confirm])}')) { #{function}; }" if options[:confirm]
|
83
83
|
return function
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
class JavaScriptGenerator
|
87
87
|
module GeneratorMethods
|
88
|
-
|
88
|
+
|
89
89
|
def insert_html(position, id, *options_for_render)
|
90
90
|
insertion = position.to_s.downcase
|
91
91
|
insertion = 'append' if insertion == 'bottom'
|
92
92
|
insertion = 'prepend' if insertion == 'top'
|
93
93
|
call "#{JQUERY_VAR}(\"#{jquery_id(id)}\").#{insertion}", render(*options_for_render)
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
def replace_html(id, *options_for_render)
|
97
97
|
insert_html(:html, id, *options_for_render)
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
def replace(id, *options_for_render)
|
101
101
|
call "#{JQUERY_VAR}(\"#{jquery_id(id)}\").replaceWith", render(*options_for_render)
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
def remove(*ids)
|
105
105
|
call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").remove"
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
def show(*ids)
|
109
109
|
call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").show"
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
112
|
def hide(*ids)
|
113
113
|
call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").hide"
|
114
114
|
end
|
@@ -116,37 +116,37 @@ module ActionView
|
|
116
116
|
def toggle(*ids)
|
117
117
|
call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").toggle"
|
118
118
|
end
|
119
|
-
|
119
|
+
|
120
120
|
def jquery_id(id)
|
121
121
|
id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id
|
122
122
|
end
|
123
|
-
|
123
|
+
|
124
124
|
def jquery_ids(ids)
|
125
|
-
Array(ids).map{|id| jquery_id(id)}.join(',')
|
125
|
+
Array(ids).map { |id| jquery_id(id) }.join(',')
|
126
126
|
end
|
127
|
-
|
127
|
+
|
128
128
|
end
|
129
129
|
end
|
130
|
-
|
131
|
-
|
130
|
+
|
131
|
+
protected
|
132
132
|
def options_for_ajax(options)
|
133
133
|
js_options = build_callbacks(options)
|
134
|
-
|
134
|
+
|
135
135
|
url_options = options[:url]
|
136
136
|
url_options = url_options.merge(:escape => false) if url_options.is_a?(Hash)
|
137
137
|
js_options['url'] = "'#{url_for(url_options)}'"
|
138
138
|
js_options['async'] = false if options[:type] == :synchronous
|
139
|
-
js_options['type'] = options[:method] ? method_option_to_s(options[:method]) : (
|
139
|
+
js_options['type'] = options[:method] ? method_option_to_s(options[:method]) : (options[:form] ? "'post'" : nil)
|
140
140
|
js_options['dataType'] = options[:datatype] ? "'#{options[:datatype]}'" : (options[:update] ? nil : "'script'")
|
141
|
-
|
141
|
+
|
142
142
|
if options[:form]
|
143
143
|
js_options['data'] = "#{JQUERY_VAR}.param(#{JQUERY_VAR}(this).serializeArray())"
|
144
144
|
elsif options[:submit]
|
145
145
|
js_options['data'] = "#{JQUERY_VAR}(\"##{options[:submit]} :input\").serialize()"
|
146
146
|
elsif options[:with]
|
147
|
-
js_options['data'] = options[:with].gsub("Form.serialize(this.form)","#{JQUERY_VAR}.param(#{JQUERY_VAR}(this.form).serializeArray())")
|
147
|
+
js_options['data'] = options[:with].gsub("Form.serialize(this.form)", "#{JQUERY_VAR}.param(#{JQUERY_VAR}(this.form).serializeArray())")
|
148
148
|
end
|
149
|
-
|
149
|
+
|
150
150
|
js_options['type'] ||= "'post'"
|
151
151
|
if options[:method]
|
152
152
|
if method_option_to_s(options[:method]) == "'put'" || method_option_to_s(options[:method]) == "'delete'"
|
@@ -159,7 +159,7 @@ module ActionView
|
|
159
159
|
js_options['data'] << "_method=#{options[:method]}'"
|
160
160
|
end
|
161
161
|
end
|
162
|
-
|
162
|
+
|
163
163
|
if USE_PROTECTION && respond_to?('protect_against_forgery?') && protect_against_forgery?
|
164
164
|
if js_options['data']
|
165
165
|
js_options['data'] << " + '&"
|
@@ -169,9 +169,9 @@ module ActionView
|
|
169
169
|
js_options['data'] << "#{request_forgery_protection_token}=' + encodeURIComponent('#{escape_javascript form_authenticity_token}')"
|
170
170
|
end
|
171
171
|
js_options['data'] = "''" if js_options['type'] == "'post'" && js_options['data'].nil?
|
172
|
-
options_for_javascript(js_options.reject {|key, value| value.nil?})
|
172
|
+
options_for_javascript(js_options.reject { |key, value| value.nil? })
|
173
173
|
end
|
174
|
-
|
174
|
+
|
175
175
|
def build_update_for_success(html_id, insertion=nil)
|
176
176
|
insertion = build_insertion(insertion)
|
177
177
|
"#{JQUERY_VAR}('#{jquery_id(html_id)}').#{insertion}(request);"
|
@@ -197,7 +197,7 @@ module ActionView
|
|
197
197
|
end
|
198
198
|
|
199
199
|
callback = options[:function] || remote_function(options)
|
200
|
-
javascript
|
200
|
+
javascript = "#{JQUERY_VAR}('#{jquery_id(name)}').delayedObserver("
|
201
201
|
javascript << "#{options[:frequency] || 0}, "
|
202
202
|
javascript << "function(element, value) {"
|
203
203
|
javascript << "#{callback}}"
|
@@ -205,15 +205,15 @@ module ActionView
|
|
205
205
|
javascript << ")"
|
206
206
|
javascript_tag(javascript)
|
207
207
|
end
|
208
|
-
|
208
|
+
|
209
209
|
def build_callbacks(options)
|
210
210
|
callbacks = {}
|
211
211
|
options[:beforeSend] = '';
|
212
|
-
[:uninitialized
|
212
|
+
[:uninitialized, :loading].each do |key|
|
213
213
|
options[:beforeSend] << (options[key].last == ';' ? options.delete(key) : options.delete(key) << ';') if options[key]
|
214
214
|
end
|
215
215
|
options.delete(:beforeSend) if options[:beforeSend].blank?
|
216
|
-
options[:complete] = options.delete(:loaded) if options[:loaded]
|
216
|
+
options[:complete] = options.delete(:loaded) if options[:loaded]
|
217
217
|
options[:error] = options.delete(:failure) if options[:failure]
|
218
218
|
if options[:update]
|
219
219
|
if options[:update].is_a?(Hash)
|
@@ -235,21 +235,21 @@ module ActionView
|
|
235
235
|
end
|
236
236
|
callbacks
|
237
237
|
end
|
238
|
-
|
238
|
+
|
239
239
|
end
|
240
|
-
|
240
|
+
|
241
241
|
class JavaScriptElementProxy < JavaScriptProxy #:nodoc:
|
242
|
-
|
242
|
+
|
243
243
|
unless const_defined? :JQUERY_VAR
|
244
244
|
JQUERY_VAR = PrototypeHelper::JQUERY_VAR
|
245
245
|
end
|
246
|
-
|
246
|
+
|
247
247
|
def initialize(generator, id)
|
248
248
|
id = id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id
|
249
249
|
@id = id
|
250
250
|
super(generator, "#{JQUERY_VAR}(\"#{id}\")")
|
251
251
|
end
|
252
|
-
|
252
|
+
|
253
253
|
def replace_html(*options_for_render)
|
254
254
|
call 'html', @generator.send(:render, *options_for_render)
|
255
255
|
end
|
@@ -257,11 +257,11 @@ module ActionView
|
|
257
257
|
def replace(*options_for_render)
|
258
258
|
call 'replaceWith', @generator.send(:render, *options_for_render)
|
259
259
|
end
|
260
|
-
|
260
|
+
|
261
261
|
def reload(options_for_replace={})
|
262
|
-
replace(options_for_replace.merge({
|
262
|
+
replace(options_for_replace.merge({:partial => @id.to_s.sub(/^#/, '')}))
|
263
263
|
end
|
264
|
-
|
264
|
+
|
265
265
|
def value()
|
266
266
|
call 'val()'
|
267
267
|
end
|
@@ -269,77 +269,77 @@ module ActionView
|
|
269
269
|
def value=(value)
|
270
270
|
call 'val', value
|
271
271
|
end
|
272
|
-
|
272
|
+
|
273
273
|
end
|
274
|
-
|
274
|
+
|
275
275
|
class JavaScriptElementCollectionProxy < JavaScriptCollectionProxy #:nodoc:\
|
276
|
-
|
276
|
+
|
277
277
|
unless const_defined? :JQUERY_VAR
|
278
278
|
JQUERY_VAR = PrototypeHelper::JQUERY_VAR
|
279
279
|
end
|
280
|
-
|
280
|
+
|
281
281
|
def initialize(generator, pattern)
|
282
282
|
super(generator, "#{JQUERY_VAR}(#{pattern.to_json})")
|
283
283
|
end
|
284
284
|
end
|
285
|
-
|
285
|
+
|
286
286
|
module ScriptaculousHelper
|
287
|
-
|
287
|
+
|
288
288
|
unless const_defined? :JQUERY_VAR
|
289
289
|
JQUERY_VAR = PrototypeHelper::JQUERY_VAR
|
290
290
|
end
|
291
|
-
|
291
|
+
|
292
292
|
unless const_defined? :SCRIPTACULOUS_EFFECTS
|
293
293
|
SCRIPTACULOUS_EFFECTS = {
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
294
|
+
:appear => {:method => 'fadeIn'},
|
295
|
+
:blind_down => {:method => 'blind', :mode => 'show', :options => {:direction => 'vertical'}},
|
296
|
+
:blind_up => {:method => 'blind', :mode => 'hide', :options => {:direction => 'vertical'}},
|
297
|
+
:blind_right => {:method => 'blind', :mode => 'show', :options => {:direction => 'horizontal'}},
|
298
|
+
:blind_left => {:method => 'blind', :mode => 'hide', :options => {:direction => 'horizontal'}},
|
299
|
+
:bounce_in => {:method => 'bounce', :mode => 'show', :options => {:direction => 'up'}},
|
300
|
+
:bounce_out => {:method => 'bounce', :mode => 'hide', :options => {:direction => 'up'}},
|
301
|
+
:drop_in => {:method => 'drop', :mode => 'show', :options => {:direction => 'up'}},
|
302
|
+
:drop_out => {:method => 'drop', :mode => 'hide', :options => {:direction => 'down'}},
|
303
|
+
:fade => {:method => 'fadeOut'},
|
304
|
+
:fold_in => {:method => 'fold', :mode => 'hide'},
|
305
|
+
:fold_out => {:method => 'fold', :mode => 'show'},
|
306
|
+
:grow => {:method => 'scale', :mode => 'show'},
|
307
|
+
:shrink => {:method => 'scale', :mode => 'hide'},
|
308
|
+
:slide_down => {:method => 'slide', :mode => 'show', :options => {:direction => 'up'}},
|
309
|
+
:slide_up => {:method => 'slide', :mode => 'hide', :options => {:direction => 'up'}},
|
310
|
+
:slide_right => {:method => 'slide', :mode => 'show', :options => {:direction => 'left'}},
|
311
|
+
:slide_left => {:method => 'slide', :mode => 'hide', :options => {:direction => 'left'}},
|
312
|
+
:squish => {:method => 'scale', :mode => 'hide', :options => {:origin => "['top','left']"}},
|
313
|
+
:switch_on => {:method => 'clip', :mode => 'show', :options => {:direction => 'vertical'}},
|
314
|
+
:switch_off => {:method => 'clip', :mode => 'hide', :options => {:direction => 'vertical'}},
|
315
|
+
:toggle_appear => {:method => 'fadeToggle'},
|
316
|
+
:toggle_slide => {:method => 'slide', :mode => 'toggle', :options => {:direction => 'up'}},
|
317
|
+
:toggle_blind => {:method => 'blind', :mode => 'toggle', :options => {:direction => 'vertical'}},
|
318
318
|
}
|
319
319
|
end
|
320
|
-
|
320
|
+
|
321
321
|
def visual_effect(name, element_id = false, js_options = {})
|
322
322
|
element = element_id ? element_id : "this"
|
323
|
-
|
323
|
+
|
324
324
|
if SCRIPTACULOUS_EFFECTS.has_key? name.to_sym
|
325
325
|
effect = SCRIPTACULOUS_EFFECTS[name.to_sym]
|
326
326
|
name = effect[:method]
|
327
327
|
mode = effect[:mode]
|
328
328
|
js_options = js_options.merge(effect[:options]) if effect[:options]
|
329
329
|
end
|
330
|
-
|
330
|
+
|
331
331
|
[:color, :direction, :startcolor, :endcolor].each do |option|
|
332
332
|
js_options[option] = "'#{js_options[option]}'" if js_options[option]
|
333
333
|
end
|
334
|
-
|
334
|
+
|
335
335
|
if js_options.has_key? :duration
|
336
336
|
speed = js_options.delete :duration
|
337
337
|
speed = (speed * 1000).to_i unless speed.nil?
|
338
338
|
else
|
339
339
|
speed = js_options.delete :speed
|
340
340
|
end
|
341
|
-
|
342
|
-
if ['fadeIn','fadeOut','fadeToggle'].include?(name)
|
341
|
+
|
342
|
+
if ['fadeIn', 'fadeOut', 'fadeToggle'].include?(name)
|
343
343
|
# 090905 - Jake - changed ' to \" so it passes assert_select_rjs with an id
|
344
344
|
javascript = "#{JQUERY_VAR}(\"#{jquery_id(element_id)}\").#{name}("
|
345
345
|
javascript << "#{speed}" unless speed.nil?
|
@@ -351,9 +351,9 @@ module ActionView
|
|
351
351
|
javascript << ",#{speed}" unless speed.nil?
|
352
352
|
javascript << ");"
|
353
353
|
end
|
354
|
-
|
354
|
+
|
355
355
|
end
|
356
|
-
|
356
|
+
|
357
357
|
def sortable_element_js(element_id, options = {}) #:nodoc:
|
358
358
|
#convert similar attributes
|
359
359
|
options[:handle] = ".#{options[:handle]}" if options[:handle]
|
@@ -362,24 +362,24 @@ module ActionView
|
|
362
362
|
options[:items] << options.delete(:tag) if options[:tag]
|
363
363
|
options[:items] << ".#{options.delete(:only)}" if options[:only]
|
364
364
|
end
|
365
|
-
options[:connectWith] = options.delete(:containment).map {|x| "##{x}"} if options[:containment]
|
365
|
+
options[:connectWith] = options.delete(:containment).map { |x| "##{x}" } if options[:containment]
|
366
366
|
options[:containment] = options.delete(:container) if options[:container]
|
367
367
|
options[:dropOnEmpty] = false unless options[:dropOnEmpty]
|
368
368
|
options[:helper] = "'clone'" if options[:ghosting] == true
|
369
369
|
options[:axis] = case options.delete(:constraint)
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
370
|
+
when "vertical", :vertical
|
371
|
+
"y"
|
372
|
+
when "horizontal", :horizontal
|
373
|
+
"x"
|
374
|
+
when false
|
375
|
+
nil
|
376
|
+
when nil
|
377
|
+
"y"
|
378
|
+
end
|
379
379
|
options.delete(:axis) if options[:axis].nil?
|
380
380
|
options.delete(:overlap)
|
381
381
|
options.delete(:ghosting)
|
382
|
-
|
382
|
+
|
383
383
|
if options[:onUpdate] || options[:url]
|
384
384
|
if options[:format]
|
385
385
|
options[:with] ||= "#{JQUERY_VAR}(this).sortable('serialize',{key:'#{element_id}[]', expression:#{options[:format]}})"
|
@@ -387,45 +387,45 @@ module ActionView
|
|
387
387
|
else
|
388
388
|
options[:with] ||= "#{JQUERY_VAR}(this).sortable('serialize',{key:'#{element_id}[]'})"
|
389
389
|
end
|
390
|
-
|
390
|
+
|
391
391
|
options[:onUpdate] ||= "function(){" + remote_function(options) + "}"
|
392
392
|
end
|
393
|
-
|
393
|
+
|
394
394
|
options.delete_if { |key, value| PrototypeHelper::AJAX_OPTIONS.include?(key) }
|
395
395
|
options[:update] = options.delete(:onUpdate) if options[:onUpdate]
|
396
|
-
|
396
|
+
|
397
397
|
[:axis, :cancel, :containment, :cursor, :handle, :tolerance, :items, :placeholder].each do |option|
|
398
398
|
options[option] = "'#{options[option]}'" if options[option]
|
399
399
|
end
|
400
|
-
|
400
|
+
|
401
401
|
options[:connectWith] = array_or_string_for_javascript(options[:connectWith]) if options[:connectWith]
|
402
|
-
|
402
|
+
|
403
403
|
%(#{JQUERY_VAR}('#{jquery_id(element_id)}').sortable(#{options_for_javascript(options)});)
|
404
404
|
end
|
405
|
-
|
405
|
+
|
406
406
|
def draggable_element_js(element_id, options = {})
|
407
407
|
%(#{JQUERY_VAR}("#{jquery_id(element_id)}").draggable(#{options_for_javascript(options)});)
|
408
408
|
end
|
409
|
-
|
409
|
+
|
410
410
|
def drop_receiving_element_js(element_id, options = {})
|
411
411
|
#convert similar options
|
412
412
|
options[:hoverClass] = options.delete(:hoverclass) if options[:hoverclass]
|
413
413
|
options[:drop] = options.delete(:onDrop) if options[:onDrop]
|
414
|
-
|
414
|
+
|
415
415
|
if options[:drop] || options[:url]
|
416
416
|
options[:with] ||= "'id=' + encodeURIComponent(#{JQUERY_VAR}(ui.draggable).attr('id'))"
|
417
417
|
options[:drop] ||= "function(ev, ui){" + remote_function(options) + "}"
|
418
418
|
end
|
419
|
-
|
419
|
+
|
420
420
|
options.delete_if { |key, value| PrototypeHelper::AJAX_OPTIONS.include?(key) }
|
421
421
|
|
422
|
-
options[:accept] = array_or_string_for_javascript(options[:accept]) if options[:accept]
|
422
|
+
options[:accept] = array_or_string_for_javascript(options[:accept]) if options[:accept]
|
423
423
|
[:activeClass, :hoverClass, :tolerance].each do |option|
|
424
424
|
options[option] = "'#{options[option]}'" if options[option]
|
425
425
|
end
|
426
|
-
|
426
|
+
|
427
427
|
%(#{JQUERY_VAR}('#{jquery_id(element_id)}').droppable(#{options_for_javascript(options)});)
|
428
428
|
end
|
429
|
-
end
|
429
|
+
end
|
430
430
|
end
|
431
431
|
end
|