hot-glue 0.4.6 → 0.4.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +71 -0
  3. data/.github/FUNDING.yml +2 -2
  4. data/.gitignore +4 -1
  5. data/Gemfile +5 -1
  6. data/Gemfile.lock +16 -16
  7. data/README.md +333 -314
  8. data/README2.md +79 -0
  9. data/config/database.yml +8 -83
  10. data/db/schema.rb +1 -0
  11. data/lib/generators/hot_glue/install_generator.rb +0 -1
  12. data/lib/generators/hot_glue/layout/builder.rb +51 -33
  13. data/lib/generators/hot_glue/markup_templates/erb.rb +97 -88
  14. data/lib/generators/hot_glue/scaffold_generator.rb +259 -95
  15. data/lib/generators/hot_glue/templates/controller.rb.erb +51 -47
  16. data/lib/generators/hot_glue/templates/erb/_form.erb +3 -2
  17. data/lib/generators/hot_glue/templates/erb/_line.erb +1 -1
  18. data/lib/generators/hot_glue/templates/erb/_list.erb +19 -12
  19. data/lib/generators/hot_glue/templates/erb/_new_button.erb +1 -1
  20. data/lib/generators/hot_glue/templates/erb/_new_form.erb +4 -3
  21. data/lib/generators/hot_glue/templates/erb/_show.erb +10 -6
  22. data/lib/generators/hot_glue/templates/erb/create.turbo_stream.erb +4 -4
  23. data/lib/generators/hot_glue/templates/erb/destroy.turbo_stream.erb +2 -2
  24. data/lib/generators/hot_glue/templates/erb/edit.erb +2 -2
  25. data/lib/generators/hot_glue/templates/erb/index.erb +1 -1
  26. data/lib/generators/hot_glue/templates/erb/new.erb +1 -1
  27. data/lib/generators/hot_glue/templates/erb/update.turbo_stream.erb +2 -2
  28. data/lib/hotglue/version.rb +3 -1
  29. metadata +5 -19
  30. data/db/schema.rb +0 -60
  31. data/lib/generators/hot_glue/markup_templates/haml.rb +0 -243
  32. data/lib/generators/hot_glue/markup_templates/slim.rb +0 -9
@@ -3,61 +3,61 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
3
3
  include HotGlue::ControllerHelper
4
4
 
5
5
  <% unless @auth_identifier == '' || @god %>before_action :authenticate_<%= @auth_identifier %>!<% end %>
6
- <% if any_nested? %><% nest_chain = [] %> <% @nested_args.each { |arg|
7
- this_scope = nest_chain.empty? ? "#{@auth ? auth_object : class_name}.#{arg}s" : "#{nest_chain.last}.#{arg}s"
8
- nest_chain << arg %>
9
- before_action :<%= arg %>
6
+ <% if any_nested? %><% nest_chain = [] %> <% @nested_set.each { |arg|
7
+
8
+ if auth_identifier == arg[:singular]
9
+ this_scope = auth_object
10
+ elsif nest_chain.empty?
11
+ this_scope = "#{@auth ? auth_object : class_name}.#{arg}s"
12
+ else
13
+ this_scope = "#{nest_chain.last}.#{arg[:plural]}"
14
+ end
15
+
16
+ nest_chain << arg %>
17
+ before_action :<%= arg[:singular] %><%= ", if: -> { params.include?(:#{arg[:singular]}_id) }" if arg[:optional] %>
18
+
10
19
  <% } %><% end %>
11
20
  before_action :load_<%= singular_name %>, only: [:show, :edit, :update, :destroy]
12
21
  after_action -> { flash.discard }, if: -> { request.format.symbol == :turbo_stream }
13
-
14
- <% if no_devise_installed %>
15
- # TODO: implement current_user or use Devise
16
- <% end %>
17
-
18
- <% if @nested_args.any? %>
19
- def <%= @nested_args[0] %>
20
- <% if @god
21
- next_object = nil
22
- collect_objects = @nested_args.reverse.collect {|x|
23
- if eval("#{next_object || class_name}.reflect_on_association(:#{x})").nil?
24
- raise "***** Unable to find the association `#{x}` on the class #{next_object || class_name} ..... you probably want to add `belongs_to :#{x}` to the #{next_object || class_name} object?"
25
- end
26
- next_object = eval("#{next_object || class_name}.reflect_on_association(:#{x})").class_name
27
- }
28
- root_object = collect_objects.last
22
+ <% if @nested_args.any? %>
23
+ def <%= @nested_set[0][:singular] %><% if @god
24
+ next_object = nil
25
+ collect_objects = @nested_set.reverse.collect {|x|
26
+ if eval("#{next_object || class_name}.reflect_on_association(:#{x[:singular]})").nil?
27
+ raise "***** Unable to find the association `#{x[:singular]}` on the class #{next_object || class_name} ..... you probably want to add `belongs_to :#{x}` to the #{next_object || class_name} object?"
28
+ end
29
+ next_object = eval("#{next_object || class_name}.reflect_on_association(:#{x[:singular]})").class_name
30
+ }
31
+ root_object = collect_objects.last
29
32
  else
30
- root_object = @auth + "." + @nested_args[0] + "s"
33
+ if @nested_set[0][:singular] == @auth_identifier
34
+ root_object = @auth
35
+ else
36
+ root_object = @auth + "." + @nested_set[0][:plural]
37
+ end
31
38
  end
32
-
33
- %>
34
- <% if !@god %> @<%= @nested_args[0] %> ||= <%= root_object %>.find(params[:<%= @nested_args[0] %>_id])
35
- <% else %> @<%= @nested_args[0] %> ||= <%= root_object %>.find(params[:<%= @nested_args[0] %>_id]) <% end %>
39
+ %><% if !@god && @nested_set[0][:singular] == @auth_identifier %>
40
+ @<%= @nested_set[0][:singular] %> ||= <%= root_object %> <% else %>
41
+ @<%= @nested_set[0][:singular] %> ||= <%= root_object %>.find(params[:<%= @nested_set[0][:singular] %>_id])<%= " if params.include?(:#{@nested_set[0][:singular]}_id)" if @nested_set[0][:optional] %> <% end %>
36
42
  end
37
- <% end %>
38
-
39
- <% if any_nested? %><% nest_chain = [@nested_args[0]]; this_scope = @nested_args[0] + 's'; %> <% @nested_args[1..-1].each { |arg|
40
- this_scope = "#{nest_chain.last}.#{arg}s"
41
- nest_chain << arg
42
- %>
43
- def <%= arg %>
44
- @<%= arg %> ||= <%= this_scope %>.find(params[:<%= arg %>_id])
45
- end<% } %>
46
-
47
- <% end %>
43
+ <% end %><% if any_nested? %><% nest_chain = [@nested_set[0][:singular]]; this_scope = @nested_set[0][:plural]; %> <% @nested_set[1..-1].each_with_index { |arg,index|
44
+ this_scope = "#{nest_chain.last}.#{arg[:plural]}"
45
+ nest_chain << arg %>
46
+ def <%= arg[:singular] %>
47
+ @<%= arg[:singular] %> ||= (<%= this_scope %>.find(params[:<%= arg[:singular] %>_id])<%= " if params.include?(:#{@nested_set[index][:singular]}_id)" if @god && arg[:optional] %>)<% if @god && arg[:optional] %> || (<%= collect_objects[index] %>.find(params[:<%= arg[:singular] %>_id]) if params.include?(:<%= arg[:singular] %>_id) ) <% end %>
48
+ end<% } %> <% end %> <% if !@self_auth %>
48
49
 
49
-
50
- <% if !@self_auth %>
51
50
  def load_<%= singular_name %>
52
- @<%= singular_name %> = <%= object_scope.gsub("@",'') %>.find(params[:id])
51
+ @<%= singular_name %> = (<%= object_scope.gsub("@",'') %>.find(params[:id])<%= " if params.include?(:#{@nested_set.last[:singular]}_id)" if @nested_set[0] && @nested_set[0][:optional] %>)<% if @nested_set[0] && @nested_set[0][:optional] %> || <%= class_name %>.find(params[:id])<% end %>
53
52
  end
54
53
  <% else %>
55
54
  def load_<%= singular_name %>
56
- @<%= singular_name %> = <%= auth_object.gsub("@",'') %>
55
+ @<%= singular_name %> = (<%= auth_object.gsub("@",'') %><%= " if params.include?(:#{@nested_set[0][:singular]}_id)" if @nested_set.any? && @nested_set[0][:optional] %>)<% if @nested_set.any? && @nested_set[0][:optional] %> || <%= class_name %>.find(params[:id])<% end %>
57
56
  end<% end %>
58
57
 
59
- def load_all_<%= plural %>
60
- @<%= plural_name %> = <%= object_scope.gsub("@",'') %>.page(params[:page])
58
+ def load_all_<%= plural %> <% if !@self_auth %>
59
+ @<%= plural_name %> = ( <%= object_scope.gsub("@",'') %>.page(params[:page])<%= n_plus_one_includes %><%= " if params.include?(:#{ @nested_set.last[:singular]}_id)" if @nested_set.any? && @nested_set[0] && @nested_set[0][:optional] %>) <% if @nested_set[0] && @nested_set[0][:optional] %> || <%= class_name %>.all<% end %> <% else %>
60
+ @<%= plural_name %> = <%= class_name %>.where(id: <%= auth_object.gsub("@",'') %>.id)<%= n_plus_one_includes %> # returns iterable even though this <%= singular_name %> is only allowed access to themselves<% end %>
61
61
  end
62
62
 
63
63
  def index
@@ -67,10 +67,12 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
67
67
  end
68
68
  end
69
69
 
70
- <% if create_action %> def new <% if ! @god %>
70
+ <% if create_action %> def new
71
+ <% if ! @god %>
71
72
  @<%= singular_name %> = <%= class_name %>.new(<%= @object_owner_sym %>: <%= @object_owner_eval %>)
72
- <% else %>
73
- @<%= singular_name %> = <%= class_name %>.new
73
+ <% elsif @object_owner_optional && any_nested? %>
74
+ @<%= singular_name %> = <%= class_name %>.new({}.merge(<%= @nested_set.last[:singular] %> ? {<%= @object_owner_sym %>: <%= @object_owner_eval %>} : {})) <% else %>
75
+ @<%= singular_name %> = <%= class_name %>.new(<% if any_nested? %><%= @object_owner_sym %>: <%= @object_owner_eval %><% end %>)
74
76
  <% end %>
75
77
  respond_to do |format|
76
78
  format.html
@@ -78,8 +80,10 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
78
80
  end
79
81
 
80
82
  def create
81
- modified_params = modify_date_inputs_on_params(<%=singular_name %>_params.dup<% if !@object_owner_sym.empty? %>.merge!(<%= @object_owner_sym %>: <%= @object_owner_eval %> )<% end %> <%= @auth ? ', ' + @auth : '' %>)
82
- @<%=singular_name %> = <%=class_name %>.create(modified_params)
83
+ modified_params = modify_date_inputs_on_params(<%= singular_name %>_params.dup<% if ! @object_owner_sym.empty? %>.merge!(<% if @object_owner_optional && any_nested? %><%= @object_owner_name %> ? {<%= @object_owner_sym %>: <%= @object_owner_eval %>} : {} <% else %> <%= @object_owner_sym %>: <%= @object_owner_eval %><% end %>) <% end %>)
84
+
85
+
86
+ @<%=singular_name %> = <%= class_name %>.create(modified_params)
83
87
 
84
88
  if @<%= singular_name %>.save
85
89
  flash[:notice] = "Successfully created #{@<%= singular %>.<%= display_class %>}"
@@ -1,8 +1,9 @@
1
1
  <div class="row">
2
- <%= all_form_fields %>
2
+ <%= all_form_fields %>
3
3
 
4
4
  <div class="<%= @layout == "hotglue" ? 'scaffold-cell' : 'col-md-2' %>">
5
- <\%= link_to "Cancel", <%= path_helper_plural %>, {class: "btn btn-secondary"} %>
5
+ <\%= link_to "Cancel", <%= path_helper_plural %>, {class: "btn btn-secondary"} %><% if @no_field_form %>
6
+ <\%= f.hidden_field "_________" %><% end %>
6
7
  <\%= f.submit "Save", class: "btn btn-primary pull-right" %>
7
8
  </div>
8
9
  </div>
@@ -1,7 +1,7 @@
1
1
 
2
2
  <\%= turbo_frame_tag "<%= singular %>__#{ <%= singular %>.id }" do %>
3
3
  <div class='row scaffold-row' data-id='<\%= <%= singular %>.id %>' data-edit='false'>
4
- <\%= render partial: '<%= show_path_partial %>', locals: { <%= singular %>: <%= singular %><%= nest_assignments_operator(false, true) if @nestable %><%= (", nested_for: \"" + @nested_args.collect{|a| a + "-" + '#{'+ a + '.id}' }.join("__") + "\"") if @nestable %> } %>
4
+ <\%= render partial: '<%= show_path_partial %>', locals: { <%= singular %>: <%= singular %> }<% @nested_set.each do |nest_arg| %>.merge(defined?(<%= nest_arg[:singular] %>) ? {<%= nest_arg[:singular] %>: <%= nest_arg[:singular] %>, nested_for: "<%= nest_arg[:singular] %>-#{<%= nest_arg[:singular] %>.id}"} : {})<% end %> %>
5
5
 
6
6
  </div>
7
7
  <\% end %>
@@ -1,24 +1,28 @@
1
1
  <\%= turbo_frame_tag "<%= plural %>-list" <%= nested_for_turbo_id_list_constructor %> do %>
2
2
  <div class="<%= @container_name %> scaffold-list">
3
- <% unless @no_list || @nested_args.any? %><h4><%= plural.gsub("_", " ").upcase %></h4><% end %>
3
+ <% unless @no_list || @no_list_heading || (@nested_set.any? && !@nested_set.collect{|x| x[:optional]}.any?) %>
4
+ <% unless list_label.nil? %><h4>
5
+ <%= list_label %>
6
+ </h4><% end %>
7
+ <% end %>
4
8
 
5
- <% unless @no_create %><%= '<%= render partial: "' + ((@namespace+"/" if @namespace) || "") + @controller_build_folder + '/new_button", locals: {' + nested_assignments + '}' + '%\>'.gsub('\\',"") %><br /><% end %>
9
+ <% unless @no_create %><%= '<%= render partial: "' + ((@namespace+"/" if @namespace) || "") + @controller_build_folder + '/new_button", locals: {}' + @nested_set.collect{|arg| ".merge(defined?(#{arg[:singular]}) ? {#{arg[:singular]}: #{arg[:singular]}} : {})"}.join() + ' %\>'.gsub('\\',"") %><br /><% end %>
6
10
 
7
11
  <% unless @no_list %>
8
12
  <% unless @no_list_labels %>
9
13
  <div class="row scaffold-heading-row">
10
14
  <%= list_column_headings %>
11
- <% if @downnest_children.any? %>
12
- <% each_downnest_width = @downnest_children.count == 1 ? 40 : (60/@downnest_children.count).floor %>
15
+ <% if @downnest_object.any? %>
16
+ <%# each_downnest_width = @downnest_object.count == 1 ? 40 : (60/@downnest_object.count).floor %>
13
17
  <% downnest_column_style = @layout == "hotglue" ? 'style="flex-basis: ' + each_downnest_width.to_s + '%;' : "" %>
14
18
 
15
- <% @downnest_children.each_with_index do |downnest,i| %>
16
- <div class=" scaffold-col-heading<%= " col-sm-#{ @layout_object[:portals][downnest][:size] }" if @layout=="bootstrap" %>" <%= downnest_column_style %>>
17
- <strong>
18
- <%= downnest.titleize %>
19
- </strong>
20
- </div>
21
- <% end %>
19
+ <% @downnest_object.each do |downnest,i| %>
20
+ <div class=" scaffold-col-heading<%= " col-sm-#{ @layout_object[:portals][downnest][:size] }" if @layout=="bootstrap" %>" <%= downnest_column_style %>>
21
+ <strong>
22
+ <%= downnest.titleize %>
23
+ </strong>
24
+ </div>
25
+ <% end %>
22
26
  <% end %>
23
27
 
24
28
  <% button_column_style = @layout == "hotglue" ? 'style="flex-basis: 150px' : "" %>
@@ -35,7 +39,10 @@
35
39
  </div>
36
40
  <\% end %>
37
41
  <\% <%= plural %>.each do |<%= singular %>| %>
38
- <\%= render partial: '<%= line_path_partial %>', locals: {<%= singular %>: <%= singular %><%= nested_assignments_with_leading_comma if @nestable %><%= ", nested_for: nested_for" if @nestable %> } %>
42
+ <\%= render partial: '<%= line_path_partial %>', locals: {<%= singular %>: <%= singular %>}
43
+ .merge(defined?(nested_for) ? {nested_for: nested_for} : {})
44
+ <%= @nested_set.collect{|arg| " .merge(defined?(#{arg[:singular]}) ? {#{arg[:singular]}: #{arg[:singular]}} : {})"}.join("\n") %>
45
+ %>
39
46
  <\% end %>
40
47
  <%= @no_paginate ? "" : paginate %>
41
48
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <\%= turbo_frame_tag "<%= singular %>-new" do %>
2
2
  <div>
3
- <\%= link_to "New <%= singular.titlecase %>", <%= new_path_name %>, disable_with: "Loading...", class: "new-<%= singular %>-button btn btn-primary pull-right <%= 'btn-sm' if @nested_args.any? %> " %>
3
+ <\%= link_to "New <%= thing_label %>", <%= new_path_name %>, disable_with: "Loading...", class: "new-<%= singular %>-button btn btn-primary pull-right <%= 'btn-sm' if @nested_args.any? %> " %>
4
4
  </div>
5
5
  <\% end %>
@@ -1,8 +1,9 @@
1
1
  <\%= turbo_frame_tag "<%= singular %>-new" do %>
2
2
  <h3>
3
- New <%= singular.titlecase %>
3
+ New <%= thing_label %>
4
4
  </h3>
5
- <\%= form_with model: <%= singular %>, url: <%= path_helper_plural %>(<%= nested_objects_arity %>), method: "post" do |f| %>
6
- <\%= render partial: "<%= namespace_with_slash + @controller_build_folder %>/form", locals: { <%= singular %>: <%= singular %>, f: f} %>
5
+ <\%= form_with model: <%= singular %>, url: <%= form_path_new_helper %>, method: :post do |f| \%>
6
+ <\%= render partial: "<%= namespace_with_slash + @controller_build_folder %>/form",
7
+ locals: { <%= singular %>: <%= singular %>, f: f}<%= @nested_set.collect{|arg| ".merge(defined?(#{arg[:singular]}) ? {#{arg[:singular]}: #{arg[:singular]}}: {})" }.join %> \%>
7
8
  <\% end %>
8
9
  <\% end %>
@@ -3,17 +3,21 @@
3
3
  <% if @downnest_children.any? %>
4
4
  <% each_downnest_width = @downnest_children.count == 1 ? 33 : (53/@downnest_children.count).floor %>
5
5
 
6
- <% @downnest_children.each_with_index do |downnest,i| %>
6
+ <% @downnest_object.each do |downnest, size| %>
7
7
 
8
8
  <% downnest_object = eval("#{singular_class}.reflect_on_association(:#{downnest})") %>
9
+ <% if downnest_object.nil?; raise "no relationship for downnested portal `#{downnest}` found on `#{singular_class}`; please check relationship for has_many :#{downnest}"; end; %>
9
10
  <% downnest_class = downnest_object.class_name %>
10
11
  <% downnest_object_name = eval("#{downnest_class}.table_name") %>
11
12
  <% downnest_style = @layout == "hotglue" ? 'style="flex-basis: ' + each_downnest_width.to_s + '%"' : "" %>
12
13
  <div class="<%= " col-md-#{@layout_object[:portals][downnest][:size]}" if @layout == "bootstrap" %> scaffold-downnest" <%= downnest_style %> >
13
14
  <\%= render partial: "<%= namespace_with_trailing_dash %><%= downnest_object_name %>/list", locals: {
14
- nested_for: "<% if @nested_args.any? %>#{nested_for + "__" if nested_for}<% end %><%= @singular %>-#{<%= @singular %>.id}",
15
- <%= @singular %>: <%= @singular %><%= nest_assignments_operator(false, true) %>,
16
- <%= downnest_object_name %>: <%= @singular %>.<%= downnest %>} %>
15
+ <%= @singular %>: <%= @singular %>,
16
+ <%= downnest_object_name %>: <%= @singular %>.<%= downnest %>
17
+ }
18
+ .merge({nested_for: "<% if @nested_args.any? %>#{nested_for + "__" if defined?(nested_for)}<% end %><%= @singular %>-#{<%= @singular %>.id}"})
19
+ <%= @nested_set.collect{|arg| ".merge(defined?(#{arg[:singular]}) ? {#{arg[:singular]}: #{arg[:singular]}} : {} )"}.join("\n") %>
20
+ \%>
17
21
  </div>
18
22
  <% end %>
19
23
  <% end %>
@@ -23,12 +27,12 @@
23
27
  <%= magic_button_output %>
24
28
 
25
29
  <% if destroy_action %>
26
- <\%= form_with url: <%= path_helper_singular %>(<%= path_helper_args %>), html: {data: {'<%= @ujs_syntax ? 'confirm' : 'turbo-confirm' %>': "Are you sure you want to delete #{ <%= @singular + "." + display_class %> }?"}, style: "display: inline-block;"}, method: :delete do |f| %>
30
+ <\%= form_with url: <%= delete_path_helper %>, html: {data: {'<%= @ujs_syntax ? 'confirm' : 'turbo-confirm' %>': "Are you sure you want to delete #{ <%= @singular + "." + display_class %> }?"}, style: "display: inline-block;"}, method: :delete do |f| %>
27
31
  <\%= f.submit "Delete".html_safe, class: "delete-<%= singular %>-button btn btn-primary btn-sm" %>
28
32
  <\% end %>
29
33
  <% end %>
30
34
 
31
35
  <% unless @no_edit %>
32
- <\%= 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 btn-sm" %>
36
+ <\%= link_to "Edit <i class='fa fa-1x fa-list-alt'></i>".html_safe, <%= edit_path_helper %>, <% if @big_edit %>'data-turbo' => 'false', <% end %>disable_with: "Loading...", class: "edit-<%= singular %>-button btn btn-primary btn-sm" %>
33
37
  <% end %>
34
38
  </div>
@@ -1,13 +1,13 @@
1
1
  <\% if @<%= singular %>.errors.none? %>
2
- <\%= turbo_stream.replace "<%= plural %>-list<%= nested_for_turbo_nested_constructor %>" do %>
3
- <\%= render partial: "list", locals: {<%= plural %>: @<%= plural %><%= nested_for_assignments_constructor %><%= nest_assignments_operator(true, true) %>} %>
2
+ <\%= turbo_stream.replace "<%= plural %>-list" + <%= nested_for_turbo_nested_constructor %> do %>
3
+ <\%= render partial: "list", locals: {<%= plural %>: @<%= plural %>}<%= @nested_set.collect{|arg| ".merge(@" + arg[:singular] + " ? {nested_for: \"" + arg[:singular] + "-\#{@" + arg[:singular] + ".id}\"" + ", " + arg[:singular] + ": @" + arg[:singular] + "} : {})"}.join() %> \%>
4
4
  <\% end %>
5
5
  <\% end %>
6
6
  <\%= turbo_stream.replace "<%= singular %>-new" do %>
7
7
  <\% if @<%= singular %>.errors.none? %>
8
- <\%= render partial: "new_button", locals: {<%= nest_assignments_operator(true, false) %>} %>
8
+ <\%= render partial: "new_button", locals: {}<%= @nested_set.collect{|arg| ".merge(@" + arg[:singular] + " ? {" + arg[:singular] + ": @" + arg[:singular] + "} : {})"}.join() %> %>
9
9
  <\% else %>
10
- <\%= render partial: "new_form", locals: {<%= singular %>: @<%= singular %> <%= nest_assignments_operator(true, true) %> } %>
10
+ <\%= render partial: "new_form", locals: {<%= singular %>: @<%= singular %>}<%= @nested_set.collect{|arg| ".merge(@" + arg[:singular] + " ? {" + arg[:singular] + ": @" + arg[:singular] + "} : {})"}.join() %> %>
11
11
  <\% end %>
12
12
  <\% end %>
13
13
  <\%= turbo_stream.replace "flash_notices" do %>
@@ -1,3 +1,3 @@
1
- <\%= turbo_stream.replace "<%= plural %>-list<%= nested_for_turbo_nested_constructor %>" do %>
2
- <\%= render partial: "list", locals: {<%=plural%>: @<%=plural%> <%= nested_for_assignments_constructor %> <%= nest_assignments_operator(true, true) %>} %>
1
+ <\%= turbo_stream.replace "<%= plural %>-list" + <%= nested_for_turbo_nested_constructor %> do %>
2
+ <\%= render partial: "list", locals: {<%=plural%>: @<%=plural%> }<%= @nested_set.collect{|arg| ".merge(@" + arg[:singular] + " ? {nested_for: \"" + arg[:singular] + "-\#{@" + arg[:singular] + ".id}\"" + ", " + arg[:singular] + ": @" + arg[:singular] + "} : {})"}.join() %> \%>
3
3
  <\% end %>
@@ -9,8 +9,8 @@
9
9
  <\% end %>
10
10
 
11
11
  <h2>Editing <\%= @<%= @singular %>.<%= display_class %> %></h2>
12
- <\%= form_with model: <%= "@" + singular%>, url: <%= path_helper_singular %>(<%= path_arity %>) do |f| %>
13
- <\%= render partial: "form", locals: {:<%= singular %> => <%= "@" + singular%>, f: f} %>
12
+ <\%= form_with model: <%= "@" + singular %>, url: <%= form_path_edit_helper %> do |f| %>
13
+ <\%= render partial: "form", locals: {:<%= singular %> => <%= "@" + singular%>, f: f}<%= @nested_set.collect{|arg| ".merge(@#{arg[:singular]} ? {#{arg[:singular]}: @#{arg[:singular]}} : {})" }.join %> \%>
14
14
  <\% end %>
15
15
 
16
16
  </div>
@@ -8,7 +8,7 @@
8
8
 
9
9
  <div class="clearfix"></div>
10
10
  <\%= render partial: '<%= list_path_partial %>',
11
- locals: {<%= plural %>: @<%= plural %><%= nested_for_assignments_constructor %><%= nest_assignments_operator(true, true) if @nestable %> } \%>
11
+ locals: {<%= plural %>: @<%= plural %>}<%= @nested_set.collect{|arg| ".merge(@" + arg[:singular] + " ? {nested_for: \"" + arg[:singular] + "-\#{@" + arg[:singular] + ".id}\"" + ", " + arg[:singular] + ": @" + arg[:singular] + "} : {})"}.join() %> \%>
12
12
 
13
13
  <% if @layout == "bootstrap" %></div></div><% else %></div><% end %>
14
14
  </div>
@@ -1 +1 @@
1
- <\%= render partial: "new_form", locals: {<%= singular %>: @<%=singular%>} %>
1
+ <\%= render partial: "new_form", locals: {<%= singular %>: @<%=singular%>}<%= @nested_set.collect{|arg| ".merge(@#{arg[:singular]} ? {#{arg[:singular]}: @#{arg[:singular]}} : {})" }.join %> %>
@@ -1,7 +1,7 @@
1
1
  <% if !@display_list_after_update %><\%= turbo_stream.replace "<%= singular%>__#{@<%= singular %>.id}" do %>
2
- <\%= render partial: 'line', locals: {<%= singular %>: @<%= singular %> <%= nest_assignments_operator(true,true) %> } %>
2
+ <\%= render partial: 'line', locals: {<%= singular %>: @<%= singular %> }<%= @nested_set.collect{|arg| ".merge(@#{arg[:singular]} ? {#{arg[:singular]}: @#{arg[:singular]}} : {})" }.join %> \%>
3
3
  <\% end %><% else %><\%= turbo_stream.replace "<%= plural %>-list" do %>
4
- <\%= render partial: '<%= list_path_partial %>', locals: {<%= plural %>: @<%= plural %><%= nest_assignments_operator(true, true) if @nestable %><%= nested_for_assignments_constructor %> } \%>
4
+ <\%= render partial: '<%= list_path_partial %>', locals: {<%= plural %>: @<%= plural %>}<%= @nested_set.collect{|arg| ".merge(@#{arg[:singular]} ? {#{arg[:singular]}: @#{arg[:singular]}} : {})" }.join %> \%>
5
5
  <\% end %>
6
6
  <% end %>
7
7
 
@@ -1,3 +1,5 @@
1
1
  module HotGlue
2
- VERSION = '0.4.6'
2
+ class Version
3
+ CURRENT = '0.4.9.1'
4
+ end
3
5
  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.4.6
4
+ version: 0.4.9.1
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: 2022-01-23 00:00:00.000000000 Z
11
+ date: 2022-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.2'
41
- - !ruby/object:Gem::Dependency
42
- name: sass-rails
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: ffaker
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -73,6 +59,7 @@ executables: []
73
59
  extensions: []
74
60
  extra_rdoc_files: []
75
61
  files:
62
+ - ".circleci/config.yml"
76
63
  - ".github/FUNDING.yml"
77
64
  - ".gitignore"
78
65
  - ".travis.yml"
@@ -80,6 +67,7 @@ files:
80
67
  - Gemfile.lock
81
68
  - LICENSE
82
69
  - README.md
70
+ - README2.md
83
71
  - Rakefile
84
72
  - app/assets/config/manifest.js
85
73
  - app/helpers/hot_glue/controller_helper.rb
@@ -94,8 +82,6 @@ files:
94
82
  - lib/generators/hot_glue/layout/builder.rb
95
83
  - lib/generators/hot_glue/markup_templates/base.rb
96
84
  - lib/generators/hot_glue/markup_templates/erb.rb
97
- - lib/generators/hot_glue/markup_templates/haml.rb
98
- - lib/generators/hot_glue/markup_templates/slim.rb
99
85
  - lib/generators/hot_glue/scaffold_generator.rb
100
86
  - lib/generators/hot_glue/templates/base_controller.rb.erb
101
87
  - lib/generators/hot_glue/templates/capybara_login.rb
@@ -139,7 +125,7 @@ files:
139
125
  - lib/hot-glue.rb
140
126
  - lib/hotglue/engine.rb
141
127
  - lib/hotglue/version.rb
142
- homepage: https://jfb.teachable.com/p/hot-glue-in-depth-tutorial?utm_source=rubygems.org&utm_campaign=rubygems_link
128
+ homepage: https://heliosdev.shop/p/hot-glue?utm_source=rubygems.org&utm_campaign=rubygems_link
143
129
  licenses:
144
130
  - Commercial with free option
145
131
  metadata:
data/db/schema.rb DELETED
@@ -1,60 +0,0 @@
1
- # This file is auto-generated from the current state of the database. Instead
2
- # of editing this file, please use the migrations feature of Active Record to
3
- # incrementally modify your database, and then regenerate this schema definition.
4
- #
5
- # This file is the source Rails uses to define your schema when running `bin/rails
6
- # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
- # be faster and is potentially less error prone than running all of your
8
- # migrations from scratch. Old migrations may fail to apply correctly if those
9
- # migrations use external dependencies or application code.
10
- #
11
- # It's strongly recommended that you check this file into your version control system.
12
-
13
- ActiveRecord::Schema.define(version: 2021_03_06_225506) do
14
-
15
- create_table "abcs", force: :cascade do |t|
16
- t.integer "xxx"
17
- t.string "yyy"
18
- t.integer "dfg_id"
19
- t.datetime "created_at", precision: 6, null: false
20
- t.datetime "updated_at", precision: 6, null: false
21
- end
22
-
23
- create_table "dfg", force: :cascade do |t|
24
- t.integer "user_id"
25
- t.string "name"
26
- t.datetime "created_at", precision: 6, null: false
27
- t.datetime "updated_at", precision: 6, null: false
28
- end
29
-
30
- create_table "ghis", force: :cascade do |t|
31
- t.integer "dfg_id"
32
- t.datetime "created_at", precision: 6, null: false
33
- t.datetime "updated_at", precision: 6, null: false
34
- end
35
-
36
- create_table "jkls", force: :cascade do |t|
37
- t.integer "hgi_id"
38
- t.datetime "created_at", precision: 6, null: false
39
- t.datetime "updated_at", precision: 6, null: false
40
- end
41
-
42
- create_table "users", force: :cascade do |t|
43
- t.string "email", default: "", null: false
44
- t.string "encrypted_password", default: "", null: false
45
- t.string "reset_password_token"
46
- t.datetime "reset_password_sent_at"
47
- t.datetime "remember_created_at"
48
- t.datetime "created_at", precision: 6, null: false
49
- t.datetime "updated_at", precision: 6, null: false
50
- t.index ["email"], name: "index_users_on_email", unique: true
51
- t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
52
- end
53
-
54
- create_table "xyzs", force: :cascade do |t|
55
- t.integer "nothing_id"
56
- t.datetime "created_at", precision: 6, null: false
57
- t.datetime "updated_at", precision: 6, null: false
58
- end
59
-
60
- end