right-rails 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. data/CHANGELOG +7 -0
  2. data/README.rdoc +1 -1
  3. data/Rakefile +1 -1
  4. data/init.rb +1 -0
  5. data/lib/generators/right_rails/right_rails_generator.rb +15 -6
  6. data/lib/right_rails.rb +1 -1
  7. data/lib/right_rails/controller_extensions.rb +28 -15
  8. data/lib/right_rails/helpers/misc.rb +38 -38
  9. data/lib/right_rails/helpers/rails.rb +50 -7
  10. data/lib/rjs_renderer.rb +26 -0
  11. data/spec/lib/right_rails/controller_extensions_spec.rb +25 -14
  12. data/spec/lib/right_rails/helpers/forms_spec.rb +6 -6
  13. data/spec/lib/right_rails/helpers/rails_spec.rb +44 -45
  14. data/vendor/assets/images/rightjs-ui/rte.png +0 -0
  15. data/vendor/assets/javascripts/right-safe-src.js +2 -2
  16. data/vendor/assets/javascripts/right-safe.js +2 -2
  17. data/vendor/assets/javascripts/right-src.js +386 -100
  18. data/vendor/assets/javascripts/right.js +2 -2
  19. data/vendor/assets/javascripts/right/calendar-src.js +19 -3
  20. data/vendor/assets/javascripts/right/calendar.js +2 -2
  21. data/vendor/assets/javascripts/right/colorpicker-src.js +59 -20
  22. data/vendor/assets/javascripts/right/colorpicker.js +2 -2
  23. data/vendor/assets/javascripts/right/i18n/de.js +43 -42
  24. data/vendor/assets/javascripts/right/i18n/es.js +1 -0
  25. data/vendor/assets/javascripts/right/i18n/fi.js +1 -0
  26. data/vendor/assets/javascripts/right/i18n/fr.js +1 -0
  27. data/vendor/assets/javascripts/right/i18n/hu.js +1 -0
  28. data/vendor/assets/javascripts/right/i18n/it.js +1 -0
  29. data/vendor/assets/javascripts/right/i18n/jp.js +1 -0
  30. data/vendor/assets/javascripts/right/i18n/lt.js +96 -0
  31. data/vendor/assets/javascripts/right/i18n/nl.js +1 -0
  32. data/vendor/assets/javascripts/right/i18n/pt-br.js +1 -0
  33. data/vendor/assets/javascripts/right/i18n/ru.js +1 -0
  34. data/vendor/assets/javascripts/right/i18n/ua.js +1 -0
  35. data/vendor/assets/javascripts/right/jquerysh-src.js +4 -4
  36. data/vendor/assets/javascripts/right/jquerysh.js +2 -2
  37. data/vendor/assets/javascripts/right/rails-src.js +51 -15
  38. data/vendor/assets/javascripts/right/rails.js +2 -2
  39. data/vendor/assets/javascripts/right/resizable-src.js +11 -11
  40. data/vendor/assets/javascripts/right/rte-src.js +33 -13
  41. data/vendor/assets/javascripts/right/rte.js +2 -2
  42. data/vendor/assets/javascripts/right/slider-src.js +137 -28
  43. data/vendor/assets/javascripts/right/slider.js +2 -2
  44. metadata +24 -126
  45. data/generators/right_rails/right_rails_generator.rb +0 -46
  46. data/generators/right_rails/templates/iframed.html.erb +0 -10
  47. data/generators/right_scaffold/right_scaffold_generator.rb +0 -53
  48. data/generators/right_scaffold/templates/controller.rb +0 -99
  49. data/generators/right_scaffold/templates/helper.rb +0 -2
  50. data/generators/right_scaffold/templates/layout.html.erb +0 -18
  51. data/generators/right_scaffold/templates/style.css +0 -54
  52. data/generators/right_scaffold/templates/view__form.html.erb +0 -16
  53. data/generators/right_scaffold/templates/view__item.html.erb +0 -13
  54. data/generators/right_scaffold/templates/view_edit.html.erb +0 -6
  55. data/generators/right_scaffold/templates/view_index.html.erb +0 -9
  56. data/generators/right_scaffold/templates/view_new.html.erb +0 -5
  57. data/generators/right_scaffold/templates/view_show.html.erb +0 -10
  58. data/lib/generators/right_rails/templates/iframed.html.erb +0 -10
  59. data/public/images/rightjs-ui/colorpicker.png +0 -0
  60. data/public/images/rightjs-ui/resizable.png +0 -0
  61. data/public/images/rightjs-ui/rte.png +0 -0
  62. data/public/javascripts/right-olds-src.js +0 -652
  63. data/public/javascripts/right-olds.js +0 -9
  64. data/public/javascripts/right-safe-src.js +0 -68
  65. data/public/javascripts/right-safe.js +0 -7
  66. data/public/javascripts/right-src.js +0 -6014
  67. data/public/javascripts/right.js +0 -7
  68. data/public/javascripts/right/autocompleter-src.js +0 -625
  69. data/public/javascripts/right/autocompleter.js +0 -7
  70. data/public/javascripts/right/billboard-src.js +0 -564
  71. data/public/javascripts/right/billboard.js +0 -7
  72. data/public/javascripts/right/calendar-src.js +0 -1464
  73. data/public/javascripts/right/calendar.js +0 -7
  74. data/public/javascripts/right/casting-src.js +0 -183
  75. data/public/javascripts/right/casting.js +0 -7
  76. data/public/javascripts/right/colorpicker-src.js +0 -981
  77. data/public/javascripts/right/colorpicker.js +0 -7
  78. data/public/javascripts/right/dialog-src.js +0 -768
  79. data/public/javascripts/right/dialog.js +0 -7
  80. data/public/javascripts/right/dnd-src.js +0 -591
  81. data/public/javascripts/right/dnd.js +0 -7
  82. data/public/javascripts/right/effects-src.js +0 -508
  83. data/public/javascripts/right/effects.js +0 -7
  84. data/public/javascripts/right/i18n/de.js +0 -95
  85. data/public/javascripts/right/i18n/en-us.js +0 -11
  86. data/public/javascripts/right/i18n/es.js +0 -95
  87. data/public/javascripts/right/i18n/fi.js +0 -96
  88. data/public/javascripts/right/i18n/fr.js +0 -95
  89. data/public/javascripts/right/i18n/hu.js +0 -100
  90. data/public/javascripts/right/i18n/it.js +0 -95
  91. data/public/javascripts/right/i18n/jp.js +0 -99
  92. data/public/javascripts/right/i18n/nl.js +0 -95
  93. data/public/javascripts/right/i18n/pt-br.js +0 -95
  94. data/public/javascripts/right/i18n/ru.js +0 -95
  95. data/public/javascripts/right/i18n/ua.js +0 -99
  96. data/public/javascripts/right/in-edit-src.js +0 -373
  97. data/public/javascripts/right/in-edit.js +0 -7
  98. data/public/javascripts/right/jquerysh-src.js +0 -362
  99. data/public/javascripts/right/jquerysh.js +0 -7
  100. data/public/javascripts/right/json-src.js +0 -147
  101. data/public/javascripts/right/json.js +0 -7
  102. data/public/javascripts/right/keys-src.js +0 -87
  103. data/public/javascripts/right/keys.js +0 -7
  104. data/public/javascripts/right/lightbox-src.js +0 -931
  105. data/public/javascripts/right/lightbox.js +0 -7
  106. data/public/javascripts/right/rails-src.js +0 -402
  107. data/public/javascripts/right/rails.js +0 -7
  108. data/public/javascripts/right/rater-src.js +0 -384
  109. data/public/javascripts/right/rater.js +0 -7
  110. data/public/javascripts/right/resizable-src.js +0 -465
  111. data/public/javascripts/right/resizable.js +0 -7
  112. data/public/javascripts/right/rte-src.js +0 -2685
  113. data/public/javascripts/right/rte.js +0 -7
  114. data/public/javascripts/right/selectable-src.js +0 -725
  115. data/public/javascripts/right/selectable.js +0 -7
  116. data/public/javascripts/right/sizzle-src.js +0 -1132
  117. data/public/javascripts/right/sizzle.js +0 -7
  118. data/public/javascripts/right/slider-src.js +0 -395
  119. data/public/javascripts/right/slider.js +0 -7
  120. data/public/javascripts/right/sortable-src.js +0 -430
  121. data/public/javascripts/right/sortable.js +0 -7
  122. data/public/javascripts/right/table-src.js +0 -176
  123. data/public/javascripts/right/table.js +0 -7
  124. data/public/javascripts/right/tabs-src.js +0 -1157
  125. data/public/javascripts/right/tabs.js +0 -7
  126. data/public/javascripts/right/tags-src.js +0 -745
  127. data/public/javascripts/right/tags.js +0 -7
  128. data/public/javascripts/right/tooltips-src.js +0 -331
  129. data/public/javascripts/right/tooltips.js +0 -7
  130. data/public/javascripts/right/uploader-src.js +0 -302
  131. data/public/javascripts/right/uploader.js +0 -7
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ 2011-11-11 Nikolay Nemshilov
2
+ o Version 1.3.0
3
+ * RightJS 2.3.0 upgrade
4
+ * Plugins/UI update
5
+ * Rails 3.1 related fixes
6
+ * Rails 2 support dropped
7
+
1
8
  2011-06-12 Nikolay Nemshilov
2
9
  o Version 1.2.2
3
10
  * Rails 3.1 assets pipeline support
data/README.rdoc CHANGED
@@ -29,7 +29,7 @@ Just add the following into your +Gemfile+
29
29
 
30
30
  If you're on Rails < 3.1 then run the +right_rails+ generator
31
31
 
32
- script/generate right_rails
32
+ rails g right_rails
33
33
 
34
34
  If you're using Rails 3.1 with the pipeline assets handler, then you
35
35
  can require things in your +application.js+ file
data/Rakefile CHANGED
@@ -41,7 +41,7 @@ end
41
41
  namespace :rjs do
42
42
  CURRENT_DIR = File.dirname(__FILE__)
43
43
 
44
- OUTPUT_DIR = CURRENT_DIR + '/vendor'
44
+ OUTPUT_DIR = CURRENT_DIR + '/vendor/assets'
45
45
  OUTPUT_JSS_DIR = OUTPUT_DIR + "/javascripts"
46
46
  OUTPUT_IMG_DIR = OUTPUT_DIR + "/images/rightjs-ui"
47
47
 
data/init.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # Include hook code here
2
2
 
3
3
  require 'right_rails'
4
+ require 'rjs_renderer'
4
5
 
5
6
  if defined?(Rails)
6
7
  unless ::Rails.version < "3.1"
@@ -7,17 +7,26 @@ class RightRailsGenerator < Rails::Generators::Base
7
7
 
8
8
  def manifest
9
9
  source_path = File.dirname(__FILE__)
10
- images_path = "#{source_path}/../../../public/images/rightjs-ui"
11
- javascripts_path = "#{source_path}/../../../public/javascripts"
10
+ images_path = "#{source_path}/../../../vendor/assets/images/rightjs-ui"
11
+ javascripts_path = "#{source_path}/../../../vendor/assets/javascripts"
12
12
 
13
13
  # copying the javascript javascript files
14
- directory javascripts_path , "public/javascripts/"
15
-
16
- # creating the iframed uploads layout
17
- copy_file source_path + "/templates/iframed.html.erb", "app/views/layouts/iframed.html.erb"
14
+ directory javascripts_path , "public/javascripts"
18
15
 
19
16
  # copying the images in place
20
17
  directory images_path, "public/images/rightjs-ui"
18
+
19
+ # patching up the JS files to use images from 'pubic/images'
20
+ Dir['public/javascripts/right/*.js'].each do |filename|
21
+ old_content = File.read(filename)
22
+ new_content = old_content.gsub("url(/assets/rightjs-ui/", "url(/images/rightjs-ui/")
23
+
24
+ if old_content != new_content
25
+ File.open(filename, "w") do |f|
26
+ f.write new_content
27
+ end
28
+ end
29
+ end
21
30
  end
22
31
 
23
32
  def banner
data/lib/right_rails.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # The RightRails module. Just a namespace
3
3
  #
4
4
  module RightRails
5
- VERSION = '1.2.2'
5
+ VERSION = '1.3.0'
6
6
 
7
7
  autoload :Config, 'right_rails/config'
8
8
  autoload :JavaScriptGenerator, 'right_rails/java_script_generator'
@@ -3,14 +3,14 @@
3
3
  #
4
4
  #
5
5
  module RightRails::ControllerExtensions
6
-
6
+
7
7
  #
8
8
  # This method returns a wrapped RightRails scripts builder
9
9
  #
10
10
  # USAGE:
11
11
  # def create
12
12
  # @zing = Zing.new(params[:zing])
13
- #
13
+ #
14
14
  # if @zing.save
15
15
  # flash[:notice] = 'Here you go'
16
16
  # render rjs.insert @zing
@@ -36,21 +36,21 @@ module RightRails::ControllerExtensions
36
36
  else
37
37
  view_context
38
38
  end
39
-
39
+
40
40
  wrapper = RenderWrapper.new(template, options)
41
-
41
+
42
42
  if block_given?
43
43
  wrapper.render_block(&block)
44
44
  else
45
45
  wrapper
46
46
  end
47
47
  end
48
-
48
+
49
49
  private
50
-
50
+
51
51
  #
52
52
  # This class wraps the standard JavaScript responses in the controller
53
- #
53
+ #
54
54
  # It delegates all the script generating calls to the JavaScriptGenerator
55
55
  # instance, then grabs thre reults and creates a suitable hash of options
56
56
  # for the ActionController::Base#render method
@@ -61,30 +61,43 @@ private
61
61
  @generator = RightRails::JavaScriptGenerator.new(template)
62
62
  @options = options
63
63
  end
64
-
64
+
65
65
  def render_block(&block)
66
66
  yield(@generator)
67
67
  render
68
68
  end
69
-
69
+
70
70
  def method_missing(name, *args)
71
71
  @generator.send(name, *args)
72
- render
72
+ render
73
73
  end
74
-
74
+
75
75
  #
76
76
  # Compiles the options for the controller#render method
77
77
  #
78
78
  def render
79
79
  result = {:text => @generator.to_s, :content_type => Mime::JS}
80
-
80
+
81
81
  # iframed uploads context overloading
82
82
  if @template.request.content_type == 'multipart/form-data'
83
- result.merge! :content_type => Mime::HTML, :layout => 'iframed.html.erb'
83
+ result[:content_type] = Mime::HTML
84
+ result[:layout] = nil
85
+ result[:text] = %Q{
86
+ <!-- iframed uploads JS responses layout -->
87
+ <html>
88
+ <head>
89
+ <script type="text/javascript">
90
+ with (window.parent) {
91
+ #{result[:text]}
92
+ }
93
+ </script>
94
+ </head>
95
+ </html>
96
+ }.strip
84
97
  end
85
-
98
+
86
99
  result.merge! @options
87
100
  end
88
101
  end
89
-
102
+
90
103
  end
@@ -9,12 +9,12 @@ module RightRails::Helpers::Misc
9
9
  items = flash.collect{ |key, text|
10
10
  content_tag(:div, text, :class => key)
11
11
  }.sort.join("")
12
-
12
+
13
13
  content_tag(:div, RightRails::Helpers.html_safe(items),
14
14
  :id => :flashes, :style => (flash.empty? ? 'display: none' : nil))
15
15
  end
16
-
17
-
16
+
17
+
18
18
  #
19
19
  # the autocompletion list result
20
20
  #
@@ -30,26 +30,26 @@ module RightRails::Helpers::Misc
30
30
  #
31
31
  def autocomplete_result(entries, *args)
32
32
  return if entries.empty?
33
-
33
+
34
34
  options = args.last.is_a?(Hash) ? args.pop : {}
35
35
  highlight = options[:highlight]
36
36
  escape = options[:escape].nil? ? true : options[:escape]
37
37
  field = args.first
38
-
39
-
38
+
39
+
40
40
  items = entries.collect{ |entry|
41
41
  entry = entry.send(field) if field
42
- text = highlight ? highlight(entry, highlight) : escape ? h(entry) : entry
43
-
42
+ text = highlight ? highlight(entry, highlight) : escape ? ERB::Util.html_escape(entry) : entry
43
+
44
44
  content_tag :li, RightRails::Helpers.html_safe(text)
45
45
  }.join("")
46
-
46
+
47
47
  content_tag :ul, RightRails::Helpers.html_safe(items)
48
48
  end
49
-
49
+
50
50
  alias_method :autocompleter_result, :autocomplete_result
51
-
52
-
51
+
52
+
53
53
  #
54
54
  # Generates a link that whil load the refered address in a lightbox
55
55
  #
@@ -61,21 +61,21 @@ module RightRails::Helpers::Misc
61
61
  #
62
62
  def link_to_lightbox(name, url={}, options={}, &block)
63
63
  rightjs_require_module 'lightbox'
64
-
64
+
65
65
  group = options.delete(:roadtrip) || options.delete(:group)
66
-
66
+
67
67
  if RightRails::Config.rightjs_version < 2
68
68
  options[:rel] = 'lightbox'
69
69
  options[:rel] << "[roadtrip]" if group
70
70
  else
71
71
  options[:group] = group.to_s if group
72
72
  end
73
-
73
+
74
74
  RightRails::Helpers.add_unit_options(options, 'lightbox')
75
-
75
+
76
76
  link_to name, url, options, &block
77
77
  end
78
-
78
+
79
79
  #
80
80
  # Tabs container generator
81
81
  #
@@ -99,25 +99,25 @@ module RightRails::Helpers::Misc
99
99
  rightjs_require_module 'tabs'
100
100
  @__tabs = []
101
101
  yield()
102
-
102
+
103
103
  options.stringify_keys!
104
-
104
+
105
105
  tabs_type = options.delete('type')
106
106
  options['id'] = options.delete('id') || "tabs-#{rand.to_s.split('.').last}"
107
-
107
+
108
108
  # checking for the carousel class
109
109
  if tabs_type == :carousel
110
110
  options['class'] ||= ''
111
111
  options['class'] << (options['class'] == '' ? '' : ' ') + "#{RightRails::Helpers.css_prefix}-tabs-carousel"
112
112
  end
113
-
113
+
114
114
  # extracting the tab id prefix option
115
115
  tab_id_prefix = options[:idPrefix] || options['idPrefix'] || options[:id_prefix] || options['id_prefix'] || ''
116
-
116
+
117
117
  RightRails::Helpers.add_unit_options(options, 'tabs')
118
-
118
+
119
119
  tabs_widget_options = options.delete('data-tabs') || options.delete('data-tabs-options')
120
-
120
+
121
121
  # simple tabs and carousels generator
122
122
  content = if tabs_type != :harmonica
123
123
  # tabs list
@@ -130,12 +130,12 @@ module RightRails::Helpers::Misc
130
130
  }.join("\n")
131
131
  )
132
132
  ) + "\n";
133
-
133
+
134
134
  # contents list
135
135
  bodies_list = @__tabs.collect{|tab|
136
136
  tab[:content] ? content_tag(:li, tab[:content], :id => "#{tab_id_prefix}#{tab[:options][:id]}") + "\n" : ''
137
137
  }.join("")
138
-
138
+
139
139
  content_tag(:ul, tabs_list + RightRails::Helpers.html_safe(bodies_list), options)
140
140
  else
141
141
  # the harmonicas generator
@@ -149,26 +149,26 @@ module RightRails::Helpers::Misc
149
149
  }.join("\n")
150
150
  ), options
151
151
  )
152
-
152
+
153
153
  end
154
-
154
+
155
155
  content = content + RightRails::Helpers.html_safe("\n") + javascript_tag(
156
156
  "new Tabs('#{options['id']}', #{tabs_widget_options || '{}'});"
157
157
  )
158
-
158
+
159
159
  defined?(Rails) && Rails::VERSION::MAJOR < 3 ? concat(content) : content
160
160
  end
161
-
161
+
162
162
  def tab(title, options={}, &block)
163
163
  options[:id] = "tab-#{rand.to_s.split('.').last}" if !options[:id] && !options[:url]
164
-
164
+
165
165
  @__tabs << {
166
166
  :title => title,
167
167
  :options => options,
168
168
  :content => block_given? ? capture(&block) : nil
169
169
  }
170
170
  end
171
-
171
+
172
172
  #
173
173
  # The resizable unit helper
174
174
  #
@@ -179,23 +179,23 @@ module RightRails::Helpers::Misc
179
179
  #
180
180
  def resizable(options={}, &block)
181
181
  rightjs_require_module 'resizable'
182
-
182
+
183
183
  RightRails::Helpers.add_unit_options(options, 'resizable')
184
-
184
+
185
185
  options.delete('data-resizable') if options['data-resizable'] == "{}"
186
-
186
+
187
187
  options[:class] ||= ''
188
188
  options[:class] << " #{RightRails::Helpers.css_prefix}-resizable#{options[:direction] ? "-#{options.delete(:direction)}" : ''}"
189
189
  options[:class].strip!
190
-
190
+
191
191
  content = content_tag(:div, (
192
192
  content_tag(:div, RightRails::Helpers.html_safe(capture(&block)),
193
193
  :class => "#{RightRails::Helpers.css_prefix}-resizable-content") +
194
194
  content_tag(:div, '', :class => "#{RightRails::Helpers.css_prefix}-resizable-handle")
195
195
  ), options
196
196
  )
197
-
197
+
198
198
  defined?(Rails) && Rails::VERSION::MAJOR < 3 ? concat(content) : content
199
199
  end
200
-
200
+
201
201
  end
@@ -55,6 +55,18 @@ module RightRails::Helpers::Rails
55
55
  button_to_remote(value, options, html_options)
56
56
  end
57
57
 
58
+ #
59
+ # Getting back Rails 3.0 kind of method that supports blocks
60
+ #
61
+ def button_to_function(name, *args, &block)
62
+ html_options = args.extract_options!.symbolize_keys
63
+
64
+ function = block_given? ? update_page(&block) : args[0] || ''
65
+ onclick = "#{"#{html_options[:onclick]}; " if html_options[:onclick]}#{function};"
66
+
67
+ tag(:input, html_options.merge(:type => 'button', :value => name, :onclick => onclick))
68
+ end
69
+
58
70
  #
59
71
  # Replacing `periodically_call_remote` method
60
72
  #
@@ -67,21 +79,28 @@ module RightRails::Helpers::Rails
67
79
  #
68
80
  # replacing the draggables generator to make our autoscripts stuff working
69
81
  #
70
- def draggable_element_js(*args)
82
+ def draggable_element_js(element_id, options)
71
83
  rightjs_require_module 'dnd'
72
-
73
- super *args
84
+ %(new Draggable(#{ActiveSupport::JSON.encode(element_id)}, #{options_for_javascript(options)});)
74
85
  end
75
86
 
76
87
  #
77
88
  # replace the droppables generator to be used with RightJS
78
89
  #
79
- def drop_receiving_element_js(*args)
90
+ def drop_receiving_element_js(element_id, options={})
80
91
  rightjs_require_module 'dnd'
81
92
 
82
- super(*args).gsub!('Droppables.add', 'new Droppable'
83
- ).gsub!('element.id', 'draggable.element.id'
84
- ).gsub!('(element)', '(draggable)')
93
+ options[:with] ||= "'id=' + encodeURIComponent(draggable.element.id)"
94
+ options[:onDrop] ||= "function(draggable){" + remote_function(options) + "}"
95
+ options.delete_if { |key, value| AJAX_OPTIONS.include?(key) }
96
+
97
+ options[:accept] = array_or_string_for_javascript(options[:accept]) if options[:accept]
98
+ options[:hoverclass] = "'#{options[:hoverclass]}'" if options[:hoverclass]
99
+
100
+ # Confirmation happens during the onDrop callback, so it can be removed from the options
101
+ options.delete(:confirm) if options[:confirm]
102
+
103
+ %(new Droppable(#{ActiveSupport::JSON.encode(element_id)}, #{options_for_javascript(options)});)
85
104
  end
86
105
 
87
106
  #
@@ -100,4 +119,28 @@ module RightRails::Helpers::Rails
100
119
  script << ")"
101
120
  end
102
121
 
122
+ # ScriptaculousHelper substitute
123
+
124
+ CALLBACKS = Set.new([ :create, :uninitialized, :loading, :loaded, :interactive, :complete, :failure, :success ] + (100..599).to_a)
125
+ AJAX_OPTIONS = Set.new([ :before, :after, :condition, :url, :asynchronous, :method, :insertion, :position, :form, :with, :update, :script, :type ]).merge(CALLBACKS)
126
+
127
+ def array_or_string_for_javascript(option)
128
+ if option.kind_of?(Array)
129
+ "['#{option.join('\',\'')}']"
130
+ elsif !option.nil?
131
+ "'#{option}'"
132
+ end
133
+ end
134
+
135
+ def draggable_element(element_id, options = {})
136
+ javascript_tag(draggable_element_js(element_id, options).chop!)
137
+ end
138
+
139
+ def drop_receiving_element(element_id, options = {})
140
+ javascript_tag(drop_receiving_element_js(element_id, options).chop!)
141
+ end
142
+
143
+ def sortable_element(element_id, options = {})
144
+ javascript_tag(sortable_element_js(element_id, options).chop!)
145
+ end
103
146
  end