hot-glue 0.1.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -7
  3. data/README.md +95 -17
  4. data/app/helpers/hot_glue/controller_helper.rb +1 -1
  5. data/lib/generators/hot_glue/install_generator.rb +8 -3
  6. data/lib/generators/hot_glue/markup_templates/base.rb +7 -0
  7. data/lib/generators/hot_glue/markup_templates/erb.rb +227 -0
  8. data/lib/generators/hot_glue/markup_templates/haml.rb +236 -0
  9. data/lib/generators/hot_glue/markup_templates/slim.rb +9 -0
  10. data/lib/generators/hot_glue/scaffold_generator.rb +143 -258
  11. data/lib/generators/hot_glue/templates/controller.rb.erb +16 -4
  12. data/lib/generators/hot_glue/templates/erb/_errors.erb +11 -0
  13. data/lib/generators/hot_glue/templates/erb/_flash_notices.erb +12 -0
  14. data/lib/generators/hot_glue/templates/erb/_form.erb +8 -0
  15. data/lib/generators/hot_glue/templates/erb/_line.erb +10 -0
  16. data/lib/generators/hot_glue/templates/erb/_list.erb +19 -0
  17. data/lib/generators/hot_glue/templates/erb/_new_button.erb +3 -0
  18. data/lib/generators/hot_glue/templates/erb/_new_form.erb +8 -0
  19. data/lib/generators/hot_glue/templates/erb/_show.erb +8 -0
  20. data/lib/generators/hot_glue/templates/erb/create.turbo_stream.erb +18 -0
  21. data/lib/generators/hot_glue/templates/erb/destroy.turbo_stream.erb +3 -0
  22. data/lib/generators/hot_glue/templates/erb/edit.erb +30 -0
  23. data/lib/generators/hot_glue/templates/erb/edit.turbo_stream.erb +3 -0
  24. data/lib/generators/hot_glue/templates/erb/index.erb +10 -0
  25. data/lib/generators/hot_glue/templates/erb/new.erb +1 -0
  26. data/lib/generators/hot_glue/templates/erb/update.turbo_stream.erb +10 -0
  27. data/lib/generators/hot_glue/templates/{_errors.haml → haml/_errors.haml} +0 -0
  28. data/lib/generators/hot_glue/templates/{_flash_notices.haml → haml/_flash_notices.haml} +0 -0
  29. data/lib/generators/hot_glue/templates/{_form.haml → haml/_form.haml} +0 -0
  30. data/lib/generators/hot_glue/templates/{_line.haml → haml/_line.haml} +0 -0
  31. data/lib/generators/hot_glue/templates/{_list.haml → haml/_list.haml} +0 -0
  32. data/lib/generators/hot_glue/templates/{_new_button.haml → haml/_new_button.haml} +0 -0
  33. data/lib/generators/hot_glue/templates/{_new_form.haml → haml/_new_form.haml} +0 -0
  34. data/lib/generators/hot_glue/templates/{_show.haml → haml/_show.haml} +0 -0
  35. data/lib/generators/hot_glue/templates/{create.turbo_stream.haml → haml/create.turbo_stream.haml} +0 -0
  36. data/lib/generators/hot_glue/templates/{destroy.turbo_stream.haml → haml/destroy.turbo_stream.haml} +0 -0
  37. data/lib/generators/hot_glue/templates/{edit.haml → haml/edit.haml} +0 -0
  38. data/lib/generators/hot_glue/templates/{edit.turbo_stream.haml → haml/edit.turbo_stream.haml} +0 -0
  39. data/lib/generators/hot_glue/templates/{index.haml → haml/index.haml} +0 -0
  40. data/lib/generators/hot_glue/templates/{new.haml → haml/new.haml} +0 -0
  41. data/lib/generators/hot_glue/templates/{update.turbo_stream.haml → haml/update.turbo_stream.haml} +0 -0
  42. data/lib/generators/hot_glue/templates/system_spec.rb.erb +1 -1
  43. data/lib/hot-glue.rb +6 -20
  44. data/lib/hotglue/version.rb +1 -1
  45. metadata +49 -24
@@ -0,0 +1,19 @@
1
+ <\%= turbo_frame_tag "<%= plural %>-list" do %>
2
+ <div class="container-fluid "><%= singular %>-table
3
+ <div class="row">
4
+ <%= list_column_headings %>
5
+ <div class='col buttons-col'></div>
6
+ </div>
7
+
8
+ <\% if <%= plural %>.empty? %>
9
+ <div>
10
+ None
11
+ </div>
12
+ <\% end %>
13
+ <\% <%= plural %>.each do |<%= singular %>| %>
14
+ <\%= render partial: '<%= line_path_partial %>', locals: {<%= singular %>: <%= singular %> <%= nested_assignments_with_leading_comma %> } %>
15
+ <\% end %>
16
+
17
+ <%= @no_paginate ? "" : paginate %>
18
+ </div>
19
+ <\% end %>
@@ -0,0 +1,3 @@
1
+ <\%= turbo_frame_tag "<%= singular %>-new" do %>
2
+ <\%= link_to "New <%= singular.titlecase %>", <%= new_path_name %>, disable_with: "Loading...", class: "new-<%= singular %>-button btn btn-primary pull-right" %>
3
+ <\% end %>
@@ -0,0 +1,8 @@
1
+ <\%= turbo_frame_tag "<%= singular %>-new" do %>
2
+ <h3>
3
+ New <%= singular.titlecase %>
4
+ </h3>
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
+ <\% end %>
8
+ <\% end %>
@@ -0,0 +1,8 @@
1
+ <%= all_line_fields %>
2
+ <div class="col">
3
+ <% if destroy_action %>
4
+ <\%= button_to "Delete <i class='fa fa-1x fa-remove'></i>".html_safe, <%= path_helper_singular %>(<%= path_helper_args %>), method: :delete, data: <%= delete_confirmation_syntax %>, disable_with: "Loading...", class: "delete-<%= singular %>-button btn btn-primary " %>
5
+ <% end %>
6
+ &nbsp;
7
+ <\%= link_to "Edit <i class='fa fa-1x fa-list-alt'></i>".html_safe, edit_<%= path_helper_singular %>(<%= path_helper_args %>), <% if @big_edit %>'data-turbo' => 'false', <% end %>disable_with: "Loading...", class: "edit-<%= singular %>-button btn btn-primary " %>
8
+ </div>
@@ -0,0 +1,18 @@
1
+ <\% if @<%= singular %>.errors.none? %>
2
+ <\%= turbo_stream.replace "<%= plural %>-list" do %>
3
+ <\%= render partial: "list", locals: {<%= plural %>: @<%= plural %>} %>
4
+ <\% end %>
5
+ <\% end %>
6
+ <\%= turbo_stream.replace "<%= singular %>-new" do %>
7
+ <\% if @<%= singular %>.errors.none? %>
8
+ <\%= render partial: "new_button" %>
9
+ <\% else %>
10
+ <\%= render partial: "new_form", locals: {<%= singular %>: @<%= singular %>} %>
11
+ <\% end %>
12
+ <\% end %>
13
+ <\%= turbo_stream.replace "flash_notices" do %>
14
+ <\%= render partial: "layouts/flash_notices" %>
15
+ <\% if @<%= singular %>.errors.any? %>
16
+ <\%= render partial: "errors", locals: {resource: @<%= singular %>} %>
17
+ <\% end %>
18
+ <\% end %>
@@ -0,0 +1,3 @@
1
+ <\%= turbo_stream.replace "<%=plural%>-list" do %>
2
+ <\%= render partial: "list", locals: {<%=plural%>: @<%=plural%>} %>
3
+ <\% end %>
@@ -0,0 +1,30 @@
1
+ <\%= link_to "<i class='fa fa-arrow-circle-left 2x'></i> Back to list".html_safe, <%= path_helper_plural %> %>
2
+
3
+ <\%= turbo_frame_tag "<%= singular %>__#{<%= "@" + singular %>.id}" do %>
4
+
5
+ <div class="cell editable" style="position: relative;">
6
+
7
+ <\% if @<%= singular %>.errors.any? %>
8
+ <\%= render(partial: "#{controller.namespace}errors", locals: {resource: @<%= singular%> }) %>
9
+ <\% end %>
10
+
11
+ <h2>Editing</h2>
12
+ <% if eval("@" + singular).try(:to_label) %>
13
+ <%="@" + singular%>.to_label
14
+ <% elsif eval("@" + singular).try(:name) %>
15
+ <%="@" + singular%>.name %>
16
+ <% else %>
17
+ (no name)
18
+ <% end %>
19
+ <\%= form_with model: <%= "@" + singular%>, url: <%= path_helper_singular %>(<%= path_arity %>) do |f| %>
20
+ <\%= render partial: "form", locals: {:<%= singular %> => <%= "@" + singular%>, f: f} %>
21
+ <\% end %>
22
+ <i class='fa fa-times-circle fa-2x'
23
+ data-name='close-<%= singular %>__<\% <%= "@" + singular %>.id %> }'
24
+ data-row-id=<%= "@" + singular %>.id,
25
+ data-role='close-button'></i>
26
+ </div>
27
+
28
+ <\% end %>
29
+
30
+
@@ -0,0 +1,3 @@
1
+ <\%= turbo_stream.replace "<%= singular%>__#{@<%= singular %>.id}" do %>
2
+ <\%= render 'edit' %>
3
+ <\% end %>
@@ -0,0 +1,10 @@
1
+ <div class="container-fluid">
2
+ <div class="row">
3
+ <div class="col-md-12">
4
+ <\%= render partial: "new_button" %>
5
+ <div class="clearfix"></div>
6
+ <\%= render partial: '<%= list_path_partial %>',
7
+ locals: {<%= plural %>: @<%= plural %>} \%>
8
+ </div>
9
+ </div>
10
+ </div>
@@ -0,0 +1 @@
1
+ <\%= render partial: "new_form", locals: {<%= singular %>: @<%=singular%>} %>
@@ -0,0 +1,10 @@
1
+ <\%= turbo_stream.replace "<%= singular%>__#{@<%= singular %>.id}" do %>
2
+ <\%= render partial: 'line', locals: {<%= singular %>: @<%= singular %> <%= nested_assignments_with_leading_comma %> } %>
3
+ <\% end %>
4
+
5
+ <\%= turbo_stream.replace "flash_notices" do %>
6
+ <\%= render partial: "layouts/flash_notices" %>
7
+ <\% if @<%= singular %>.errors.any? %>
8
+ <\%= render partial: "errors", locals: {resource: @<%= singular %>} %>
9
+ <\% end %>
10
+ <\% end %>
@@ -98,7 +98,7 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
98
98
  visit <%= path_helper_plural %>
99
99
  find("a.edit-<%= singular %>-button[href='/<%= namespace_with_slash %><%= plural %>/#{<%= singular %>1.id}/edit']").click
100
100
 
101
- expect(page).to have_content("Editing #{<%= singular %>1.<%= derrive_reference_name(singular_class) %>}")
101
+ expect(page).to have_content("Editing #{<%= singular %>.<%= "abc" %>}")
102
102
  <%=
103
103
  @columns.map { |col|
104
104
  type = eval("#{singular_class}.columns_hash['#{col}']").type
data/lib/hot-glue.rb CHANGED
@@ -3,26 +3,12 @@ require "hotglue/engine"
3
3
  require 'kaminari'
4
4
  require 'haml-rails'
5
5
 
6
-
7
6
  module HotGlue
8
7
 
9
- # module ControllerHelpers
10
- # def modify_date_inputs_on_params(modified_params, authenticated_user = nil)
11
- # use_timezone = authenticated_user.timezone || Time.now.strftime("%z")
12
- #
13
- # modified_params = modified_params.tap do |params|
14
- # params.keys.each{|k|
15
- # if k.ends_with?("_at") || k.ends_with?("_date")
16
- #
17
- # begin
18
- # params[k] = DateTime.strptime("#{params[k]} #{use_timezone}", '%Y-%m-%dT%H:%M %z')
19
- # rescue StandardError
20
- #
21
- # end
22
- # end
23
- # }
24
- # end
25
- # modified_params
26
- # end
27
- # end
8
+
9
+
10
+ module TemplateBuilders
11
+
12
+ end
28
13
  end
14
+
@@ -1,3 +1,3 @@
1
1
  module HotGlue
2
- VERSION = '0.1.2'
2
+ VERSION = '0.2.3'
3
3
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hot-glue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.3
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-06-28 00:00:00.000000000 Z
11
+ date: 2021-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.1'
20
+ - - "<="
18
21
  - !ruby/object:Gem::Version
19
- version: '6.0'
22
+ version: 7.0.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">"
28
+ - !ruby/object:Gem::Version
29
+ version: '5.1'
30
+ - - "<="
25
31
  - !ruby/object:Gem::Version
26
- version: '6.0'
32
+ version: 7.0.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: kaminari
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -96,7 +102,7 @@ dependencies:
96
102
  version: '2.16'
97
103
  description: Simple, plug & play Rails scaffold building companion for Turbo-Rails
98
104
  and Hotwire
99
- email: tech@datatravels.com
105
+ email: code@jasonfb.net
100
106
  executables: []
101
107
  extensions: []
102
108
  extra_rdoc_files: []
@@ -121,29 +127,48 @@ files:
121
127
  - db/migrate/20210306225506_create_xyzs.rb
122
128
  - db/schema.rb
123
129
  - lib/generators/hot_glue/install_generator.rb
130
+ - lib/generators/hot_glue/markup_templates/base.rb
131
+ - lib/generators/hot_glue/markup_templates/erb.rb
132
+ - lib/generators/hot_glue/markup_templates/haml.rb
133
+ - lib/generators/hot_glue/markup_templates/slim.rb
124
134
  - lib/generators/hot_glue/scaffold_generator.rb
125
- - lib/generators/hot_glue/templates/_errors.haml
126
- - lib/generators/hot_glue/templates/_flash_notices.haml
127
- - lib/generators/hot_glue/templates/_form.haml
128
- - lib/generators/hot_glue/templates/_line.haml
129
- - lib/generators/hot_glue/templates/_list.haml
130
- - lib/generators/hot_glue/templates/_new_button.haml
131
- - lib/generators/hot_glue/templates/_new_form.haml
132
- - lib/generators/hot_glue/templates/_show.haml
133
135
  - lib/generators/hot_glue/templates/base_controller.rb.erb
134
136
  - lib/generators/hot_glue/templates/controller.rb.erb
135
- - lib/generators/hot_glue/templates/create.turbo_stream.haml
136
- - lib/generators/hot_glue/templates/destroy.turbo_stream.haml
137
- - lib/generators/hot_glue/templates/edit.haml
138
- - lib/generators/hot_glue/templates/edit.turbo_stream.haml
139
- - lib/generators/hot_glue/templates/index.haml
140
- - lib/generators/hot_glue/templates/new.haml
137
+ - lib/generators/hot_glue/templates/erb/_errors.erb
138
+ - lib/generators/hot_glue/templates/erb/_flash_notices.erb
139
+ - lib/generators/hot_glue/templates/erb/_form.erb
140
+ - lib/generators/hot_glue/templates/erb/_line.erb
141
+ - lib/generators/hot_glue/templates/erb/_list.erb
142
+ - lib/generators/hot_glue/templates/erb/_new_button.erb
143
+ - lib/generators/hot_glue/templates/erb/_new_form.erb
144
+ - lib/generators/hot_glue/templates/erb/_show.erb
145
+ - lib/generators/hot_glue/templates/erb/create.turbo_stream.erb
146
+ - lib/generators/hot_glue/templates/erb/destroy.turbo_stream.erb
147
+ - lib/generators/hot_glue/templates/erb/edit.erb
148
+ - lib/generators/hot_glue/templates/erb/edit.turbo_stream.erb
149
+ - lib/generators/hot_glue/templates/erb/index.erb
150
+ - lib/generators/hot_glue/templates/erb/new.erb
151
+ - lib/generators/hot_glue/templates/erb/update.turbo_stream.erb
152
+ - lib/generators/hot_glue/templates/haml/_errors.haml
153
+ - lib/generators/hot_glue/templates/haml/_flash_notices.haml
154
+ - lib/generators/hot_glue/templates/haml/_form.haml
155
+ - lib/generators/hot_glue/templates/haml/_line.haml
156
+ - lib/generators/hot_glue/templates/haml/_list.haml
157
+ - lib/generators/hot_glue/templates/haml/_new_button.haml
158
+ - lib/generators/hot_glue/templates/haml/_new_form.haml
159
+ - lib/generators/hot_glue/templates/haml/_show.haml
160
+ - lib/generators/hot_glue/templates/haml/create.turbo_stream.haml
161
+ - lib/generators/hot_glue/templates/haml/destroy.turbo_stream.haml
162
+ - lib/generators/hot_glue/templates/haml/edit.haml
163
+ - lib/generators/hot_glue/templates/haml/edit.turbo_stream.haml
164
+ - lib/generators/hot_glue/templates/haml/index.haml
165
+ - lib/generators/hot_glue/templates/haml/new.haml
166
+ - lib/generators/hot_glue/templates/haml/update.turbo_stream.haml
141
167
  - lib/generators/hot_glue/templates/system_spec.rb.erb
142
- - lib/generators/hot_glue/templates/update.turbo_stream.haml
143
168
  - lib/hot-glue.rb
144
169
  - lib/hotglue/engine.rb
145
170
  - lib/hotglue/version.rb
146
- homepage: https://blog.jasonfleetwoodboldt.com/hot-glue/
171
+ homepage: https://jasonfleetwoodboldt.com/hot-glue/
147
172
  licenses:
148
173
  - Nonstandard
149
174
  metadata:
@@ -181,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
206
  - !ruby/object:Gem::Version
182
207
  version: '0'
183
208
  requirements: []
184
- rubygems_version: 3.0.9
209
+ rubygems_version: 3.1.4
185
210
  signing_key:
186
211
  specification_version: 4
187
212
  summary: A gem build scaffolding.