turbolinks-form 0.0.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.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +104 -0
- data/app/assets/javascripts/turbolinks-form-core.js +106 -0
- data/app/assets/javascripts/turbolinks-form.js +4 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/turbolinks/form.rb +15 -0
- data/lib/turbolinks/form/controller.rb +84 -0
- data/lib/turbolinks/form/engine.rb +5 -0
- data/lib/turbolinks/form/railtie.rb +15 -0
- data/lib/turbolinks/form/version.rb +5 -0
- data/lib/turbolinks/form/view_helper.rb +32 -0
- data/turbolinks-form.gemspec +32 -0
- metadata +187 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8d2cb57298ae2a5a1b8ba4558194588bfa194bf0
|
4
|
+
data.tar.gz: 960d1a4935b7e671397cd4dd07922510c3db4385
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0f25b167126b16ae244ab711966c662c78c7bd35de3c135a82116f939cf893bb72e38956f29633a84776556d96601ee47ead36e46bde2cea1c496b69c8cc3173
|
7
|
+
data.tar.gz: 9bd4e1678e718437ee761b446879ce02c242bdb69aa232a3e61b362a3fa5fbd10da582ef75cd20ca9bb0a660ce48e8c262345e8451f31867ba98b67cbf81f51e
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
turbolinks-form
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.4.1
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Henrique Gubert
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
# turbolinks-form
|
2
|
+
Turbolinks 5 extension to render form errors after a submit.
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
Add the gem to your `Gemfile`
|
7
|
+
|
8
|
+
``` ruby
|
9
|
+
gem 'turbolinks-form'
|
10
|
+
```
|
11
|
+
|
12
|
+
Then `bundle install`.
|
13
|
+
|
14
|
+
Add the javascript to your `application.js` or to your `vendor.js`
|
15
|
+
|
16
|
+
``` javascript
|
17
|
+
//= require turbolinks-form
|
18
|
+
```
|
19
|
+
|
20
|
+
This will automatically include jQuery and Turbolinks if not included already.
|
21
|
+
|
22
|
+
|
23
|
+
## Basic Usage
|
24
|
+
|
25
|
+
Add `turbolinks_form: true` to your `form_for` or `form_tag`
|
26
|
+
|
27
|
+
``` erb
|
28
|
+
<%= form_for :resource, turbolinks_form: true do |f| ... %>
|
29
|
+
|
30
|
+
<%= form_tag users_path, turbolinks_form: true do ... %>
|
31
|
+
```
|
32
|
+
|
33
|
+
In your controller, just render the desired view with status `:unprocessable_entity`
|
34
|
+
when validation fails:
|
35
|
+
``` ruby
|
36
|
+
def create
|
37
|
+
@user = User.build(params[:user])
|
38
|
+
if @user.save
|
39
|
+
redirect_to users_path # This redirect_to is handled by turbolinks alone
|
40
|
+
else
|
41
|
+
render :new, status: :unprocessable_entity # This render is handled by turbolinks-form
|
42
|
+
end
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
The body of the rendered page will replace the current body, just like turbolinks would do for a regular visit.
|
47
|
+
|
48
|
+
If you prefer, you can use a convenience method `render_form_with_errors` that will automatically render the `new` page on `create` actions and the `edit` page on `update` actions
|
49
|
+
``` ruby
|
50
|
+
def create
|
51
|
+
@user = User.build(params[:user])
|
52
|
+
if @user.save
|
53
|
+
redirect_to users_path # This redirect_to is handled by turbolinks alone
|
54
|
+
else
|
55
|
+
render_form_with_errors # This render is handled by turbolinks-form
|
56
|
+
end
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
## Advanced Usage
|
61
|
+
|
62
|
+
#### Rendering custom view
|
63
|
+
You can pass the template name as the parameter to `render_form_with_errors` to choose any view you would like to render:
|
64
|
+
``` ruby
|
65
|
+
render_form_with_errors template: 'custom_view'
|
66
|
+
```
|
67
|
+
|
68
|
+
#### Rendering form with errors inside dialog
|
69
|
+
Sometimes we do not wish to replace the whole page body with the form with error, but rather just replace the content of a dialog or page fragment. You can pass the dialog CSS selector to choose where your form will be rendered:
|
70
|
+
``` ruby
|
71
|
+
render_form_with_errors target: 'div.dialog'
|
72
|
+
```
|
73
|
+
The command above will replace the whole content of `div.dialog` with the body of your rendered page. When using this option your page is rendered without layout.
|
74
|
+
|
75
|
+
## More Details
|
76
|
+
|
77
|
+
#### Script tags
|
78
|
+
Turbolinks-form will execute any `<script>` tags that the body of the response contains.
|
79
|
+
|
80
|
+
#### Cache
|
81
|
+
Turbolinks-form ignores Turbolinks caches. It does not populate or uses cache.
|
82
|
+
|
83
|
+
#### Events
|
84
|
+
Turbolinks-form will trigger only a subset of the (Turbolink events)[https://github.com/turbolinks/turbolinks#full-list-of-events]. Namely:
|
85
|
+
|
86
|
+
* `turbolinks:request-start` fires before Turbolinks-form submits the form. Access the XMLHttpRequest object with `event.data.xhr`.
|
87
|
+
|
88
|
+
* `turbolinks:request-end` fires after the network request completes. Access the XMLHttpRequest object with `event.data.xhr`.
|
89
|
+
|
90
|
+
* `turbolinks:before-render` fires before rendering the page. Access the new `<body>` element with `event.data.newBody`.
|
91
|
+
|
92
|
+
* `turbolinks:render` fires after Turbolinks renders the page. This event fires twice during an application visit to a cached location: once after rendering the cached version, and again after rendering the fresh version.
|
93
|
+
|
94
|
+
* `turbolinks:load` fires after the page has finished loading (after rendering and after running inline script tags).
|
95
|
+
|
96
|
+
#### Graceful Degradation
|
97
|
+
When the request is not `xhr`, `turbolinks-form` degrades gracefully to regular rendering (with full page load).
|
98
|
+
|
99
|
+
#### Browser history
|
100
|
+
Turbolinks-form ignores browser history. It does not push any new state nor replaces the last state.
|
101
|
+
|
102
|
+
## License
|
103
|
+
|
104
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -0,0 +1,106 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
$(function() {
|
4
|
+
|
5
|
+
// As documented on the reference below, turbolinks 5 does not treat a render
|
6
|
+
// after a form submit by default, leaving the users to implement their own
|
7
|
+
// solutions.
|
8
|
+
//
|
9
|
+
// https://github.com/turbolinks/turbolinks/issues/85#issuecomment-323446272
|
10
|
+
//
|
11
|
+
// The code below imitates the behavior of turbolinks when treating regular GET
|
12
|
+
// responses. Namely, it:
|
13
|
+
// - Replaces only the body of the page
|
14
|
+
// - It runs all script tags on the body of the new page
|
15
|
+
// - It fires the turbolinks:load event
|
16
|
+
//
|
17
|
+
// This doesn't mean it does ALL what turbolinks does. For example, we don't
|
18
|
+
// merge script tags from old and new page <head> elements.
|
19
|
+
// This also doesn't change the browser history or does any change to the URL.
|
20
|
+
// The reason we don't do such things is simply that this is a solution to
|
21
|
+
// render errors in forms, and usually we render the same page/form rendered
|
22
|
+
// before the submit.
|
23
|
+
var handleResponse = function(response) {
|
24
|
+
// parses response
|
25
|
+
var newDom = new DOMParser().parseFromString(response.responseText, "text/html");
|
26
|
+
|
27
|
+
// dispatches turbolinks event
|
28
|
+
Turbolinks.dispatch('turbolinks:before-render', {data: {newBody: newDom.body}});
|
29
|
+
|
30
|
+
// if there is no target, replaces whole body
|
31
|
+
var target;
|
32
|
+
if (!response.getResponseHeader('turbolinks-form-render-target')) {
|
33
|
+
document.body = newDom.body;
|
34
|
+
target = document.body;
|
35
|
+
} else {
|
36
|
+
target = $(response.getResponseHeader('turbolinks-form-render-target'), document.body)[0];
|
37
|
+
while (target.firstChild) {
|
38
|
+
target.removeChild(target.firstChild);
|
39
|
+
}
|
40
|
+
while (newDom.body.firstChild) {
|
41
|
+
target.appendChild(newDom.body.removeChild(newDom.body.firstChild));
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
// dispatches turbolinks event
|
46
|
+
Turbolinks.dispatch('turbolinks:render');
|
47
|
+
|
48
|
+
// get all script tags, and replace them by a new version with the same
|
49
|
+
// content. This makes them run.
|
50
|
+
var bodyScriptTags = target.getElementsByTagName('script');
|
51
|
+
for (var i=0; i<bodyScriptTags.length; i++) {
|
52
|
+
var newScript = document.createElement("script");
|
53
|
+
var oldScript = bodyScriptTags[i];
|
54
|
+
newScript.text = oldScript.text;
|
55
|
+
oldScript.parentNode.replaceChild(newScript, oldScript);
|
56
|
+
}
|
57
|
+
|
58
|
+
Turbolinks.dispatch("turbolinks:load");
|
59
|
+
scrollTo(0, 0);
|
60
|
+
}
|
61
|
+
|
62
|
+
|
63
|
+
// This code is only activated if:
|
64
|
+
// 1) HTTP status code is 422 unprocessable_entity
|
65
|
+
// 2) Response has the 'turbolinks-form-render' header
|
66
|
+
//
|
67
|
+
// PS: it is also activated on errors with code 500, so that we can know the
|
68
|
+
// error is happening and not that the site is unresponsive
|
69
|
+
$(document).on("ajax:error", function(e, response) {
|
70
|
+
// dispatches turbolinks event
|
71
|
+
Turbolinks.dispatch('turbolinks:request-end', {data: {xhr: response}});
|
72
|
+
|
73
|
+
var isError500 = (response.status == 500)
|
74
|
+
var isFormErrorResponse = (response.status == 422 && response.getResponseHeader('turbolinks-form-render'));
|
75
|
+
if (isError500 || isFormErrorResponse) {
|
76
|
+
handleResponse(response);
|
77
|
+
}
|
78
|
+
});
|
79
|
+
|
80
|
+
// This code is only activated if:
|
81
|
+
// 1) HTTP status code is 200
|
82
|
+
// 2) Response has 'turbolinks-form-render' header and 'turbolinks-form-render-when-success' header
|
83
|
+
$(document).on("ajax:success", function(e, data, status, response) {
|
84
|
+
// dispatches turbolinks event
|
85
|
+
Turbolinks.dispatch('turbolinks:request-end', {data: {xhr: response}});
|
86
|
+
|
87
|
+
var isFormSuccessResponse = (response.status == 200 && response.getResponseHeader('turbolinks-form-render') && response.getResponseHeader('turbolinks-form-render-when-success'));
|
88
|
+
if (isFormSuccessResponse) {
|
89
|
+
handleResponse(response);
|
90
|
+
}
|
91
|
+
});
|
92
|
+
|
93
|
+
// Sets up event delegation to forms with data-turbolinks-form attribute
|
94
|
+
$(document).on("ajax:beforeSend", "[data-turbolinks-form]", function(e, xhr, settings) {
|
95
|
+
// adds the turbolinks-form-submit header for forms with data-turbolinks-form attribute being submitted,
|
96
|
+
// so the controller knows it has to put the turbolinks-form-render header on the response
|
97
|
+
xhr.setRequestHeader('turbolinks-form-submit', '1');
|
98
|
+
|
99
|
+
// changes default Accept header to say we preferably want an HTML content as a response
|
100
|
+
xhr.setRequestHeader('Accept', '*/*;q=0.5, text/javascript;q=0.9, application/javascript;q=0.9, application/ecmascript;q=0.9, application/x-ecmascript;q=0.9, text/html')
|
101
|
+
|
102
|
+
// dispatches turbolinks event
|
103
|
+
Turbolinks.dispatch('turbolinks:request-start', {data: {xhr: xhr}});
|
104
|
+
});
|
105
|
+
|
106
|
+
});
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "turbolinks/form"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'turbolinks/form/version'
|
2
|
+
require 'turbolinks/form/view_helper'
|
3
|
+
require 'turbolinks/form/controller'
|
4
|
+
|
5
|
+
# includes the Rails engine, that automatically includes the assets on the app
|
6
|
+
require "turbolinks/form/engine"
|
7
|
+
|
8
|
+
# includes the Railtie, that loads the ViewHelper and controller methods
|
9
|
+
require 'turbolinks/form/railtie' if defined?(Rails::Railtie)
|
10
|
+
|
11
|
+
module Turbolinks
|
12
|
+
module Form
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module Turbolinks::Form
|
2
|
+
module Controller
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
before_filter :set_turbolinks_form_header
|
7
|
+
end
|
8
|
+
|
9
|
+
# convenience method
|
10
|
+
def render_errors(view_name=nil)
|
11
|
+
render_form_with_errors template: view_name
|
12
|
+
end
|
13
|
+
|
14
|
+
# Method used to render form with errors after a submit. It will automatically
|
15
|
+
# render the 'new' template for the 'create' action and the 'edit' template
|
16
|
+
# for the 'update' action.
|
17
|
+
#
|
18
|
+
# Options:
|
19
|
+
# :template => specify a template other than 'new'/'edit'
|
20
|
+
# :target => specify a css selector where the body of the rendered page should
|
21
|
+
# be subtituted to. When this option is used the rendering occurs
|
22
|
+
# without layout.
|
23
|
+
#
|
24
|
+
def render_form_with_errors(options={})
|
25
|
+
render_options = prepare_render_options(options)
|
26
|
+
render_options[:status] = :unprocessable_entity
|
27
|
+
render render_options
|
28
|
+
end
|
29
|
+
|
30
|
+
# Render some view after a form submit success (to be used instead of a
|
31
|
+
# redirect).
|
32
|
+
#
|
33
|
+
# Options:
|
34
|
+
# :template => specify a template other than 'new'/'edit'
|
35
|
+
# :target => specify a css selector where the body of the rendered page should
|
36
|
+
# be subtituted to. When this option is used the rendering occurs
|
37
|
+
# without layout.
|
38
|
+
#
|
39
|
+
def render_view_with_success(options={})
|
40
|
+
render_options = prepare_render_options(options)
|
41
|
+
render_options[:status] = 200
|
42
|
+
|
43
|
+
# this header is required to prevent turbolinks-form to render any response
|
44
|
+
# received when successfull (we don't want to render the content of a redirect,
|
45
|
+
# for example)
|
46
|
+
response.headers['turbolinks-form-render-when-success'] = '1'
|
47
|
+
|
48
|
+
render render_options
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def set_turbolinks_form_header
|
54
|
+
if turbolinks_form_request?
|
55
|
+
# response.set_header("turbolinks-form-render", '1')
|
56
|
+
response.headers['turbolinks-form-render'] = '1'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def turbolinks_form_request?
|
61
|
+
(request.post? || request.put? || request.patch?) && request.xhr? && request.headers['turbolinks-form-submit']
|
62
|
+
end
|
63
|
+
|
64
|
+
def prepare_render_options(options)
|
65
|
+
render_options = {}
|
66
|
+
|
67
|
+
if !options[:template]
|
68
|
+
case action_name
|
69
|
+
when 'create' then render_options[:action] = 'new'
|
70
|
+
when 'update' then render_options[:action] = 'edit'
|
71
|
+
end
|
72
|
+
else
|
73
|
+
render_options[:action] = options[:template]
|
74
|
+
end
|
75
|
+
|
76
|
+
if options[:target] && request.xhr?
|
77
|
+
render_options[:layout] = false
|
78
|
+
response.headers['turbolinks-form-render-target'] = options[:target]
|
79
|
+
end
|
80
|
+
|
81
|
+
render_options
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Turbolinks::Form
|
2
|
+
|
3
|
+
class Railtie < Rails::Railtie
|
4
|
+
initializer 'turbolinks-form' do
|
5
|
+
ActiveSupport.on_load :action_view do
|
6
|
+
include Turbolinks::Form::ViewHelper
|
7
|
+
end
|
8
|
+
|
9
|
+
ActiveSupport.on_load :action_controller do
|
10
|
+
include Turbolinks::Form::Controller
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Turbolinks::Form
|
2
|
+
module ViewHelper
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
def form_for(record_or_name_or_array, *args, &proc)
|
6
|
+
options = args.extract_options!
|
7
|
+
|
8
|
+
# makes submit a xhr request that accepts html as response
|
9
|
+
if options.keys.include?(:turbolinks_form) && options[:turbolinks_form]
|
10
|
+
options[:remote] = true
|
11
|
+
options[:data] ||= {}
|
12
|
+
options[:data][:turbolinks_form] = true
|
13
|
+
end
|
14
|
+
|
15
|
+
super(record_or_name_or_array, *(args << options), &proc)
|
16
|
+
end
|
17
|
+
|
18
|
+
def form_tag(record_or_name_or_array, *args, &proc)
|
19
|
+
options = args.extract_options!
|
20
|
+
|
21
|
+
# makes submit a xhr request that accepts html as response
|
22
|
+
if options.keys.include?(:turbolinks_form) && options[:turbolinks_form]
|
23
|
+
options[:remote] = true
|
24
|
+
options[:data] ||= {}
|
25
|
+
options[:data][:turbolinks_form] = true
|
26
|
+
end
|
27
|
+
|
28
|
+
super(record_or_name_or_array, *(args << options), &proc)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'turbolinks/form/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "turbolinks-form"
|
8
|
+
spec.version = Turbolinks::Form::VERSION
|
9
|
+
spec.authors = ["Henrique Gubert"]
|
10
|
+
spec.email = ["guberthenrique@hotmail.com"]
|
11
|
+
|
12
|
+
spec.description = %q{Turbolinks 5 extension to render form errors after a submit}
|
13
|
+
spec.summary = %q{Turbolinks-form extends Turbolinks 5 to allow a controller
|
14
|
+
to render any view after a form submit, and this view's body will replace the
|
15
|
+
current body, just like a regular Turbolinks visit. This makes it easy to render
|
16
|
+
form errors or to highlight invalid fields.}
|
17
|
+
spec.homepage = "https://github.com/hsgubert/turbolinks-form"
|
18
|
+
spec.license = "MIT"
|
19
|
+
|
20
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_runtime_dependency 'rails', '~> 4.2', '~> 5.0', '~> 5.1'
|
25
|
+
spec.add_runtime_dependency 'turbolinks', '~> 5.0', '>= 5.0.0'
|
26
|
+
spec.add_runtime_dependency 'jquery-rails', '~> 4.3', '>= 4.3.0'
|
27
|
+
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.15'
|
29
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
30
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
31
|
+
spec.add_development_dependency "byebug", '~> 9'
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: turbolinks-form
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Henrique Gubert
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-09-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.2'
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '5.1'
|
26
|
+
type: :runtime
|
27
|
+
prerelease: false
|
28
|
+
version_requirements: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '4.2'
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '5.0'
|
36
|
+
- - "~>"
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '5.1'
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: turbolinks
|
41
|
+
requirement: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - "~>"
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '5.0'
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 5.0.0
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '5.0'
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 5.0.0
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: jquery-rails
|
61
|
+
requirement: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - "~>"
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '4.3'
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 4.3.0
|
69
|
+
type: :runtime
|
70
|
+
prerelease: false
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.3'
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 4.3.0
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: bundler
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - "~>"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '1.15'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '1.15'
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: rake
|
95
|
+
requirement: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '12.0'
|
100
|
+
type: :development
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - "~>"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '12.0'
|
107
|
+
- !ruby/object:Gem::Dependency
|
108
|
+
name: rspec
|
109
|
+
requirement: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - "~>"
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '3.0'
|
114
|
+
type: :development
|
115
|
+
prerelease: false
|
116
|
+
version_requirements: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - "~>"
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '3.0'
|
121
|
+
- !ruby/object:Gem::Dependency
|
122
|
+
name: byebug
|
123
|
+
requirement: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - "~>"
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '9'
|
128
|
+
type: :development
|
129
|
+
prerelease: false
|
130
|
+
version_requirements: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - "~>"
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '9'
|
135
|
+
description: Turbolinks 5 extension to render form errors after a submit
|
136
|
+
email:
|
137
|
+
- guberthenrique@hotmail.com
|
138
|
+
executables: []
|
139
|
+
extensions: []
|
140
|
+
extra_rdoc_files: []
|
141
|
+
files:
|
142
|
+
- ".gitignore"
|
143
|
+
- ".rspec"
|
144
|
+
- ".ruby-gemset"
|
145
|
+
- ".ruby-version"
|
146
|
+
- Gemfile
|
147
|
+
- LICENSE.txt
|
148
|
+
- README.md
|
149
|
+
- app/assets/javascripts/turbolinks-form-core.js
|
150
|
+
- app/assets/javascripts/turbolinks-form.js
|
151
|
+
- bin/console
|
152
|
+
- bin/setup
|
153
|
+
- lib/turbolinks/form.rb
|
154
|
+
- lib/turbolinks/form/controller.rb
|
155
|
+
- lib/turbolinks/form/engine.rb
|
156
|
+
- lib/turbolinks/form/railtie.rb
|
157
|
+
- lib/turbolinks/form/version.rb
|
158
|
+
- lib/turbolinks/form/view_helper.rb
|
159
|
+
- turbolinks-form.gemspec
|
160
|
+
homepage: https://github.com/hsgubert/turbolinks-form
|
161
|
+
licenses:
|
162
|
+
- MIT
|
163
|
+
metadata: {}
|
164
|
+
post_install_message:
|
165
|
+
rdoc_options: []
|
166
|
+
require_paths:
|
167
|
+
- lib
|
168
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
requirements: []
|
179
|
+
rubyforge_project:
|
180
|
+
rubygems_version: 2.6.11
|
181
|
+
signing_key:
|
182
|
+
specification_version: 4
|
183
|
+
summary: Turbolinks-form extends Turbolinks 5 to allow a controller to render any
|
184
|
+
view after a form submit, and this view's body will replace the current body, just
|
185
|
+
like a regular Turbolinks visit. This makes it easy to render form errors or to
|
186
|
+
highlight invalid fields.
|
187
|
+
test_files: []
|