react-on-rails
Advanced tools
Comparing version 6.8.2 to 6.9.0
@@ -7,4 +7,17 @@ # Change Log | ||
## [Unreleased] | ||
*Please add entries here for your pull requests.* | ||
## [6.9.0] - 2017-03-29 | ||
## Fixed | ||
- Fixed error in the release script. [#767](https://github.com/shakacode/react_on_rails/issues/767) by [isolo](https://github.com/isolo). | ||
## Changed | ||
- Use <script type="application/json"> for props and store instead of hidden div. [#775] (https://github.com/shakacode/react_on_rails/pull/775) by [cheremukhin23](https://github.com/cheremukhin23). | ||
## Added | ||
- Add option to specify i18n_yml_dir in order to include only subset of locale files when generating translations.js & default.js for react-intl. | ||
[#777](https://github.com/shakacode/react_on_rails/pull/777) by [danijel](https://github.com/danijel). | ||
## [6.8.2] - 2017-03-24 | ||
## Fixed | ||
- Change webpack output path to absolute and update webpack to version ^2.3.1. [#771](https://github.com/shakacode/react_on_rails/pull/771) by [cheremukhin23](https://github.com/cheremukhin23). | ||
@@ -495,3 +508,5 @@ | ||
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/6.8.1...master | ||
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/6.9.0...master | ||
[6.9.0]: https://github.com/shakacode/react_on_rails/compare/6.8.2...6.9.0 | ||
[6.8.2]: https://github.com/shakacode/react_on_rails/compare/6.8.1...6.8.2 | ||
[6.8.1]: https://github.com/shakacode/react_on_rails/compare/6.8.0...6.8.1 | ||
@@ -498,0 +513,0 @@ [6.8.0]: https://github.com/shakacode/react_on_rails/compare/6.7.2...6.8.0 |
@@ -49,3 +49,3 @@ 'use strict'; | ||
function buildConsoleReplay() { | ||
return _RenderUtils2.default.wrapInScriptTags(consoleReplay()); | ||
return _RenderUtils2.default.wrapInScriptTags('consoleReplayLog', consoleReplay()); | ||
} |
@@ -28,6 +28,4 @@ 'use strict'; | ||
var REACT_ON_RAILS_COMPONENT_CLASS_NAME = 'js-react-on-rails-component'; /* global ReactOnRails Turbolinks */ | ||
var REACT_ON_RAILS_STORE_ATTRIBUTE = 'data-js-react-on-rails-store'; /* global ReactOnRails Turbolinks */ | ||
var REACT_ON_RAILS_STORE_CLASS_NAME = 'js-react-on-rails-store'; | ||
function findContext() { | ||
@@ -71,4 +69,11 @@ if (typeof window.ReactOnRails !== 'undefined') { | ||
function forEachByAttribute(fn, attributeName, railsContext) { | ||
var els = document.querySelectorAll('[' + attributeName + ']'); | ||
for (var i = 0; i < els.length; i += 1) { | ||
fn(els[i], railsContext); | ||
} | ||
} | ||
function forEachComponent(fn, railsContext) { | ||
forEach(fn, REACT_ON_RAILS_COMPONENT_CLASS_NAME, railsContext); | ||
forEach(fn, 'js-react-on-rails-component', railsContext); | ||
} | ||
@@ -78,4 +83,4 @@ | ||
var context = findContext(); | ||
var name = el.getAttribute('data-store-name'); | ||
var props = JSON.parse(el.getAttribute('data-props')); | ||
var name = el.getAttribute(REACT_ON_RAILS_STORE_ATTRIBUTE); | ||
var props = JSON.parse(el.textContent); | ||
var storeGenerator = context.ReactOnRails.getStoreGenerator(name); | ||
@@ -87,3 +92,3 @@ var store = storeGenerator(props, railsContext); | ||
function forEachStore(railsContext) { | ||
forEach(initializeStore, REACT_ON_RAILS_STORE_CLASS_NAME, railsContext); | ||
forEachByAttribute(initializeStore, REACT_ON_RAILS_STORE_ATTRIBUTE, railsContext); | ||
} | ||
@@ -124,6 +129,7 @@ | ||
var context = findContext(); | ||
var name = el.getAttribute('data-component-name'); | ||
var domNodeId = el.getAttribute('data-dom-id'); | ||
var props = JSON.parse(el.getAttribute('data-props')); | ||
var trace = JSON.parse(el.getAttribute('data-trace')); | ||
var jsonEl = JSON.parse(el.textContent); | ||
var name = jsonEl.component_name; | ||
var domNodeId = jsonEl.dom_id; | ||
var props = jsonEl.props; | ||
var trace = jsonEl.trace; | ||
@@ -161,3 +167,3 @@ try { | ||
if (el) { | ||
return JSON.parse(el.getAttribute('data-rails-context')); | ||
return JSON.parse(el.textContent); | ||
} | ||
@@ -177,3 +183,4 @@ | ||
function unmount(el) { | ||
var domNodeId = el.getAttribute('data-dom-id'); | ||
var elData = JSON.parse(el.textContent); | ||
var domNodeId = elData.dom_id; | ||
var domNode = document.getElementById(domNodeId); | ||
@@ -180,0 +187,0 @@ _reactDom2.default.unmountComponentAtNode(domNode); |
@@ -7,3 +7,3 @@ 'use strict'; | ||
exports.default = { | ||
wrapInScriptTags: function wrapInScriptTags(scriptBody) { | ||
wrapInScriptTags: function wrapInScriptTags(scriptId, scriptBody) { | ||
if (!scriptBody) { | ||
@@ -13,4 +13,4 @@ return ''; | ||
return '\n<script>\n' + scriptBody + '\n</script>'; | ||
return '\n<script id="' + scriptId + '">\n' + scriptBody + '\n</script>'; | ||
} | ||
}; |
{ | ||
"name": "react-on-rails", | ||
"version": "6.8.2", | ||
"version": "6.9.0", | ||
"description": "react-on-rails JavaScript for react_on_rails Ruby gem", | ||
@@ -5,0 +5,0 @@ "main": "node_package/lib/ReactOnRails.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121076
814