Skip to content
This repository was archived by the owner on Jan 26, 2025. It is now read-only.

Commit 91b8d5d

Browse files
committed
added option for customizing runtime selection
1 parent 6a40f01 commit 91b8d5d

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Options can be:
5151
* :filters => An array of hashes with :title and :extension keys specifying the files to look for. Defaults to [], which will show all files.
5252
* :pluploader => a value of `true` indicates that you want to have the files submitted with your form instead of in individual requests. To make this work, you need to add `match 'plupload_rails/_plupload_uploader', :controller=>'plupload_rails', :action=>'_plupload_uploader', :as=>'pluploader'` to your config/routes.rb file so plupload can upload the files, and then this plugin will insert some extra form fields into your page via JavaScript. Those fields tell the middleware how to form the request parameters before they get to your controller.
5353
* :field_name => the name of the field, which defaults to model_name[method_name]
54+
* :runtimes => the comma delimited list of runtimes you want to use, in order of preference. Defaults to 'html5,flash,silverlight,gears,browserplus'
5455

5556
Example filter:
5657

lib/app/helpers/plupload_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ def plupload(model_object, model_object_method, options={})
55
options[:filters] ||= []
66
options[:params] ||= {}
77
options[:field_name] ||= [model_object].flatten.pop.class.name.underscore.downcase + "[#{model_object_method}]"
8+
options[:runtimes] ||= "html5,flash,silverlight,gears,browserplus"
89
render :partial=>'plupload/uploader_scripts', :locals=>{
910
:model_object=>model_object,
1011
:model_object_method=>model_object_method,

lib/app/views/plupload/_uploader_scripts.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
var authtoken = $("input[name=authenticity_token]").val();
3434
$("#<%= options[:plupload_container] %>").pluploadQueue({
3535
// General settings
36-
runtimes : 'html5,flash,silverlight,gears,browserplus',
36+
runtimes : '<%= options[:runtimes] %>',
3737
<% unless options[:pluploader] %>
3838
url : '<%= url_for(model_object) %>',
3939
<% else %>

0 commit comments

Comments
 (0)