remotipart 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.rdoc CHANGED
@@ -1,5 +1,13 @@
1
1
  = History
2
2
 
3
+ === 1.1.1 / 2013-07-05
4
+
5
+ * Fixed issue with GET params not being available in middleware.
6
+ * Fixed issue with clicked submit button not being submitted via remotipart ajax.
7
+ * Fixed issue with HTML not being escaped correctly.
8
+ * Fixed issue with iframe-transport on jQuery 1.10.x.
9
+ * Fixed compatibility issue with Rails 4.
10
+
3
11
  === 1.1.0 / 2013-07-04
4
12
 
5
13
  * Updated to latest iframe-transport.
@@ -8,13 +8,8 @@ module Remotipart
8
8
  end
9
9
 
10
10
  def call env
11
- # For some reason, in Rails 3.0, `env['rack.request.form_hash']`
12
- # isn't populated unless we manually initialize a new Rack::Request
13
- # and call the `POST` method on it
14
- if ::Rails.version < "3.1"
15
- Rack::Request.new(env).POST
16
- end
17
- params = env['rack.request.form_hash']
11
+ # Get request params
12
+ params = Rack::Request.new(env).params
18
13
 
19
14
  # This was using an iframe transport, and is therefore an XHR
20
15
  # This is required if we're going to override the http_accept
@@ -1,6 +1,6 @@
1
1
  module Remotipart
2
2
  module Rails
3
- if ::Rails.version < "3.1"
3
+ if ::Rails.version.to_s < "3.1"
4
4
  require 'remotipart/rails/railtie'
5
5
  else
6
6
  require 'remotipart/rails/engine'
@@ -1,6 +1,6 @@
1
1
  module Remotipart
2
2
  module Rails
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  IFRAMETRANSPORT_VERSION = "02.06.2013"
5
5
  end
6
6
  end
@@ -2,7 +2,7 @@ module Remotipart
2
2
  # Responder used to automagically wrap any non-xml replies in a text-area
3
3
  # as expected by iframe-transport.
4
4
  module RenderOverrides
5
- include ActionView::Helpers::TagHelper
5
+ include ERB::Util
6
6
 
7
7
  def self.included(base)
8
8
  base.class_eval do
@@ -13,7 +13,7 @@ module Remotipart
13
13
  def render_with_remotipart *args
14
14
  render_without_remotipart *args
15
15
  if remotipart_submitted?
16
- response.body = %{<textarea data-type=\"#{response.content_type}\" data-status=\"#{response.response_code}\" data-statusText=\"#{response.message}\">#{response.body}</textarea>}
16
+ response.body = %{<textarea data-type=\"#{response.content_type}\" data-status=\"#{response.response_code}\" data-statusText=\"#{response.message}\">#{html_escape(response.body)}</textarea>}
17
17
  response.content_type = Mime::HTML
18
18
  end
19
19
  response_body
data/remotipart.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "remotipart"
8
- s.version = "1.1.0"
8
+ s.version = "1.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Greg Leppert", "Steve Schwartz"]
@@ -201,6 +201,9 @@
201
201
  root ? (root.textContent || root.innerText) : null
202
202
  };
203
203
  cleanUp();
204
+ if (!jqXHR.responseText) {
205
+ jqXHR.responseText = content.text;
206
+ }
204
207
  completeCallback(status, statusText, content, type ?
205
208
  ("Content-Type: " + type) :
206
209
  null);
@@ -8,6 +8,9 @@
8
8
  $.remotipart = remotipart = {
9
9
 
10
10
  setup: function(form) {
11
+ // Preserve form.data('ujs:submit-button') before it gets nulled by $.ajax.handleRemote
12
+ var button = form.data('ujs:submit-button');
13
+
11
14
  form
12
15
  // Allow setup part of $.rails.handleRemote to setup remote settings before canceling default remote handler
13
16
  // This is required in order to change the remote settings using the form details
@@ -21,6 +24,10 @@
21
24
  settings.files = $($.rails.fileInputSelector, form);
22
25
  settings.data = form.serializeArray();
23
26
 
27
+ // Insert the name/value of the clicked submit button, if any
28
+ if (button)
29
+ settings.data.push(button);
30
+
24
31
  // jQuery 1.9 serializeArray() contains input:file entries
25
32
  // so exclude them from settings.data, otherwise files will not be sent
26
33
  settings.files.each(function(i, file){
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remotipart
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2013-07-05 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
17
- requirement: &70284363199260 !ruby/object:Gem::Requirement
17
+ requirement: &70145637696380 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *70284363199260
25
+ version_requirements: *70145637696380
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jeweler
28
- requirement: &70284363198060 !ruby/object:Gem::Requirement
28
+ requirement: &70145637694700 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70284363198060
36
+ version_requirements: *70145637694700
37
37
  description: ! "Remotipart is a Ruby on Rails gem enabling remote multipart forms
38
38
  (AJAX style file uploads) with jquery-rails.\n This gem augments the native Rails
39
39
  3 jQuery-UJS remote form function enabling asynchronous file uploads with little
@@ -82,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  segments:
84
84
  - 0
85
- hash: 1233962955920476353
85
+ hash: 803845486888652544
86
86
  required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  none: false
88
88
  requirements: