hot-glue 0.0.9 → 0.2.1

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +21 -18
  3. data/README.md +83 -50
  4. data/app/helpers/hot_glue/controller_helper.rb +1 -1
  5. data/db/migrate/20210306223305_create_ghis.rb +9 -0
  6. data/db/schema.rb +1 -1
  7. data/lib/generators/hot_glue/install_generator.rb +0 -2
  8. data/lib/generators/hot_glue/markup_templates/base.rb +7 -0
  9. data/lib/generators/hot_glue/markup_templates/erb.rb +228 -0
  10. data/lib/generators/hot_glue/markup_templates/haml.rb +223 -0
  11. data/lib/generators/hot_glue/markup_templates/slim.rb +9 -0
  12. data/lib/generators/hot_glue/scaffold_generator.rb +162 -265
  13. data/lib/generators/hot_glue/templates/controller.rb.erb +24 -10
  14. data/lib/generators/hot_glue/templates/erb/_errors.erb +11 -0
  15. data/lib/generators/hot_glue/templates/erb/_flash_notices.erb +12 -0
  16. data/lib/generators/hot_glue/templates/erb/_form.erb +8 -0
  17. data/lib/generators/hot_glue/templates/erb/_line.erb +10 -0
  18. data/lib/generators/hot_glue/templates/erb/_list.erb +19 -0
  19. data/lib/generators/hot_glue/templates/erb/_new_button.erb +3 -0
  20. data/lib/generators/hot_glue/templates/erb/_new_form.erb +8 -0
  21. data/lib/generators/hot_glue/templates/erb/_show.erb +8 -0
  22. data/lib/generators/hot_glue/templates/erb/create.turbo_stream.erb +18 -0
  23. data/lib/generators/hot_glue/templates/erb/destroy.turbo_stream.erb +3 -0
  24. data/lib/generators/hot_glue/templates/erb/edit.erb +30 -0
  25. data/lib/generators/hot_glue/templates/erb/edit.turbo_stream.erb +3 -0
  26. data/lib/generators/hot_glue/templates/erb/index.erb +10 -0
  27. data/lib/generators/hot_glue/templates/erb/new.erb +1 -0
  28. data/lib/generators/hot_glue/templates/erb/update.turbo_stream.erb +10 -0
  29. data/lib/generators/hot_glue/templates/{_errors.haml → haml/_errors.haml} +0 -0
  30. data/lib/generators/hot_glue/templates/{_flash_notices.haml → haml/_flash_notices.haml} +0 -0
  31. data/lib/generators/hot_glue/templates/{_form.haml → haml/_form.haml} +1 -0
  32. data/lib/generators/hot_glue/templates/{_line.haml → haml/_line.haml} +0 -0
  33. data/lib/generators/hot_glue/templates/{_list.haml → haml/_list.haml} +0 -0
  34. data/lib/generators/hot_glue/templates/{_new_button.haml → haml/_new_button.haml} +0 -0
  35. data/lib/generators/hot_glue/templates/{_new_form.haml → haml/_new_form.haml} +0 -3
  36. data/lib/generators/hot_glue/templates/haml/_show.haml +7 -0
  37. data/lib/generators/hot_glue/templates/{create.turbo_stream.haml → haml/create.turbo_stream.haml} +0 -0
  38. data/lib/generators/hot_glue/templates/{destroy.turbo_stream.haml → haml/destroy.turbo_stream.haml} +0 -0
  39. data/lib/generators/hot_glue/templates/{edit.haml → haml/edit.haml} +0 -0
  40. data/lib/generators/hot_glue/templates/{edit.turbo_stream.haml → haml/edit.turbo_stream.haml} +0 -0
  41. data/lib/generators/hot_glue/templates/{index.haml → haml/index.haml} +0 -0
  42. data/lib/generators/hot_glue/templates/{new.haml → haml/new.haml} +0 -0
  43. data/lib/generators/hot_glue/templates/haml/update.turbo_stream.haml +9 -0
  44. data/lib/generators/hot_glue/templates/system_spec.rb.erb +109 -14
  45. data/lib/hot-glue.rb +6 -20
  46. data/lib/hotglue/version.rb +1 -1
  47. metadata +38 -20
  48. data/db/migrate/20210306223305_create_hgis.rb +0 -9
  49. data/lib/generators/hot_glue/templates/_show.haml +0 -7
  50. data/lib/generators/hot_glue/templates/request_spec.rb.erb +0 -110
  51. data/lib/generators/hot_glue/templates/update.turbo_stream.haml +0 -5
@@ -1,7 +1,11 @@
1
1
  class <%= controller_class_name %> < <%= controller_descends_from %>
2
2
  <% unless @auth_identifier == '' || @auth.nil? %>before_action :authenticate_<%= @auth_identifier %>!<% end %>
3
- <% if any_nested? %> <% @nested_args.each do |arg| %>
4
- before_action :load_<%= arg %><% end %> <% end %>
3
+
4
+ <% if any_nested? %><% nest_chain = [] %> <% @nested_args.each { |arg|
5
+ this_scope = nest_chain.empty? ? "#{@auth ? auth_object : class_name}.#{arg}s" : "#{nest_chain.last}.#{arg}s"
6
+ nest_chain << arg %>
7
+ before_action :<%= arg %>
8
+ <% } %><% end %>
5
9
  before_action :load_<%= singular_name %>, only: [:show, :edit, :update, :destroy]
6
10
  helper :hot_glue
7
11
  include HotGlue::ControllerHelper
@@ -10,23 +14,31 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
10
14
  # TODO: implement current_user or use Devise
11
15
  <% end %>
12
16
 
17
+
18
+
13
19
  <% if any_nested? %><% nest_chain = [] %> <% @nested_args.each { |arg|
14
- this_scope = nest_chain.empty? ? "#{@auth ? auth_object : class_name}.#{arg}s" : "@#{nest_chain.last}.#{arg}s"
15
- nest_chain << arg %>def load_<%= arg %>
16
- @<%= arg %> = <%= this_scope %>.find(params[:<%= arg %>_id])
20
+ if !@god
21
+ this_scope = nest_chain.empty? ? "#{@auth ? auth_object : class_name}.#{arg}s" : "#{nest_chain.last}.#{arg}s"
22
+ else
23
+ this_scope = eval(class_name + ".reflect_on_association(:#{arg})").class_name
24
+ end
25
+ nest_chain << arg
26
+ %>
27
+ def <%= arg %>
28
+ @<%= arg %> ||= <%= this_scope %>.find(params[:<%= arg %>_id])
17
29
  end<% } %><% end %>
18
30
 
19
31
  <% if !@self_auth %>
20
32
  def load_<%= singular_name %>
21
- @<%= singular_name %> = <%= object_scope %>.find(params[:id])
33
+ @<%= singular_name %> = <%= object_scope.gsub("@",'') %>.find(params[:id])
22
34
  end
23
35
  <% else %>
24
36
  def load_<%= singular_name %>
25
- @<%= singular_name %> = <%= auth_object %>
37
+ @<%= singular_name %> = <%= auth_object.gsub("@",'') %>
26
38
  end<% end %>
27
39
 
28
40
  def load_all_<%= plural %>
29
- <% if !@self_auth %>@<%= plural_name %> = <%= object_scope %><% if model_has_strings? %>.where(<%=class_name %>.arel_table[:email].matches("%#{@__general_string}%"))<% end %>.page(params[:page])
41
+ <% if !@self_auth %>@<%= plural_name %> = <%= object_scope.gsub("@",'') %><% if model_has_strings? %>.where(<%=class_name %>.arel_table[:email].matches("%#{@__general_string}%"))<% end %>.page(params[:page])
30
42
  <% else %>@<%= plural_name %> = [<%= auth_object %>]<% end %>
31
43
  end
32
44
 
@@ -81,8 +93,10 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
81
93
  end
82
94
 
83
95
  def update
84
- if !@<%= singular_name %>.update(modify_date_inputs_on_params(<%= singular %>_params<%= @auth ? ', ' + @auth : '' %>))
85
- flash[:alert] = "<%= singular_name.titlecase %> could not be saved"
96
+ if @<%= singular_name %>.update(modify_date_inputs_on_params(<%= singular %>_params<%= @auth ? ', ' + @auth : '' %>))
97
+ flash[:notice] = "Saved #{@<%= singular %>.<%= display_class %>}"
98
+ else
99
+ flash[:alert] = "<%= singular_name.titlecase %> could not be saved."
86
100
  end
87
101
  respond_to do |format|
88
102
  format.turbo_stream
@@ -0,0 +1,11 @@
1
+ <\%= turbo_frame_tag "errors" do %>
2
+ <\% if resource.errors.any? %>
3
+ <div id="error_explanation">
4
+ <\% resource.errors.full_messages.each do |message| %>
5
+ <div class="alert alert-danger">
6
+ <\%= message %>
7
+ </div>
8
+ <\% end %>
9
+ </div>
10
+ <\% end %>
11
+ <\% end %>
@@ -0,0 +1,12 @@
1
+ <%= turbo_frame_tag "flash_notices" do %>
2
+ <% unless notice.nil? %>
3
+ <div class="alert alert-notice alert-dismissible">
4
+ <%= notice %>
5
+ </div>
6
+ <% end %>
7
+ <% unless alert.nil? %>
8
+ <div class="alert alert-danger alert-dismissible">
9
+ <%= alert %>
10
+ </div>
11
+ <% end %>
12
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <div class="row">
2
+ <%= all_form_fields %>
3
+
4
+ <div class="col">
5
+ <\%= link_to "Cancel", <%= path_helper_plural %>, {class: "btn btn-secondary"} %>
6
+ <\%= f.submit "Save", class: "btn btn-primary pull-right" %>
7
+ </div>
8
+ </div>
@@ -0,0 +1,10 @@
1
+
2
+ <\%= turbo_frame_tag "<%= singular %>__#{ <%= singular %>.id }" do %>
3
+ <div class='row' data-id='<\%= <%= singular %>.id %>' data-edit='false'>
4
+ <\%= render partial: '<%= show_path_partial %>', locals: { <%= singular %>: <%= singular %>} %>
5
+ </div>
6
+ <\% end %>
7
+
8
+
9
+
10
+
@@ -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
+ <\%= link_to "Delete <i class='fa fa-1x fa-remove'></i>".html_safe, <%= path_helper_singular %>(<%= path_helper_args %>), method: :delete, data: {confirm: 'Are you sure?'}, 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 %>
@@ -1,4 +1,5 @@
1
1
  .row
2
2
  <%= all_form_fields %>
3
3
  .col
4
+ = link_to "Cancel", <%= path_helper_plural %>, {class: "btn btn-secondary"}
4
5
  = f.submit "Save", class: "btn btn-primary pull-right"
@@ -5,6 +5,3 @@
5
5
  = form_with model: <%= singular %>, url: <%= path_helper_plural %>(<%= nested_objects_arity %>), method: "post" do |f|
6
6
  = render partial: "<%=namespace_with_slash%><%= @plural %>/form", locals: {<%= singular %>: <%= singular %>, f: f}
7
7
 
8
- .row
9
- .col-md-12
10
- = f.submit "Save", class: "btn btn-primary pull-right"
@@ -0,0 +1,7 @@
1
+ <%= all_line_fields %>
2
+ .col
3
+ <% if destroy_action %>
4
+ = link_to "Delete <i class='fa fa-1x fa-remove'></i>".html_safe, <%= path_helper_singular %>(<%= path_helper_args %>), method: :delete, data: {confirm: 'Are you sure?'}, 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 "
@@ -0,0 +1,9 @@
1
+
2
+ = turbo_stream.replace "<%= singular%>__#{@<%= singular %>.id}" do
3
+ = render partial: 'line', locals: {<%= singular %>: @<%= singular %> <%= nested_assignments_with_leading_comma %> }
4
+
5
+
6
+ = turbo_stream.replace "flash_notices" do
7
+ = render partial: "layouts/flash_notices"
8
+ - if @<%= singular %>.errors.any?
9
+ = render partial: "errors", locals: {resource: @<%= singular %>}
@@ -1,52 +1,147 @@
1
1
  require 'rails_helper'
2
2
 
3
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 %> )}
4
+ include HotGlue::ControllerHelper
5
+ <% unless @auth.nil? %>let(:<%= @auth %>) {create(:<%= @auth.gsub('current_', '') %>)}<%end%>
6
6
 
7
- <%= objest_nest_factory_setup %>
7
+ let!(:<%= singular %>1) {create(:<%= singular %><%= object_parent_mapping_as_argument_for_specs %> )}
8
+ let!(:<%= singular %>2) {create(:<%= singular %><%= object_parent_mapping_as_argument_for_specs %> )}
9
+ let!(:<%= singular %>3) {create(:<%= singular %><%= object_parent_mapping_as_argument_for_specs %> )}
8
10
 
9
- before(:each) do
11
+ <%= objest_nest_factory_setup %>
10
12
 
13
+ before(:each) do
14
+ login_as(<%= @auth %>)
11
15
  end
12
16
 
13
17
  describe "index" do
14
18
  it "should show me the list" do
19
+ visit <%= path_helper_plural %>
20
+
21
+ <%=
22
+ @columns.map { |col|
23
+ type = eval("#{singular_class}.columns_hash['#{col}']").type
24
+ # limit = eval("#{singular_class}.columns_hash['#{col}']").limit
25
+ # sql_type = eval("#{singular_class}.columns_hash['#{col}']").sql_type
26
+ #
27
+
28
+ case type
29
+ when :datetime
30
+ " " + ["expect(page).to have_content(#{singular}#{rand(3)+1}.#{col}.in_time_zone(#{ @auth }.timezone).strftime('%m/%d/%Y @ %l:%M %p ').gsub(' ', ' ') + timezonize(#{ @auth }.timezone) )"].join("\n ")
31
+
32
+ else
33
+ " " + ["expect(page).to have_content(#{singular}#{rand(3)+1}.#{col})"].join("\n ")
15
34
 
16
- end
17
35
  end
18
36
 
19
- describe "new" do
20
- it "should show form" do
37
+ }.join("\n")
38
+
39
+ %>
21
40
 
22
41
  end
23
42
  end
24
43
 
25
- describe "create" do
26
- it "should create a new <%= singular %>" do
44
+ describe "new & create" do
45
+ it "should create a new <%= singular.titlecase %>" do
46
+ visit <%= path_helper_plural %>
47
+ click_link "New <%= singular.titlecase %>"
48
+ expect(page).to have_selector(:xpath, './/h3[contains(., "New <%= singular.titlecase %>")]')
49
+
50
+ <%=
51
+ @columns.map { |col|
52
+ type = eval("#{singular_class}.columns_hash['#{col}']").type
53
+ # limit = eval("#{singular_class}.columns_hash['#{col}']").limit
54
+ # sql_type = eval("#{singular_class}.columns_hash['#{col}']").sql_type
55
+ #
56
+
57
+ case type
58
+ when :datetime
59
+ when :integer
60
+ " " + 'find("input#' + singular + '_' + col.to_s + '").fill_in(with: rand(10))'
61
+ else
62
+ " " + "new_#{col} = 'new_test-email@nowhere.com' \n" +
63
+ ' ' + 'find("input#' + singular + '_' + col.to_s + '").fill_in(with: new_' + col.to_s + ')'
64
+ end
27
65
 
66
+ }.join("\n")
67
+
68
+ %>
69
+ click_button "Save"
70
+ expect(page).to have_content("Successfully created")
71
+
72
+ <%=
73
+ @columns.map { |col|
74
+ type = eval("#{singular_class}.columns_hash['#{col}']").type
75
+
76
+ case type
77
+ when :datetime
78
+ when :integer
79
+ else
80
+ "expect(page).to have_content(new_#{col})"
28
81
  end
29
- end
30
82
 
31
- describe "edit" do
32
- it "should return an editable form" do
83
+ }.join("\n")
84
+ %>
33
85
 
34
86
  end
35
87
  end
36
88
 
37
89
  describe "show" do
38
90
  it "should return a view form" do
91
+ visit <%= path_helper_plural %>
39
92
 
40
93
  end
41
94
  end
42
95
 
43
- describe "update" do
44
- it "should update" do
96
+ describe "edit & update" do
97
+ it "should return an editable form" do
98
+ visit <%= path_helper_plural %>
99
+ find("a.edit-<%= singular %>-button[href='/<%= namespace_with_slash %><%= plural %>/#{<%= singular %>1.id}/edit']").click
100
+
101
+ expect(page).to have_content("Editing #{<%= singular %>1.<%= derrive_reference_name(singular_class) %>}")
102
+ <%=
103
+ @columns.map { |col|
104
+ type = eval("#{singular_class}.columns_hash['#{col}']").type
105
+
106
+ case type
107
+ when :datetime
108
+ when :integer
109
+ else
110
+ " " + "new_#{col.to_s} = Faker::Name.new \n" +
111
+
112
+ ' find("input[name=\'' + singular + '[' + col.to_s + ']\'").fill_in(with: new_' + col.to_s + ')'
113
+
114
+ end
115
+ }.join("\n")
116
+ %>
117
+ click_button "Save"
118
+ within("turbo-frame#<%= singular %>__#{<%= singular %>1.id} ") do
119
+
120
+
121
+ <%=
122
+ @columns.map { |col|
123
+ type = eval("#{singular_class}.columns_hash['#{col}']").type
124
+ case type
125
+ when :datetime
126
+ when :integer
127
+ else
128
+ ' expect(page).to have_content(new_' + col.to_s + ')'
129
+ end
130
+ }.join("\n")
131
+ %>
132
+
133
+ end
45
134
  end
46
135
  end
47
136
 
48
137
  describe "destroy" do
49
138
  it "should destroy" do
139
+ visit <%= path_helper_plural %>
140
+ accept_alert do
141
+ find("a.delete-<%= singular %>-button[href='<%= namespace_with_dash %>/<%= plural %>/#{<%= singular %>1.id}']").click
142
+ end
143
+ expect(page).to_not have_content(<%= singular %>1.email)
144
+ expect(<%= singular_class %>.where(id: <%= singular %>1.id).count).to eq(0)
50
145
  end
51
146
  end
52
147
  end
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.0.9'
2
+ VERSION = '0.2.1'
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.9
4
+ version: 0.2.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: 2021-03-24 00:00:00.000000000 Z
11
+ date: 2021-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -115,32 +115,50 @@ files:
115
115
  - config/database.yml
116
116
  - db/migrate/20210306212711_create_abcs.rb
117
117
  - db/migrate/20210306223300_create_defs.rb
118
- - db/migrate/20210306223305_create_hgis.rb
118
+ - db/migrate/20210306223305_create_ghis.rb
119
119
  - db/migrate/20210306223309_create_jkls.rb
120
120
  - db/migrate/20210306223701_devise_create_users.rb
121
121
  - db/migrate/20210306225506_create_xyzs.rb
122
122
  - db/schema.rb
123
123
  - lib/generators/hot_glue/install_generator.rb
124
+ - lib/generators/hot_glue/markup_templates/base.rb
125
+ - lib/generators/hot_glue/markup_templates/erb.rb
126
+ - lib/generators/hot_glue/markup_templates/haml.rb
127
+ - lib/generators/hot_glue/markup_templates/slim.rb
124
128
  - 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
129
  - lib/generators/hot_glue/templates/base_controller.rb.erb
134
130
  - 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
141
- - lib/generators/hot_glue/templates/request_spec.rb.erb
131
+ - lib/generators/hot_glue/templates/erb/_errors.erb
132
+ - lib/generators/hot_glue/templates/erb/_flash_notices.erb
133
+ - lib/generators/hot_glue/templates/erb/_form.erb
134
+ - lib/generators/hot_glue/templates/erb/_line.erb
135
+ - lib/generators/hot_glue/templates/erb/_list.erb
136
+ - lib/generators/hot_glue/templates/erb/_new_button.erb
137
+ - lib/generators/hot_glue/templates/erb/_new_form.erb
138
+ - lib/generators/hot_glue/templates/erb/_show.erb
139
+ - lib/generators/hot_glue/templates/erb/create.turbo_stream.erb
140
+ - lib/generators/hot_glue/templates/erb/destroy.turbo_stream.erb
141
+ - lib/generators/hot_glue/templates/erb/edit.erb
142
+ - lib/generators/hot_glue/templates/erb/edit.turbo_stream.erb
143
+ - lib/generators/hot_glue/templates/erb/index.erb
144
+ - lib/generators/hot_glue/templates/erb/new.erb
145
+ - lib/generators/hot_glue/templates/erb/update.turbo_stream.erb
146
+ - lib/generators/hot_glue/templates/haml/_errors.haml
147
+ - lib/generators/hot_glue/templates/haml/_flash_notices.haml
148
+ - lib/generators/hot_glue/templates/haml/_form.haml
149
+ - lib/generators/hot_glue/templates/haml/_line.haml
150
+ - lib/generators/hot_glue/templates/haml/_list.haml
151
+ - lib/generators/hot_glue/templates/haml/_new_button.haml
152
+ - lib/generators/hot_glue/templates/haml/_new_form.haml
153
+ - lib/generators/hot_glue/templates/haml/_show.haml
154
+ - lib/generators/hot_glue/templates/haml/create.turbo_stream.haml
155
+ - lib/generators/hot_glue/templates/haml/destroy.turbo_stream.haml
156
+ - lib/generators/hot_glue/templates/haml/edit.haml
157
+ - lib/generators/hot_glue/templates/haml/edit.turbo_stream.haml
158
+ - lib/generators/hot_glue/templates/haml/index.haml
159
+ - lib/generators/hot_glue/templates/haml/new.haml
160
+ - lib/generators/hot_glue/templates/haml/update.turbo_stream.haml
142
161
  - lib/generators/hot_glue/templates/system_spec.rb.erb
143
- - lib/generators/hot_glue/templates/update.turbo_stream.haml
144
162
  - lib/hot-glue.rb
145
163
  - lib/hotglue/engine.rb
146
164
  - lib/hotglue/version.rb
@@ -182,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
200
  - !ruby/object:Gem::Version
183
201
  version: '0'
184
202
  requirements: []
185
- rubygems_version: 3.2.11
203
+ rubygems_version: 3.1.4
186
204
  signing_key:
187
205
  specification_version: 4
188
206
  summary: A gem build scaffolding.
@@ -1,9 +0,0 @@
1
- class CreateHgis < ActiveRecord::Migration[6.1]
2
- def change
3
- create_table :hgis do |t|
4
- t.integer :def_id
5
-
6
- t.timestamps
7
- end
8
- end
9
- end
@@ -1,7 +0,0 @@
1
- <%= all_line_fields %>
2
- .col
3
- <% if destroy_action %>
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
- <% end %>
6
- &nbsp;
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 "