rails_react_scaffold 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +3 -3
- data/lib/generators/rails_react_scaffold/templates/react_components/edit_page.js.erb +7 -1
- data/lib/generators/rails_react_scaffold/templates/react_components/index_page.js.erb +6 -1
- data/lib/generators/rails_react_scaffold/templates/react_components/new_page.js.erb +6 -1
- data/lib/generators/rails_react_scaffold/templates/react_components/show_page.js.erb +7 -1
- data/lib/generators/rails_react_scaffold/templates/views/edit.html.erb +5 -1
- data/lib/generators/rails_react_scaffold/templates/views/index.html.erb +5 -1
- data/lib/generators/rails_react_scaffold/templates/views/new.html.erb +5 -1
- data/lib/generators/rails_react_scaffold/templates/views/show.html.erb +5 -1
- data/lib/rails_react_scaffold/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d449b1aaa59264d0b4ce80f96d75b0b0b11dd8fe128bf33ba39eef567c8b7adc
|
4
|
+
data.tar.gz: b75e266ebeaa9a05ccbe0b338cc13991377813160f74186998fdb69d55c9356a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 452dd9ba8ec0cdf4e656c979afe99da9aaf5c2d89bf437b9b9cda715e2a5be32c56c36a23fb21229b1b0d40d9711b92a94c31bc78e0f01c008918f7cdf07387c
|
7
|
+
data.tar.gz: 23b166d769784490bfcffa0d4fda74322a88dabc20962ec86f477584f6c08bf22334cbbf65ac742f6c5d79bc6884098ebde9c5c70d8d298a340ebfb4bd60f3ae
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -43,9 +43,9 @@ rails g rails_react_scaffold:controller MODEL_NAME
|
|
43
43
|
|`component_dir`|string|The directory where the generated components will be placed|`app/javascript/components`|
|
44
44
|
|`component_ext`|string|The file extension to use for generated react components. (js, jsx)|`js`|
|
45
45
|
|`ajax_engine`|string|What you want to use to make your Ajax calls (fetch, jQuery, axios) **axios coming soon**|`fetch`|
|
46
|
-
|`json_engine`|string|What to use to generate your JSON responses (jbuiler, rabl) **jbuilder coming soon**|`jbuilder`|
|
47
|
-
|`use_cancan`|boolean|If you want to load and authorize resources through CanCan(Can).|`false`|
|
48
|
-
|`use_remount`|boolean
|
46
|
+
|`json_engine`|string|What to use to generate your JSON responses (jbuiler, [rabl](https://github.com/nesquena/rabl)) **jbuilder coming soon**|`jbuilder`|
|
47
|
+
|`use_cancan`|boolean|If you want to load and authorize resources through [CanCan(Can)](https://github.com/CanCanCommunity/cancancan).|`false`|
|
48
|
+
|`use_remount`|boolean|If you want to use [Remount](https://github.com/rstacruz/remount) to mount your components.|`false`|
|
49
49
|
|`use_webpacker`|boolean|If you want to use javascript_pack_tag to include your JS in your ERB files.|`false`|
|
50
50
|
|`use_webpacker_chunks`|boolean|If you want use javascript_packs_with_chunks_tag to include your JS in your ERB files.|`false`|
|
51
51
|
|
@@ -1,5 +1,11 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import ReactDOM from 'react-dom';
|
3
|
+
<%- if options['use_remount'] -%>
|
4
|
+
import { define } from 'remount';
|
5
|
+
<%- else -%>
|
6
|
+
import ReactDOM from 'react-dom';
|
7
|
+
<%- end -%>
|
8
|
+
|
3
9
|
import <%= plural_name.camelize %>Form from './<%= plural_name %>_form';
|
4
10
|
|
5
11
|
const <%= plural_name.camelize %>EditPage = ({ <%= singular_name.camelize(:lower)%>Id }) => (
|
@@ -10,7 +16,7 @@ const <%= plural_name.camelize %>EditPage = ({ <%= singular_name.camelize(:lower
|
|
10
16
|
);
|
11
17
|
|
12
18
|
<% if options['use_remount'] %>
|
13
|
-
|
19
|
+
define({ '<%= "#{plural_name.dasherize}-edit-page" %>': <%= "#{plural_name.camelize}EditPage" %> });
|
14
20
|
<% else %>
|
15
21
|
document.addEventListener('DOMContentLoaded', () => {
|
16
22
|
const mountPoint = document.getElementById('<%= "#{plural_name}-edit-page-mount-point" %>');
|
@@ -1,6 +1,11 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { useState, useEffect } from 'react';
|
3
3
|
import ReactDOM from 'react-dom';
|
4
|
+
<%- if options['use_remount'] -%>
|
5
|
+
import { define } from 'remount';
|
6
|
+
<%- else -%>
|
7
|
+
import ReactDOM from 'react-dom';
|
8
|
+
<%- end -%>
|
4
9
|
|
5
10
|
const <%= plural_name.camelize %>IndexPage = () => {
|
6
11
|
|
@@ -109,7 +114,7 @@ const <%= plural_name.camelize %>IndexPage = () => {
|
|
109
114
|
};
|
110
115
|
|
111
116
|
<%- if options['use_remount'] -%>
|
112
|
-
|
117
|
+
define({ '<%= "#{plural_name.dasherize}-index-page" %>': <%= "#{plural_name.camelize}IndexPage" %> });
|
113
118
|
<%- else -%>
|
114
119
|
document.addEventListener('DOMContentLoaded', () => {
|
115
120
|
const mountPoint = document.getElementById('<%= "#{plural_name}-index-page-mount-point" %>');
|
@@ -1,5 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
<%- if options['use_remount'] -%>
|
3
|
+
import { define } from 'remount';
|
4
|
+
<%- else -%>
|
2
5
|
import ReactDOM from 'react-dom';
|
6
|
+
<%- end -%>
|
7
|
+
|
3
8
|
import <%= plural_name.camelize %>Form from './<%= plural_name %>_form';
|
4
9
|
|
5
10
|
const <%= plural_name.camelize %>NewPage = () => (
|
@@ -10,7 +15,7 @@ const <%= plural_name.camelize %>NewPage = () => (
|
|
10
15
|
);
|
11
16
|
|
12
17
|
<%- if options['use_remount'] -%>
|
13
|
-
|
18
|
+
define({ '<%= "#{plural_name.dasherize}-new-page" %>': <%= "#{plural_name.camelize}NewPage" %> });
|
14
19
|
<%- else -%>
|
15
20
|
document.addEventListener('DOMContentLoaded', () => {
|
16
21
|
const mountPoint = document.getElementById('<%= "#{plural_name}-new-page-mount-point" %>');
|
@@ -1,5 +1,11 @@
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
2
2
|
import ReactDOM from 'react-dom';
|
3
|
+
<%- if options['use_remount'] -%>
|
4
|
+
import { define } from 'remount';
|
5
|
+
<%- else -%>
|
6
|
+
import ReactDOM from 'react-dom';
|
7
|
+
<%- end -%>
|
8
|
+
|
3
9
|
const <%= plural_name.camelize %>ShowPage = ({ <%= singular_name.camelize(:lower)%>Id }) => {
|
4
10
|
|
5
11
|
const [loading, setLoading] = useState(true);
|
@@ -61,7 +67,7 @@ const <%= plural_name.camelize %>ShowPage = ({ <%= singular_name.camelize(:lower
|
|
61
67
|
};
|
62
68
|
|
63
69
|
<%- if options['use_remount'] -%>
|
64
|
-
|
70
|
+
define({ '<%= "#{plural_name.dasherize}-show-page" %>': <%= "#{plural_name.camelize}ShowPage" %> });
|
65
71
|
<%- else -%>
|
66
72
|
document.addEventListener('DOMContentLoaded', () => {
|
67
73
|
const mountPoint = document.getElementById('<%= "#{plural_name}-show-page-mount-point" %>');
|
@@ -4,4 +4,8 @@
|
|
4
4
|
<%- if options[:use_webpacker] -%>
|
5
5
|
<%= "<%= javascript_pack_tag '#{plural_name}/#{plural_name}_edit_page' %%>" %>
|
6
6
|
<%- end -%>
|
7
|
-
|
7
|
+
<%- if options['use_remount'] -%>
|
8
|
+
<books-edit-page props-json='{"<%= singular_name.camelize(:lower)%>Id": <%= "<%= @#{singular_name}.id %%>" %>}'></books-edit-page>
|
9
|
+
<%- else -%>
|
10
|
+
<div id="<%= "#{plural_name}-edit-page-mount-point" %>" data-<%= singular_name.dasherize %>-id=<%= "<%= @#{singular_name}.id %%>" %>></div>
|
11
|
+
<%- end -%>
|
@@ -4,4 +4,8 @@
|
|
4
4
|
<%- if options[:use_webpacker] -%>
|
5
5
|
<%= "<%= javascript_pack_tag '#{plural_name}/#{plural_name}_index_page' %%>" %>
|
6
6
|
<%- end -%>
|
7
|
-
|
7
|
+
<%- if options['use_remount'] -%>
|
8
|
+
<books-index-page></books-index-page>
|
9
|
+
<%- else -%>
|
10
|
+
<div id="<%= "#{plural_name}-index-page-mount-point" %>"></div>
|
11
|
+
<%- end -%>
|
@@ -4,4 +4,8 @@
|
|
4
4
|
<%- if options[:use_webpacker] -%>
|
5
5
|
<%= "<%= javascript_pack_tag '#{plural_name}/#{plural_name}_new_page' %%>" %>
|
6
6
|
<%- end -%>
|
7
|
-
|
7
|
+
<%- if options['use_remount'] -%>
|
8
|
+
<books-new-page></books-new-page>
|
9
|
+
<%- else -%>
|
10
|
+
<div id="<%= "#{plural_name}-new-page-mount-point" %>"></div>
|
11
|
+
<%- end -%>
|
@@ -4,4 +4,8 @@
|
|
4
4
|
<%- if options[:use_webpacker] -%>
|
5
5
|
<%= "<%= javascript_pack_tag '#{plural_name}/#{plural_name}_show_page' %%>" %>
|
6
6
|
<%- end -%>
|
7
|
-
|
7
|
+
<%- if options['use_remount'] -%>
|
8
|
+
<books-show-page props-json='{"<%= singular_name.camelize(:lower)%>Id": <%= "<%= @#{singular_name}.id %%>" %>}'></books-show-page>
|
9
|
+
<%- else -%>
|
10
|
+
<div id="<%= "#{plural_name}-show-page-mount-point" %>" data-<%= singular_name.dasherize %>-id=<%= "<%= @#{singular_name}.id %%>" %>></div>
|
11
|
+
<%- end -%>
|