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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d4f89826bd1ed110b4ce787a994a5c1057f8728e2888fddc001020ab504a25c
4
- data.tar.gz: 64edcc9b0b448f1fc5d991ab906c72406e7886c4a0352cbc69b278f1dc5df7a4
3
+ metadata.gz: d449b1aaa59264d0b4ce80f96d75b0b0b11dd8fe128bf33ba39eef567c8b7adc
4
+ data.tar.gz: b75e266ebeaa9a05ccbe0b338cc13991377813160f74186998fdb69d55c9356a
5
5
  SHA512:
6
- metadata.gz: a171df4fa8cc3f0e0b82c68f9d32c151ba8fe1a4e97e2a8039df47647765cc7559c73b8f9cee1dac8462d3db00d4a5c0ab1302bcf26387a9fc7babf8de8d65df
7
- data.tar.gz: 41ec8a8808a71652376e09d86e01212d83f9fb5363fc0795afeb8b5f2dde34334cc1e678d8d0b988e029e8223e7bde104fa399659ed469f228c8b5bf53fc6b01
6
+ metadata.gz: 452dd9ba8ec0cdf4e656c979afe99da9aaf5c2d89bf437b9b9cda715e2a5be32c56c36a23fb21229b1b0d40d9711b92a94c31bc78e0f01c008918f7cdf07387c
7
+ data.tar.gz: 23b166d769784490bfcffa0d4fda74322a88dabc20962ec86f477584f6c08bf22334cbbf65ac742f6c5d79bc6884098ebde9c5c70d8d298a340ebfb4bd60f3ae
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2023-02-19
4
+
5
+ - New Features
6
+ - Added support for Remount for mounting components.
7
+
3
8
  ## [0.1.1] - 2023-02-19
4
9
 
5
10
  - Bug Fixes
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|**Coming soon** If you want to use Remount to mount your components.|`false`|
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
- /* REMOUNT COMING SOON */
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
- /* REMOUNT COMING SOON */
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
- /* REMOUNT COMING SOON */
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
- /* REMOUNT COMING SOON */
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
- <div id="<%= "#{plural_name}-edit-page-mount-point" %>" data-<%= singular_name.dasherize %>-id=<%= "<%= @#{singular_name}.id %%>" %>></div>
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
- <div id="<%= "#{plural_name}-index-page-mount-point" %>"></div>
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
- <div id="<%= "#{plural_name}-new-page-mount-point" %>"></div>
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
- <div id="<%= "#{plural_name}-show-page-mount-point" %>" data-<%= singular_name.dasherize %>-id=<%= "<%= @#{singular_name}.id %%>" %>></div>
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 -%>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsReactScaffold
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_react_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Casey Li