Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28098 from rails/rails-ujs-intergration
Better integrate rails-ujs in our repository
- Loading branch information
Showing
13 changed files
with
407 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,5 @@ pkg | |
/railties/doc | ||
/railties/tmp | ||
/guides/output | ||
node_modules/ | ||
/actionview/log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2007-2017 Rails Core team | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Ruby on Rails unobtrusive scripting adapter. | ||
======================================== | ||
|
||
This unobtrusive scripting support file is developed for the Ruby on Rails framework, but is not strictly tied to any specific backend. You can drop this into any application to: | ||
|
||
- force confirmation dialogs for various actions; | ||
- make non-GET requests from hyperlinks; | ||
- make forms or hyperlinks submit data asynchronously with Ajax; | ||
- have submit buttons become automatically disabled on form submit to prevent double-clicking. | ||
|
||
These features are achieved by adding certain ["data" attributes][data] to your HTML markup. In Rails, they are added by the framework's template helpers. | ||
|
||
Requirements | ||
------------ | ||
|
||
- HTML5 doctype (optional). | ||
|
||
If you don't use HTML5, adding "data" attributes to your HTML4 or XHTML pages might make them fail [W3C markup validation][validator]. However, this shouldn't create any issues for web browsers or other user agents. | ||
|
||
Installation using npm | ||
------------ | ||
|
||
Run `npm install rails-ujs --save` to install the rails-ujs package. | ||
|
||
Installation using Yarn | ||
------------ | ||
|
||
Run `yarn add rails-ujs` to install the rails-ujs package. | ||
|
||
Usage | ||
------------ | ||
|
||
Require `rails-ujs` into your application.js manifest. | ||
|
||
```javascript | ||
//= require rails-ujs | ||
``` | ||
|
||
How to run tests | ||
------------ | ||
|
||
Run `bundle exec rake ujs:server` first, and then run the web tests by visiting [[http://localhost:4567]] in your browser. | ||
|
||
## License | ||
rails-ujs is released under the [MIT License](MIT-LICENSE). | ||
|
||
[data]: http://www.w3.org/TR/html5/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes "Embedding custom non-visible data with the data-* attributes" | ||
[validator]: http://validator.w3.org/ | ||
[csrf]: http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
{ | ||
"arrow_spacing": { | ||
"level": "warn" | ||
}, | ||
"braces_spacing": { | ||
"level": "warn", | ||
"spaces": 1, | ||
"empty_object_spaces": 0 | ||
}, | ||
"camel_case_classes": { | ||
"level": "error" | ||
}, | ||
"coffeescript_error": { | ||
"level": "error" | ||
}, | ||
"colon_assignment_spacing": { | ||
"level": "warn", | ||
"spacing": { | ||
"left": 0, | ||
"right": 1 | ||
} | ||
}, | ||
"cyclomatic_complexity": { | ||
"level": "warn", | ||
"value": 10 | ||
}, | ||
"duplicate_key": { | ||
"level": "error" | ||
}, | ||
"empty_constructor_needs_parens": { | ||
"level": "warn" | ||
}, | ||
"ensure_comprehensions": { | ||
"level": "warn" | ||
}, | ||
"eol_last": { | ||
"level": "warn" | ||
}, | ||
"indentation": { | ||
"value": 2, | ||
"level": "error" | ||
}, | ||
"line_endings": { | ||
"level": "warn", | ||
"value": "unix" | ||
}, | ||
"max_line_length": { | ||
"value": 80, | ||
"level": "ignore", | ||
"limitComments": true | ||
}, | ||
"missing_fat_arrows": { | ||
"level": "ignore" | ||
}, | ||
"newlines_after_classes": { | ||
"value": 3, | ||
"level": "warn" | ||
}, | ||
"no_backticks": { | ||
"level": "error" | ||
}, | ||
"no_debugger": { | ||
"level": "warn", | ||
"console": false | ||
}, | ||
"no_empty_functions": { | ||
"level": "warn" | ||
}, | ||
"no_empty_param_list": { | ||
"level": "warn" | ||
}, | ||
"no_implicit_braces": { | ||
"level": "ignore", | ||
"strict": true | ||
}, | ||
"no_implicit_parens": { | ||
"level": "ignore", | ||
"strict": true | ||
}, | ||
"no_interpolation_in_single_quotes": { | ||
"level": "warn" | ||
}, | ||
"no_nested_string_interpolation": { | ||
"level": "warn" | ||
}, | ||
"no_plusplus": { | ||
"level": "warn" | ||
}, | ||
"no_private_function_fat_arrows": { | ||
"level": "warn" | ||
}, | ||
"no_stand_alone_at": { | ||
"level": "warn" | ||
}, | ||
"no_tabs": { | ||
"level": "error" | ||
}, | ||
"no_this": { | ||
"level": "warn" | ||
}, | ||
"no_throwing_strings": { | ||
"level": "error" | ||
}, | ||
"no_trailing_semicolons": { | ||
"level": "error" | ||
}, | ||
"no_trailing_whitespace": { | ||
"level": "error", | ||
"allowed_in_comments": false, | ||
"allowed_in_empty_lines": true | ||
}, | ||
"no_unnecessary_double_quotes": { | ||
"level": "warn" | ||
}, | ||
"no_unnecessary_fat_arrows": { | ||
"level": "warn" | ||
}, | ||
"non_empty_constructor_needs_parens": { | ||
"level": "warn" | ||
}, | ||
"prefer_english_operator": { | ||
"level": "ignore", | ||
"doubleNotLevel": "warn" | ||
}, | ||
"space_operators": { | ||
"level": "warn" | ||
}, | ||
"spacing_after_comma": { | ||
"level": "warn" | ||
}, | ||
"transform_messes_up_line_numbers": { | ||
"level": "warn" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
$LOAD_PATH.unshift File.expand_path("..", __FILE__) | ||
require "server" | ||
|
||
run UJS::Server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.