hot-glue 0.5.3 → 0.5.5

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/.github/workflows/test.yml +0 -1
  3. data/.gitignore +12 -5
  4. data/README.md +162 -42
  5. data/lib/generators/hot_glue/install_generator.rb +13 -13
  6. data/lib/generators/hot_glue/layout/builder.rb +11 -8
  7. data/lib/generators/hot_glue/layout_strategy/base.rb +31 -0
  8. data/lib/generators/hot_glue/layout_strategy/bootstrap.rb +41 -0
  9. data/lib/generators/hot_glue/layout_strategy/hot_glue.rb +82 -0
  10. data/lib/generators/hot_glue/layout_strategy/tailwind.rb +28 -0
  11. data/lib/generators/hot_glue/markup_templates/base.rb +3 -3
  12. data/lib/generators/hot_glue/markup_templates/erb.rb +90 -80
  13. data/lib/generators/hot_glue/scaffold_generator.rb +103 -110
  14. data/lib/generators/hot_glue/templates/controller.rb.erb +14 -40
  15. data/lib/generators/hot_glue/templates/erb/_form.erb +1 -1
  16. data/lib/generators/hot_glue/templates/erb/_line.erb +3 -3
  17. data/lib/generators/hot_glue/templates/erb/_list.erb +6 -11
  18. data/lib/generators/hot_glue/templates/erb/_new_button.erb +1 -1
  19. data/lib/generators/hot_glue/templates/erb/_new_form.erb +1 -1
  20. data/lib/generators/hot_glue/templates/erb/_show.erb +3 -3
  21. data/lib/generators/hot_glue/templates/erb/create.turbo_stream.erb +2 -2
  22. data/lib/generators/hot_glue/templates/erb/destroy.turbo_stream.erb +2 -2
  23. data/lib/generators/hot_glue/templates/erb/edit.erb +1 -1
  24. data/lib/generators/hot_glue/templates/erb/edit.turbo_stream.erb +1 -1
  25. data/lib/generators/hot_glue/templates/erb/index.erb +3 -6
  26. data/lib/generators/hot_glue/templates/erb/update.turbo_stream.erb +1 -1
  27. data/lib/generators/hot_glue/templates/system_spec.rb.erb +3 -1
  28. data/lib/hot-glue.rb +0 -4
  29. data/lib/hotglue/engine.rb +1 -1
  30. data/lib/hotglue/version.rb +1 -1
  31. metadata +6 -3
  32. data/lib/generators/hot_glue/helpers.rb +0 -13
@@ -1,14 +1,11 @@
1
1
  <% if @menu_file_exists %><\%= render partial: "<%= namespace_with_trailing_dash %>menu", locals: {active: '<%= plural %>'} %><% end %>
2
2
 
3
3
  <div class="<%= @container_name %>">
4
- <% if @layout == "bootstrap" %><div class="row"> <div class="col-md-12">
5
- <% else %>
6
- <div class=' scaffold-index-<%= plural %>'>
7
- <% end %>
4
+ <%= @layout_strategy.page_begin %>
5
+ <% if include_nav_template %><\%= render partial: "<%= nav_template %>", locals: {nav: "<%= @plural %>"} %><% end %>
8
6
 
9
- <div class="clearfix"></div>
10
7
  <\%= render partial: '<%= list_path_partial %>',
11
8
  locals: {<%= plural %>: @<%= plural %>}<%= @nested_set.collect{|arg| ".merge(@" + arg[:singular] + " ? {nested_for: \"" + arg[:singular] + "-\#{@" + arg[:singular] + ".id}\"" + ", " + arg[:singular] + ": @" + arg[:singular] + "} : {})"}.join() %> \%>
12
9
 
13
- <% if @layout == "bootstrap" %></div></div><% else %></div><% end %>
10
+ <%= @layout_strategy.page_end %>
14
11
  </div>
@@ -1,4 +1,4 @@
1
- <% if !@display_list_after_update %><\%= turbo_stream.replace "<%= singular%>__#{@<%= singular %>.id}" do %>
1
+ <% if !@display_list_after_update %><\%= turbo_stream.replace "<%= namespace %>__#{dom_id(@<%= singular %>)}" do %>
2
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
4
  <\%= render partial: '<%= list_path_partial %>', locals: {<%= plural %>: @<%= plural %>}<%= @nested_set.collect{|arg| ".merge(@#{arg[:singular]} ? {#{arg[:singular]}: @#{arg[:singular]}} : {})" }.join %> \%>
@@ -2,6 +2,8 @@ require 'rails_helper'
2
2
 
3
3
  describe "interaction for <%= controller_class_name %>", type: :feature do
4
4
  include HotGlue::ControllerHelper
5
+ include ActionView::RecordIdentifier
6
+
5
7
  <%= @existing_content %>
6
8
  <% unless @god %>let(:<%= @auth %>) {create(:<%= @auth.gsub('current_', '') %>)}<%end%>
7
9
  <%= (@columns - @show_only).map { |col|
@@ -118,7 +120,7 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
118
120
  expect(page).to have_content("Editing #{<%= singular %>1.<%= @display_class %>.squish || "(no name)"}")
119
121
  <%= test_capybara_block %>
120
122
  click_button "Save"
121
- within("turbo-frame#<%= singular %>__#{<%= singular %>1.id} ") do
123
+ within("turbo-frame#<%= @namespace %>__#{dom_id(<%= singular %>1)} ") do
122
124
  <%=
123
125
  (@columns - @show_only).map { |col|
124
126
  type = eval("#{singular_class}.columns_hash['#{col}']").type
data/lib/hot-glue.rb CHANGED
@@ -1,11 +1,7 @@
1
1
  require "hotglue/engine"
2
2
  require 'kaminari'
3
3
 
4
-
5
4
  module HotGlue
6
-
7
-
8
-
9
5
  module TemplateBuilders
10
6
 
11
7
  end
@@ -1,6 +1,6 @@
1
1
  module HotGlue
2
2
  class Engine < ::Rails::Engine
3
3
 
4
- config.autoload_paths << File.expand_path("lib/helpers/hot_glue_helper.rb", __dir__)
4
+
5
5
  end
6
6
  end
@@ -1,5 +1,5 @@
1
1
  module HotGlue
2
2
  class Version
3
- CURRENT = '0.5.3'
3
+ CURRENT = '0.5.5'
4
4
  end
5
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.5.3
4
+ version: 0.5.5
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-24 00:00:00.000000000 Z
11
+ date: 2022-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -75,9 +75,12 @@ files:
75
75
  - config/database.yml
76
76
  - config/hot_glue.yml
77
77
  - db/schema.rb
78
- - lib/generators/hot_glue/helpers.rb
79
78
  - lib/generators/hot_glue/install_generator.rb
80
79
  - lib/generators/hot_glue/layout/builder.rb
80
+ - lib/generators/hot_glue/layout_strategy/base.rb
81
+ - lib/generators/hot_glue/layout_strategy/bootstrap.rb
82
+ - lib/generators/hot_glue/layout_strategy/hot_glue.rb
83
+ - lib/generators/hot_glue/layout_strategy/tailwind.rb
81
84
  - lib/generators/hot_glue/markup_templates/base.rb
82
85
  - lib/generators/hot_glue/markup_templates/erb.rb
83
86
  - lib/generators/hot_glue/scaffold_generator.rb
@@ -1,13 +0,0 @@
1
- class HotGlue::Helpers
2
-
3
-
4
- def self.open_page( link)
5
- if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
6
- system "start #{link}"
7
- elsif RbConfig::CONFIG['host_os'] =~ /darwin/
8
- system "open #{link}"
9
- elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
10
- system "xdg-open #{link}"
11
- end
12
- end
13
- end