hot-glue 0.4.5 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +71 -0
- data/.github/FUNDING.yml +2 -2
- data/.gitignore +4 -1
- data/Gemfile +5 -1
- data/Gemfile.lock +16 -16
- data/README.md +340 -251
- data/README2.md +79 -0
- data/config/database.yml +8 -83
- data/db/schema.rb +1 -0
- data/lib/generators/hot_glue/install_generator.rb +0 -1
- data/lib/generators/hot_glue/layout/builder.rb +51 -33
- data/lib/generators/hot_glue/markup_templates/erb.rb +97 -88
- data/lib/generators/hot_glue/scaffold_generator.rb +292 -91
- data/lib/generators/hot_glue/templates/controller.rb.erb +51 -47
- data/lib/generators/hot_glue/templates/erb/_form.erb +3 -2
- data/lib/generators/hot_glue/templates/erb/_line.erb +1 -1
- data/lib/generators/hot_glue/templates/erb/_list.erb +31 -21
- data/lib/generators/hot_glue/templates/erb/_new_button.erb +1 -1
- data/lib/generators/hot_glue/templates/erb/_new_form.erb +4 -3
- data/lib/generators/hot_glue/templates/erb/_show.erb +10 -6
- data/lib/generators/hot_glue/templates/erb/create.turbo_stream.erb +4 -4
- data/lib/generators/hot_glue/templates/erb/destroy.turbo_stream.erb +2 -2
- data/lib/generators/hot_glue/templates/erb/edit.erb +2 -2
- data/lib/generators/hot_glue/templates/erb/index.erb +1 -1
- data/lib/generators/hot_glue/templates/erb/new.erb +1 -1
- data/lib/generators/hot_glue/templates/erb/update.turbo_stream.erb +2 -2
- data/lib/hotglue/version.rb +3 -1
- metadata +6 -20
- data/db/schema.rb +0 -60
- data/lib/generators/hot_glue/markup_templates/haml.rb +0 -243
- 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 = [] %> <% @
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
40
|
-
|
41
|
-
|
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[0][:optional] %>)<% if @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[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 anly 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
|
70
|
+
<% if create_action %> def new
|
71
|
+
<% if ! @god %>
|
71
72
|
@<%= singular_name %> = <%= class_name %>.new(<%= @object_owner_sym %>: <%= @object_owner_eval %>)
|
72
|
-
<%
|
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
|
82
|
-
|
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
|
-
|
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
|
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,38 +1,48 @@
|
|
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 || @
|
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) || "") +
|
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
|
-
<% unless @no_list
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
<% unless @no_list %>
|
12
|
+
<% unless @no_list_labels %>
|
13
|
+
<div class="row scaffold-heading-row">
|
14
|
+
<%= list_column_headings %>
|
15
|
+
<% if @downnest_object.any? %>
|
16
|
+
<%# each_downnest_width = @downnest_object.count == 1 ? 40 : (60/@downnest_object.count).floor %>
|
17
|
+
<% downnest_column_style = @layout == "hotglue" ? 'style="flex-basis: ' + each_downnest_width.to_s + '%;' : "" %>
|
13
18
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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 %>
|
26
|
+
<% end %>
|
22
27
|
|
23
|
-
|
28
|
+
<% button_column_style = @layout == "hotglue" ? 'style="flex-basis: 150px' : "" %>
|
24
29
|
|
25
|
-
|
30
|
+
<div class=' scaffold-col-heading scaffold-col-heading-buttons<%= " col-md-#{ @layout_object[:buttons][:size] }" if @layout=="bootstrap" %>' <%= button_column_style %>>
|
31
|
+
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
26
35
|
|
27
|
-
</div>
|
28
|
-
</div>
|
29
36
|
<\% if <%= plural %>.empty? %>
|
30
37
|
<div>
|
31
38
|
None
|
32
39
|
</div>
|
33
40
|
<\% end %>
|
34
41
|
<\% <%= plural %>.each do |<%= singular %>| %>
|
35
|
-
<\%= render partial: '<%= line_path_partial %>', locals: {<%= singular %>: <%= singular
|
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
|
+
%>
|
36
46
|
<\% end %>
|
37
47
|
<%= @no_paginate ? "" : paginate %>
|
38
48
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<\%= turbo_frame_tag "<%= singular %>-new" do %>
|
2
2
|
<div>
|
3
|
-
<\%= link_to "New <%=
|
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 <%=
|
3
|
+
New <%= thing_label %>
|
4
4
|
</h3>
|
5
|
-
<\%= form_with model: <%= singular %>, url: <%=
|
6
|
-
<\%= render partial: "<%= namespace_with_slash +
|
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
|
-
<% @
|
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
|
-
|
15
|
-
|
16
|
-
|
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: <%=
|
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,
|
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 %>
|
3
|
-
<\%= render partial: "list", locals: {<%= plural %>: @<%= plural
|
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: {<%=
|
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 %>
|
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 %>
|
2
|
-
<\%= render partial: "list", locals: {<%=plural%>: @<%=plural%> <%=
|
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: <%=
|
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
|
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 %> <%=
|
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
|
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
|
|
data/lib/hotglue/version.rb
CHANGED
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.
|
4
|
+
version: 0.4.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: 2022-
|
11
|
+
date: 2022-02-14 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://
|
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:
|
@@ -163,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
149
|
- !ruby/object:Gem::Version
|
164
150
|
version: '0'
|
165
151
|
requirements: []
|
166
|
-
rubygems_version: 3.1.
|
152
|
+
rubygems_version: 3.1.6
|
167
153
|
signing_key:
|
168
154
|
specification_version: 4
|
169
155
|
summary: A gem to build Tubro Rails scaffolding.
|
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
|