hot-glue 0.0.3 → 0.0.9

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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -1
  3. data/.gitignore +12 -7
  4. data/Gemfile +4 -9
  5. data/Gemfile.lock +40 -23
  6. data/README.md +123 -31
  7. data/Rakefile +1 -1
  8. data/app/assets/config/manifest.js +0 -0
  9. data/bin/rails +2 -2
  10. data/config/database.yml +11 -0
  11. data/db/migrate/20210306212711_create_abcs.rb +11 -0
  12. data/db/migrate/20210306223300_create_defs.rb +9 -0
  13. data/db/migrate/20210306223305_create_hgis.rb +9 -0
  14. data/db/migrate/20210306223309_create_jkls.rb +9 -0
  15. data/db/migrate/20210306223701_devise_create_users.rb +44 -0
  16. data/db/migrate/20210306225506_create_xyzs.rb +9 -0
  17. data/db/schema.rb +60 -0
  18. data/lib/generators/hot_glue/install_generator.rb +3 -3
  19. data/lib/generators/hot_glue/scaffold_generator.rb +230 -138
  20. data/lib/generators/hot_glue/templates/_errors.haml +6 -5
  21. data/lib/generators/hot_glue/templates/_flash_notices.haml +7 -6
  22. data/lib/generators/hot_glue/templates/_new_form.haml +10 -0
  23. data/lib/generators/hot_glue/templates/_show.haml +1 -1
  24. data/lib/generators/hot_glue/templates/{base_controller.rb → base_controller.rb.erb} +0 -0
  25. data/lib/generators/hot_glue/templates/{controller.rb → controller.rb.erb} +11 -7
  26. data/lib/generators/hot_glue/templates/create.turbo_stream.haml +12 -3
  27. data/lib/generators/hot_glue/templates/edit.haml +2 -0
  28. data/lib/generators/hot_glue/templates/new.haml +1 -10
  29. data/lib/generators/hot_glue/templates/{controller_spec.rb → request_spec.rb.erb} +0 -0
  30. data/lib/generators/hot_glue/templates/system_spec.rb.erb +53 -0
  31. data/lib/hotglue/version.rb +1 -1
  32. metadata +24 -13
@@ -1,5 +1,6 @@
1
- - if resource.errors.any?
2
- #error_explanation
3
- - resource.errors.full_messages.each do |message|
4
- %div.alert.alert-danger
5
- = message
1
+ = turbo_frame_tag "errors" do
2
+ - if resource.errors.any?
3
+ #error_explanation
4
+ - resource.errors.full_messages.each do |message|
5
+ %div.alert.alert-danger
6
+ = message
@@ -1,7 +1,8 @@
1
- - unless notice.nil?
2
- %div.alert.alert-notice.alert-dismissible
3
- = notice
1
+ = turbo_frame_tag "flash_notices" do
2
+ - unless notice.nil?
3
+ %div.alert.alert-notice.alert-dismissible
4
+ = notice
4
5
 
5
- - unless alert.nil?
6
- %div.alert.alert-danger.alert-dismissible
7
- = alert
6
+ - unless alert.nil?
7
+ %div.alert.alert-danger.alert-dismissible
8
+ = alert
@@ -0,0 +1,10 @@
1
+ = turbo_frame_tag "<%= singular %>-new" do
2
+ %h3
3
+ New <%= singular.titlecase %>
4
+
5
+ = form_with model: <%= singular %>, url: <%= path_helper_plural %>(<%= nested_objects_arity %>), method: "post" do |f|
6
+ = render partial: "<%=namespace_with_slash%><%= @plural %>/form", locals: {<%= singular %>: <%= singular %>, f: f}
7
+
8
+ .row
9
+ .col-md-12
10
+ = f.submit "Save", class: "btn btn-primary pull-right"
@@ -4,4 +4,4 @@
4
4
  = link_to "Delete <i class='fa fa-1x fa-remove'></i>".html_safe, <%= path_helper_full %>(<%= path_helper_args %>), method: :delete, data: {confirm: 'Are you sure?'}, disable_with: "Loading...", class: "delete-<%= singular %>-button btn btn-primary "
5
5
  <% end %>
6
6
  &nbsp;
7
- = link_to "Edit <i class='fa fa-1x fa-list-alt'></i>".html_safe, edit_<%= path_helper_full %>(<%= path_helper_args %>), disable_with: "Loading...", class: "edit-<%= singular %>-button btn btn-primary "
7
+ = link_to "Edit <i class='fa fa-1x fa-list-alt'></i>".html_safe, edit_<%= path_helper_full %>(<%= path_helper_args %>), <% if @big_edit %>'data-turbo' => 'false', <% end %>disable_with: "Loading...", class: "edit-<%= singular %>-button btn btn-primary "
@@ -1,5 +1,5 @@
1
1
  class <%= controller_class_name %> < <%= controller_descends_from %>
2
- <% unless @auth_identifier == '' || @auth.nil? %>before_action :authenticate_<%= auth_identifier %>!<% end %>
2
+ <% unless @auth_identifier == '' || @auth.nil? %>before_action :authenticate_<%= @auth_identifier %>!<% end %>
3
3
  <% if any_nested? %> <% @nested_args.each do |arg| %>
4
4
  before_action :load_<%= arg %><% end %> <% end %>
5
5
  before_action :load_<%= singular_name %>, only: [:show, :edit, :update, :destroy]
@@ -52,14 +52,18 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
52
52
  @<%=singular_name %> = <%=class_name %>.create(modified_params)
53
53
 
54
54
  if @<%= singular_name %>.save
55
-
55
+ flash[:notice] = "Successfully created #{@<%= singular %>.<%= display_class %>}"
56
+ load_all_<%= plural %>
57
+ respond_to do |format|
58
+ format.turbo_stream
59
+ format.html { redirect_to <%= plural %>_path }
60
+ end
56
61
  else
57
62
  flash[:alert] = "Oops, your <%= singular_name %> could not be created."
58
- end
59
- load_all_<%= plural %>
60
- respond_to do |format|
61
- format.turbo_stream
62
- format.html { redirect_to <%= plural %>_path }
63
+ respond_to do |format|
64
+ format.turbo_stream
65
+ format.html
66
+ end
63
67
  end
64
68
  end<% end %>
65
69
 
@@ -1,5 +1,14 @@
1
- = turbo_stream.replace "<%= plural %>-list" do
2
- = render partial: "list", locals: {<%= plural %>: @<%= plural %>}
1
+ - if @<%= singular %>.errors.none?
2
+ = turbo_stream.replace "<%= plural %>-list" do
3
+ = render partial: "list", locals: {<%= plural %>: @<%= plural %>}
3
4
 
4
5
  = turbo_stream.replace "<%= singular %>-new" do
5
- = render partial: "new_button"
6
+ - if @<%= singular %>.errors.none?
7
+ = render partial: "new_button"
8
+ - else
9
+ = render partial: "new_form", locals: {<%= singular %>: @<%= singular %>}
10
+
11
+ = turbo_stream.replace "flash_notices" do
12
+ = render partial: "layouts/flash_notices"
13
+ - if @<%= singular %>.errors.any?
14
+ = render partial: "errors", locals: {resource: @<%= singular %>}
@@ -1,3 +1,5 @@
1
+ = link_to "<i class='fa fa-arrow-circle-left 2x'></i> Back to list".html_safe, <%= path_helper_plural %>
2
+
1
3
  = turbo_frame_tag "<%= singular %>__#{<%= "@" + singular %>.id}" do
2
4
  .cell.editable{style: "position: relative;"}
3
5
  - if <%="@" + singular%>.errors.any?
@@ -1,10 +1 @@
1
- = turbo_frame_tag "<%= singular %>-new" do
2
- %h3
3
- New <%= singular.titlecase %>
4
-
5
- = form_with model: @invoice, url: <%= path_helper_plural %>(<%= nested_objects_arity %>), method: "post" do |f|
6
- = render partial: "<%=namespace_with_slash%><%= @plural %>/form", locals: {<%= singular %>: @<%= singular %>, f: f}
7
-
8
- .row
9
- .col-md-12
10
- = f.submit "Save", class: "btn btn-primary pull-right"
1
+ = render partial: "new_form", locals: {<%=singular%>: @<%=singular%>}
@@ -0,0 +1,53 @@
1
+ require 'rails_helper'
2
+
3
+ describe "interaction for <%= controller_class_name %>", type: :feature do
4
+ <% unless @auth.nil? %> let(:<%= @auth %>) {create(:<%= @auth.gsub('current_', '') %>)}<%end%>
5
+ let(:<%= singular %>) {create(:<%= singular %><%= object_parent_mapping_as_argument_for_specs %> )}
6
+
7
+ <%= objest_nest_factory_setup %>
8
+
9
+ before(:each) do
10
+
11
+ end
12
+
13
+ describe "index" do
14
+ it "should show me the list" do
15
+
16
+ end
17
+ end
18
+
19
+ describe "new" do
20
+ it "should show form" do
21
+
22
+ end
23
+ end
24
+
25
+ describe "create" do
26
+ it "should create a new <%= singular %>" do
27
+
28
+ end
29
+ end
30
+
31
+ describe "edit" do
32
+ it "should return an editable form" do
33
+
34
+ end
35
+ end
36
+
37
+ describe "show" do
38
+ it "should return a view form" do
39
+
40
+ end
41
+ end
42
+
43
+ describe "update" do
44
+ it "should update" do
45
+ end
46
+ end
47
+
48
+ describe "destroy" do
49
+ it "should destroy" do
50
+ end
51
+ end
52
+ end
53
+
@@ -1,3 +1,3 @@
1
1
  module HotGlue
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.9'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hot-glue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Fleetwood-Boldt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-27 00:00:00.000000000 Z
11
+ date: 2021-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -108,9 +108,18 @@ files:
108
108
  - LICENCE
109
109
  - README.md
110
110
  - Rakefile
111
+ - app/assets/config/manifest.js
111
112
  - app/helpers/hot_glue/controller_helper.rb
112
113
  - app/helpers/hot_glue_helper.rb
113
114
  - bin/rails
115
+ - config/database.yml
116
+ - db/migrate/20210306212711_create_abcs.rb
117
+ - db/migrate/20210306223300_create_defs.rb
118
+ - db/migrate/20210306223305_create_hgis.rb
119
+ - db/migrate/20210306223309_create_jkls.rb
120
+ - db/migrate/20210306223701_devise_create_users.rb
121
+ - db/migrate/20210306225506_create_xyzs.rb
122
+ - db/schema.rb
114
123
  - lib/generators/hot_glue/install_generator.rb
115
124
  - lib/generators/hot_glue/scaffold_generator.rb
116
125
  - lib/generators/hot_glue/templates/_errors.haml
@@ -119,16 +128,18 @@ files:
119
128
  - lib/generators/hot_glue/templates/_line.haml
120
129
  - lib/generators/hot_glue/templates/_list.haml
121
130
  - lib/generators/hot_glue/templates/_new_button.haml
131
+ - lib/generators/hot_glue/templates/_new_form.haml
122
132
  - lib/generators/hot_glue/templates/_show.haml
123
- - lib/generators/hot_glue/templates/base_controller.rb
124
- - lib/generators/hot_glue/templates/controller.rb
125
- - lib/generators/hot_glue/templates/controller_spec.rb
133
+ - lib/generators/hot_glue/templates/base_controller.rb.erb
134
+ - lib/generators/hot_glue/templates/controller.rb.erb
126
135
  - lib/generators/hot_glue/templates/create.turbo_stream.haml
127
136
  - lib/generators/hot_glue/templates/destroy.turbo_stream.haml
128
137
  - lib/generators/hot_glue/templates/edit.haml
129
138
  - lib/generators/hot_glue/templates/edit.turbo_stream.haml
130
139
  - lib/generators/hot_glue/templates/index.haml
131
140
  - lib/generators/hot_glue/templates/new.haml
141
+ - lib/generators/hot_glue/templates/request_spec.rb.erb
142
+ - lib/generators/hot_glue/templates/system_spec.rb.erb
132
143
  - lib/generators/hot_glue/templates/update.turbo_stream.haml
133
144
  - lib/hot-glue.rb
134
145
  - lib/hotglue/engine.rb
@@ -138,8 +149,8 @@ licenses:
138
149
  - Nonstandard
139
150
  metadata:
140
151
  source_code_uri: https://github.com/jasonfb/hot-glue
141
- documentation_uri: https://jfb.teachable.com/p/gems-by-jason
142
- homepage_uri: https://blog.jasonfleetwoodboldt.com/hot-glue/
152
+ documentation_uri: https://www.instagram.com/jfbcodes/
153
+ homepage_uri: https://jasonfleetwoodboldt.com/hot-glue/
143
154
  post_install_message: |
144
155
  ---------------------------------------------
145
156
  Welcome to Hot Glue - A Scaffold Building Companion for Hotwire + Turbo-Rails
@@ -148,11 +159,11 @@ post_install_message: |
148
159
 
149
160
  * Build plug-and-play scaffolding mixing HAML with the power of Hotwire and Turbo-Rails
150
161
  * Automatically Reads Your Models (make them before building your scaffolding!)
151
- * Excellent for CRUD, lists with pagination, searching, sorting.
152
- * Great for prototyping very.
153
- * Plays nicely with Devise, Kaminari, Haml-Rails, Rspec.
154
- * Create specs automatically along with the controllers.
155
- * Nest your routes model-by-model for built-in poor man's authentication
162
+ * Excellent for CRUD, lists with pagination (coming soon: searching & sorting)
163
+ * Great for prototyping.
164
+ * Plays nicely with Devise, Kaminari, Haml-Rails, Rspec, FontAwesome
165
+ * Create specs automatically along with the generated controllers.
166
+ * Nest your routes model-by-model for built-in poor man's authentication.
156
167
  * Throw the scaffolding away when your app is ready to graduate to its next phase.
157
168
 
158
169
  see README for complete instructions.
@@ -171,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
182
  - !ruby/object:Gem::Version
172
183
  version: '0'
173
184
  requirements: []
174
- rubygems_version: 3.0.8
185
+ rubygems_version: 3.2.11
175
186
  signing_key:
176
187
  specification_version: 4
177
188
  summary: A gem build scaffolding.