hot-glue 0.5.20 → 0.5.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +16 -0
- data/lib/generators/hot_glue/fields/association_field.rb +1 -1
- data/lib/generators/hot_glue/scaffold_generator.rb +16 -2
- data/lib/generators/hot_glue/templates/controller.rb.erb +1 -1
- data/lib/generators/hot_glue/templates/erb/_edit.erb +6 -7
- data/lib/generators/hot_glue/templates/system_spec.rb.erb +1 -1
- data/lib/hotglue/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34d4899a5495270c4364848ad5e61527141d1f2b869e3e55c24efb6c63865ac9
|
4
|
+
data.tar.gz: 1a97496b55af910b3c14ead50c92205e0e8ed7c6d75330050041a8e9c6aa4df7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9aea82f09683d50f8e4175777fff16ef07da0682055cbe3ee29f3da3360a2b8763cfc079afe15c69f3e05f3b4dd33d063b63aa483c5e32ad60c2ac20da305f65
|
7
|
+
data.tar.gz: e3ec284bdb6d2d7d1030502fc45858c55afaf82e97fda92fd0bcb7359a7f54315a360aacd9bfd7e23da56dff08541ed0f120f2bc071faab950990688b40fb2ea
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -909,6 +909,14 @@ Omits new & create actions.
|
|
909
909
|
|
910
910
|
Omits delete button & destroy action.
|
911
911
|
|
912
|
+
### `--no-controller`
|
913
|
+
|
914
|
+
Omits controller.
|
915
|
+
|
916
|
+
### `--no-list`
|
917
|
+
|
918
|
+
Omits list views.
|
919
|
+
|
912
920
|
### `--big-edit`
|
913
921
|
|
914
922
|
If you do not want inline editing of your list items but instead want to fall back to full page style behavior for your edit views, use `--big-edit`. Turbo still handles the page interactions, but the user is taken to a full-screen edit page instead of an edit-in-place interaction.
|
@@ -1396,6 +1404,14 @@ end
|
|
1396
1404
|
|
1397
1405
|
# VERSION HISTORY
|
1398
1406
|
|
1407
|
+
|
1408
|
+
#### 2023-09-18 - v0.5.21
|
1409
|
+
- Removes `@` symbols using instance variables in `_edit` partials and in the enum syntax
|
1410
|
+
- fixes in system_spec.rb.erb
|
1411
|
+
- Adds flags --no-controller --no-list
|
1412
|
+
- adds regen code to a file in the views folder REGENERATE.md if you have set --no-controller
|
1413
|
+
|
1414
|
+
|
1399
1415
|
#### 2023-09-08 - v0.5.20
|
1400
1416
|
`--pundit` authorization
|
1401
1417
|
• Will look for a `XyzPolicy` class and method on your class named `*_able?` matching the fields on your object. See Pundit section for details.
|
@@ -104,7 +104,7 @@ class AssociationField < Field
|
|
104
104
|
end
|
105
105
|
|
106
106
|
(is_owner ? "<% unless @#{assoc_name} %>\n" : "") +
|
107
|
-
" <%= f.collection_select(:#{name}, #{hawked_association}, :id, :#{display_column}, {prompt: true, selected:
|
107
|
+
" <%= f.collection_select(:#{name}, #{hawked_association}, :id, :#{display_column}, {prompt: true, selected: #{singular}.#{name} }, class: 'form-control') %>\n" +
|
108
108
|
(is_owner ? "<% else %>\n <%= @#{assoc_name}.#{display_column} %>" : "") +
|
109
109
|
(is_owner ? "\n<% end %>" : "")
|
110
110
|
end
|
@@ -43,6 +43,8 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
43
43
|
class_option :no_create, type: :boolean, default: false
|
44
44
|
class_option :no_edit, type: :boolean, default: false
|
45
45
|
class_option :no_list, type: :boolean, default: false
|
46
|
+
class_option :no_controller, type: :boolean, default: false
|
47
|
+
class_option :no_list, type: :boolean, default: false
|
46
48
|
class_option :no_paginate, type: :boolean, default: false
|
47
49
|
class_option :big_edit, type: :boolean, default: false
|
48
50
|
class_option :show_only, type: :string, default: ""
|
@@ -289,6 +291,8 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
289
291
|
|
290
292
|
@no_edit = options['no_edit'] || false
|
291
293
|
@no_list = options['no_list'] || false
|
294
|
+
@no_controller = options['no_controller'] || false
|
295
|
+
@no_list = options['no_list'] || false
|
292
296
|
@no_list_label = options['no_list_label'] || false
|
293
297
|
@no_list_heading = options['no_list_heading'] || false
|
294
298
|
@stacked_downnesting = options['stacked_downnesting']
|
@@ -688,7 +692,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
688
692
|
|
689
693
|
def copy_controller_and_spec_files
|
690
694
|
@default_colspan = @columns.size
|
691
|
-
unless @specs_only
|
695
|
+
unless @specs_only || @no_controller
|
692
696
|
template "controller.rb.erb", File.join("#{filepath_prefix}app/controllers#{namespace_with_dash}", "#{@controller_build_folder}_controller.rb")
|
693
697
|
if @namespace
|
694
698
|
begin
|
@@ -866,7 +870,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
866
870
|
nested_set: @nested_set,
|
867
871
|
with_params: true,
|
868
872
|
put_form: true,
|
869
|
-
top_level:
|
873
|
+
top_level: false)
|
870
874
|
end
|
871
875
|
|
872
876
|
def delete_path_helper
|
@@ -1021,6 +1025,11 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
1021
1025
|
|
1022
1026
|
def copy_view_files
|
1023
1027
|
return if @specs_only
|
1028
|
+
|
1029
|
+
if @no_controller
|
1030
|
+
File.write("#{Rails.root}/app/views/#{namespace_with_trailing_dash}/#{plural}/REGENERATE.md", regenerate_me_code)
|
1031
|
+
end
|
1032
|
+
|
1024
1033
|
all_views.each do |view|
|
1025
1034
|
formats.each do |format|
|
1026
1035
|
source_filename = cc_filename_with_extensions("#{@markup}/#{view}", "#{@markup}")
|
@@ -1120,6 +1129,11 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
1120
1129
|
if !(@no_edit && @no_create)
|
1121
1130
|
res << '_form'
|
1122
1131
|
end
|
1132
|
+
|
1133
|
+
if @no_list
|
1134
|
+
res -= %w{_list _line index}
|
1135
|
+
end
|
1136
|
+
|
1123
1137
|
res
|
1124
1138
|
end
|
1125
1139
|
|
@@ -70,7 +70,7 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
|
|
70
70
|
authorize @<%= plural_name %>.all<% else %> <% if !@self_auth %>
|
71
71
|
@<%= 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] %>
|
72
72
|
@<%= plural_name %> = <%= class_name %>.all<% end %><% else %>
|
73
|
-
@<%= plural_name %> = <%= class_name %>.where(id: <%= auth_object.gsub("@",'') %>.id)<%= n_plus_one_includes
|
73
|
+
@<%= plural_name %> = <%= class_name %>.where(id: <%= auth_object.gsub("@",'') %>.id)<%= n_plus_one_includes %><% end %>
|
74
74
|
<% end %>
|
75
75
|
end
|
76
76
|
|
@@ -1,12 +1,11 @@
|
|
1
|
-
<\%= turbo_frame_tag "<%= @namespace %>__#{dom_id(
|
1
|
+
<\%= turbo_frame_tag "<%= @namespace %>__#{dom_id(<%= singular %>)}" do %>
|
2
2
|
<div class="cell editable" style="position: relative;">
|
3
|
-
<\% if
|
4
|
-
<\%= render(partial: "<%= namespace_with_trailing_dash %>errors", locals: {resource:
|
3
|
+
<\% if <%= singular %>.errors.any? %>
|
4
|
+
<\%= render(partial: "<%= namespace_with_trailing_dash %>errors", locals: {resource: <%= singular %> }) %>
|
5
5
|
<\% end %>
|
6
|
-
|
7
|
-
|
8
|
-
<\%=
|
9
|
-
<\%= render partial: "<%= namespace_with_trailing_dash + @controller_build_folder + "/" %>form", locals: {:<%= singular %> => <%= "@" + singular%>, f: f}<%= @nested_set.collect{|arg| ".merge(@#{arg[:singular]} ? {#{arg[:singular]}: @#{arg[:singular]}} : {})" }.join %> \%>
|
6
|
+
<h2>Editing <\%= <%= singular %>.<%= display_class %> %></h2>
|
7
|
+
<\%= form_with model: <%= singular %>, url: <%= form_path_edit_helper %> do |f| %>
|
8
|
+
<\%= render partial: "<%= namespace_with_trailing_dash + @controller_build_folder + "/" %>form", locals: {:<%= singular %> => <%= singular %>, f: f}<%= @nested_set.collect{|arg| ".merge(#{arg[:singular]} ? {#{arg[:singular]}: #{arg[:singular]}} : {})" }.join %> \%>
|
10
9
|
<\% end %>
|
11
10
|
</div>
|
12
11
|
<\% end %>
|
@@ -15,7 +15,7 @@ describe 'interaction for <%= controller_class_name %>' do
|
|
15
15
|
<% unless @god %>let(:<%= @auth %>) {create(:<%= @auth.gsub('current_', '') %>)}<% end %>
|
16
16
|
<%= spec_related_column_lets %>
|
17
17
|
let!(:<%= singular %>1) {create(:<%= singular %><%= object_parent_mapping_as_argument_for_specs %> <%= item1_addOns %> )}
|
18
|
-
<%= objest_nest_factory_setup %> <% unless @god || @existing_content.include?("login_as")%>
|
18
|
+
<%= objest_nest_factory_setup %> <% unless @god || (@existing_content && @existing_content.include?("login_as")) %>
|
19
19
|
before do
|
20
20
|
login_as(<%= @auth %>)
|
21
21
|
end <% end %> <% if any_datetime_fields? %>
|
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.5.
|
4
|
+
version: 0.5.21
|
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: 2023-09-
|
11
|
+
date: 2023-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|