hot-glue 0.6.9.1 → 0.6.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b41e634d3ccf5dce8f7beee2e8f7d57288ca5d17a3278bef750925432e261019
4
- data.tar.gz: 1f4b522d1aae3f3fee2d1c0526b4823bf79279771ce4101aa021dc407e0e77a6
3
+ metadata.gz: e97635a9b4a9f05502eaec8834622f0eca2bcf6a984b32819aa92b1f94afebce
4
+ data.tar.gz: 05c5ca3e88a7d2fe2e0dce9f22824ae817a3d909f03f8c4a8053bd6d12b72632
5
5
  SHA512:
6
- metadata.gz: a09d7a3e3697167e1d995887cada41a1932ef9449d422418602ac0b35c9239d1dc52b6e98e3c73470a217e7c5053bf1de75634e5bf96df02d6b52afba1d6a289
7
- data.tar.gz: '092c78a65694a6f4266d07669274e4d6325fd0c18370251971d4fe0871249d03022cf85a24376850f190f0deb90c7eda073c9118ebe6c00d601d0b6f8bb6d4b3'
6
+ metadata.gz: 47afa457097e68f69f7aaa85d07f8ebe70d47f052875eb52863796122846e9b8993d13e678e8eb927ce44a0331b2a56972a189d8af0e1c4272bd2b2661837548
7
+ data.tar.gz: 525847e13f04fec313576a235d864fa2a59781d448bd4a94ed2425d0c2bbb508efd83f0b97d37a9f9f5ab5af7f49b5d9e6dc3797648e5ab39bf7b67823794ef8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hot-glue (0.6.9.1)
4
+ hot-glue (0.6.10)
5
5
  ffaker (~> 2.16)
6
6
  kaminari (~> 1.2)
7
7
  rails (> 5.1)
@@ -139,7 +139,7 @@ GEM
139
139
  mini_mime (1.1.2)
140
140
  mini_portile2 (2.8.4)
141
141
  minitest (5.16.3)
142
- net-imap (0.5.1)
142
+ net-imap (0.5.4)
143
143
  date
144
144
  net-protocol
145
145
  net-pop (0.1.2)
@@ -235,7 +235,7 @@ GEM
235
235
  stimulus-rails (1.1.1)
236
236
  railties (>= 6.0.0)
237
237
  thor (1.2.1)
238
- timeout (0.4.2)
238
+ timeout (0.4.3)
239
239
  turbo-rails (1.3.2)
240
240
  actionpack (>= 6.0.0)
241
241
  activejob (>= 6.0.0)
data/README.md CHANGED
@@ -413,34 +413,6 @@ Then, finally the @charge will be loaded
413
413
  This is "starfish access control" or "poor man's access control." It works when the current user has several things they can manage, and by extension can manage children of those things.
414
414
 
415
415
 
416
- #### Optionalized Nested Parents
417
-
418
- Add `~` in front of any nested parameter (any parent in the `--nested` list) you want to make optional. This creates a two-headed controller: It can operate with or without that optionalized parameter.
419
-
420
- This is an advanced feature. To use, **make duplicative routes to the same controller**. You can only use this feature with Gd controller.
421
-
422
- Specify your controller *twice* in your routes.rb. Then, in your `--nested` setting, add `~` to any nested parent you want to **make optional**. "Make optional" means the controller will behave as-if it exists in two places: once, at the normal nest level. Then the same controller will 'exist' again one-level up in your routes. **If the route has sub-routes, you'll need to re-specify the entire subtree also**.
423
- ```
424
- namespace :admin
425
- resources :users do
426
- resources :invoices
427
- end
428
- resources :invoices
429
- end
430
- ```
431
-
432
- Even though we have two routes pointed to **invoices**, both will go to the same controller (`app/controllers/admin/invoices_controller.rb`)
433
-
434
- ```
435
- ./bin/rails generate hot_glue:scaffold User --namespace=admin --gd
436
- ./bin/rails generate hot_glue:scaffold Invoice --namespace=admin --gd --nested=~users
437
- ```
438
- Notice for the Invoice build, the parent user is *optionalized* (not 'optional'-- optionalized: to be made so it can be made optional).
439
-
440
- The Invoices controller, which is a Gd controller, will load the User if a user is specified in the route (`/admin/users/:user_id/invoices/`). It will ALSO work at `/admin/invoices` and will switch back into loading directly from the base class when routed without the parent user.
441
-
442
-
443
-
444
416
  ### `--auth=`
445
417
 
446
418
  By default, it will be assumed you have a `current_user` for your user authentication. This will be treated as the "authentication root" for the "poor man's auth" explained above.
@@ -1454,7 +1426,7 @@ Always:
1454
1426
 
1455
1427
  Don't include this last line in your factory code.
1456
1428
 
1457
- ## Nav Templates
1429
+ ## Nav Templates and `--no-nav-menu`
1458
1430
  At the namespace level, you can have a file called `_nav.html.erb` to create tabbed bootstrap nav
1459
1431
 
1460
1432
  To create the file for the first time (at each namespace), start by running
@@ -1478,6 +1450,10 @@ Once the file is present, any further builds in this namespace will:
1478
1450
  ```
1479
1451
  (In this example `owner/` is the namespace and `things` is the name of the scaffold being built)
1480
1452
 
1453
+ To suppress this behavior, add `--no-nav-menu` to the build command and the _nav template will not be touched.
1454
+
1455
+
1456
+
1481
1457
  ## Automatic Base Controller
1482
1458
 
1483
1459
  Hot Glue will copy a file named `base_controller.rb` to the same folder where it tries to create any controller (so to the namespace), unless such a file exists there already.
@@ -1687,6 +1663,18 @@ These automatic pickups for partials are detected at buildtime. This means that
1687
1663
 
1688
1664
  # VERSION HISTORY
1689
1665
 
1666
+ #### 2024-12-25 v0.6.10
1667
+ • adds `--no-nav-menu` option to supress writing to the _nav template
1668
+ • the _nav template itself can now end with either .html.erb or .erb
1669
+ • Removing feature: optionalized nested params (this was a bad idea)
1670
+ • enum partials now correctly render within a namespace
1671
+ • fixes for detecting missing belongs_to relationships
1672
+ • fixes to post-create and post-update parental reloads
1673
+
1674
+
1675
+ #### 2024-12-17 v0.6.9.2
1676
+ • adds alt_lookup to related_set_field.rb and fixes a variable passdown problem in edit.html.erb
1677
+
1690
1678
  #### 2024-12-16 v0.6.9.1
1691
1679
  • Fixes hardcoding in #new action
1692
1680
 
@@ -65,6 +65,7 @@ class FieldFactory
65
65
  attachment_data: generator.attachments[name.to_sym],
66
66
  sample_file_path: generator.sample_file_path,
67
67
  modify_as: generator.modify_as[name.to_sym] || nil,
68
+ plural: generator.plural,
68
69
  display_as: generator.display_as[name.to_sym] || nil,
69
70
  default_boolean_display: generator.default_boolean_display,
70
71
  namespace: generator.namespace_value,
@@ -5,12 +5,14 @@ class AssociationField < Field
5
5
 
6
6
  attr_accessor :assoc_name, :assoc_class, :assoc, :alt_lookup
7
7
 
8
- def initialize( alt_lookup: , class_name: , default_boolean_display:, display_as: ,
9
- name: , singular: ,
10
- update_show_only: ,
11
- hawk_keys: , auth: , sample_file_path:, ownership_field: ,
12
- attachment_data: nil , layout_strategy: , form_placeholder_labels: nil,
13
- form_labels_position:, modify_as: , self_auth: , namespace:, pundit: )
8
+ def initialize( alt_lookup: ,
9
+ class_name: ,
10
+ default_boolean_display:, display_as: ,
11
+ name: , singular: ,
12
+ update_show_only: ,
13
+ hawk_keys: , auth: , sample_file_path:, ownership_field: ,
14
+ attachment_data: nil , layout_strategy: , form_placeholder_labels: nil,
15
+ form_labels_position:, modify_as: , self_auth: , namespace:, pundit: , plural: )
14
16
  super
15
17
 
16
18
 
@@ -2,6 +2,7 @@ class AttachmentField < Field
2
2
  attr_accessor :attachment_data
3
3
  def initialize(alt_lookup:,
4
4
  attachment_data:,
5
+ plural:,
5
6
  auth:,
6
7
  class_name:,
7
8
  display_as:, singular:,
@@ -72,7 +72,7 @@ class EnumField < Field
72
72
  end
73
73
 
74
74
  def partial_render
75
- "<% if #{singular}.#{name} %><%= render partial: #{singular}.#{name}, locals: { #{singular}: #{singular} } %><% end %>"
75
+ "<% if #{singular}.#{name} %><%= render partial: \"#{namespace + "/" if namespace}#{plural}/\#{#{singular}.#{name}}\", locals: { #{singular}: #{singular} } %><% end %>"
76
76
  end
77
77
 
78
78
 
@@ -5,7 +5,7 @@ class Field
5
5
  :hawk_keys, :layout_strategy, :limit, :modify_as, :name, :object, :sample_file_path,
6
6
  :self_auth,
7
7
  :singular_class, :singular, :sql_type, :ownership_field,
8
- :update_show_only, :namespace, :pundit
8
+ :update_show_only, :namespace, :pundit, :plural
9
9
 
10
10
  def initialize(
11
11
  auth: ,
@@ -26,7 +26,8 @@ class Field
26
26
  update_show_only:,
27
27
  self_auth:,
28
28
  namespace:,
29
- pundit:
29
+ pundit: ,
30
+ plural:
30
31
  )
31
32
  @name = name
32
33
  @layout_strategy = layout_strategy
@@ -43,6 +44,7 @@ class Field
43
44
  @modify_as = modify_as
44
45
  @display_as = display_as
45
46
  @pundit = pundit
47
+ @plural = plural
46
48
 
47
49
  @self_auth = self_auth
48
50
  @default_boolean_display = default_boolean_display
@@ -4,6 +4,7 @@ class RelatedSetField < Field
4
4
 
5
5
  def initialize( class_name: , default_boolean_display:, display_as: ,
6
6
  name: , singular: ,
7
+ alt_lookup: ,
7
8
  update_show_only: ,
8
9
  hawk_keys: , auth: , sample_file_path:, ownership_field: ,
9
10
  attachment_data: nil , layout_strategy: , form_placeholder_labels: nil,
@@ -26,7 +26,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
26
26
  :singular_class, :smart_layout, :stacked_downnesting,
27
27
  :update_show_only, :ownership_field,
28
28
  :layout_strategy, :form_placeholder_labels,
29
- :form_labels_position, :pundit,
29
+ :form_labels_position, :no_nav_menu, :pundit,
30
30
  :self_auth, :namespace_value, :record_scope, :related_sets,
31
31
  :search_clear_button, :search_autosearch
32
32
  # important: using an attr_accessor called :namespace indirectly causes a conflict with Rails class_name method
@@ -37,7 +37,6 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
37
37
  class_option :singular_class, type: :string, default: nil
38
38
  class_option :nest, type: :string, default: nil # DEPRECATED —— DO NOT USE
39
39
  class_option :nested, type: :string, default: ""
40
-
41
40
  class_option :namespace, type: :string, default: nil
42
41
  class_option :auth, type: :string, default: nil
43
42
  class_option :auth_identifier, type: :string, default: nil
@@ -45,7 +44,6 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
45
44
  class_option :include, type: :string, default: ""
46
45
  class_option :god, type: :boolean, default: false
47
46
  class_option :gd, type: :boolean, default: false # alias for god
48
-
49
47
  class_option :specs_only, type: :boolean, default: false
50
48
  class_option :no_specs, type: :boolean, default: false
51
49
  class_option :no_delete, type: :boolean, default: false
@@ -58,7 +56,6 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
58
56
  class_option :big_edit, type: :boolean, default: false
59
57
  class_option :show_only, type: :string, default: ""
60
58
  class_option :update_show_only, type: :string, default: ""
61
-
62
59
  class_option :ujs_syntax, type: :boolean, default: nil
63
60
  class_option :downnest, type: :string, default: nil
64
61
  class_option :magic_buttons, type: :string, default: nil
@@ -71,7 +68,6 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
71
68
  class_option :layout, type: :string, default: nil # if used here it will override what is in the config
72
69
  class_option :hawk, type: :string, default: nil
73
70
  class_option :with_turbo_streams, type: :boolean, default: false
74
-
75
71
  class_option :label, default: nil
76
72
  class_option :list_label_heading, default: nil
77
73
  class_option :new_button_label, default: nil
@@ -101,8 +97,11 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
101
97
  class_option :code_before_update, default: nil
102
98
  class_option :code_after_update, default: nil
103
99
  class_option :record_scope, default: nil
100
+ class_option :no_nav_menu, type: :boolean, default: false # suppress writing to _nav template
101
+
104
102
 
105
103
 
104
+ # SEARCH OPTIONS
106
105
  class_option :search, default: nil # set or predicate
107
106
 
108
107
  # FOR THE SET SEARCH
@@ -111,11 +110,8 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
111
110
  # for the single-entry search box, they will be removed from the list specified above.
112
111
  class_option :search_query_fields, default: '' # comma separated list of fields to search by single-entry search term
113
112
  class_option :search_position, default: 'vertical' # choices are vertical or horizontal
114
-
115
-
116
113
  class_option :search_clear_button, default: false
117
- class_option :saerch_autosearch, default: false
118
-
114
+ class_option :search_autosearch, default: false
119
115
 
120
116
  # FOR THE PREDICATE SEARCH
121
117
  # TDB
@@ -343,6 +339,9 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
343
339
  @record_scope = options['record_scope']
344
340
 
345
341
  @pundit = options['pundit']
342
+
343
+ @no_nav_menu = options['no_nav_menu']
344
+
346
345
  if @pundit.nil?
347
346
  @pundit = get_default_from_config(key: :pundit_default)
348
347
  end
@@ -788,12 +787,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
788
787
  raise(HotGlue::Error, exit_message)
789
788
 
790
789
  else
791
- if eval(singular_class + ".reflect_on_association(:#{@object_owner_sym.to_s})").nil? && !eval(singular_class + ".reflect_on_association(:#{@object_owner_sym.to_s.singularize})").nil?
792
- exit_message = "*** Oops: you tried to nest #{singular_class} within a route for `#{@object_owner_sym}` but I can't find an association for this relationship. Did you mean `#{@object_owner_sym.to_s.singularize}` (singular) instead?"
793
- # else # NOTE: not reachable
794
- # exit_message = "*** Oops: Missing relationship from class #{singular_class} to :#{@object_owner_sym} maybe add `belongs_to :#{@object_owner_sym}` to #{singular_class}\n (If your user is called something else, pass with flag auth=current_X where X is the model for your auth object as lowercase. Also, be sure to implement current_X as a method on your controller. If you really don't want to implement a current_X on your controller and want me to check some other method for your current user, see the section in the docs for --auth-identifier flag). To make a controller that can read all records, specify with --god."
795
- end
796
-
790
+ exit_message = "When trying to nest #{singular_class} within #{@nested_set.last[:plural]}, check the #{singular_class} model for the #{@object_owner_sym} association: \n belongs_to :#{@object_owner_sym}"
797
791
  raise(HotGlue::Error, exit_message)
798
792
  end
799
793
  elsif @object_owner_sym && !@object_owner_eval.include?(".")
@@ -1011,6 +1005,10 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1011
1005
  }.join(",\n ")
1012
1006
  end
1013
1007
 
1008
+ def nest_path
1009
+ @nested_set.collect{| arg| arg[:singular] }.join("/") + "/" if @nested_set.any?
1010
+ end
1011
+
1014
1012
  def controller_class_name
1015
1013
  @controller_build_name
1016
1014
  end
@@ -1238,7 +1236,8 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1238
1236
  end
1239
1237
 
1240
1238
  def include_nav_template
1241
- File.exist?("#{Rails.root}/app/views/#{namespace_with_trailing_dash}_nav.html.#{@markup}")
1239
+ File.exist?("#{Rails.root}/app/views/#{namespace_with_trailing_dash}_nav.html.#{@markup}") ||
1240
+ File.exist?("#{Rails.root}/app/views/#{namespace_with_trailing_dash}_nav.#{@markup}")
1242
1241
  end
1243
1242
 
1244
1243
  def copy_view_files
@@ -1303,11 +1302,16 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1303
1302
  end
1304
1303
  end
1305
1304
 
1306
- def insert_into_nav_template
1307
- # how does this get called(?)
1308
- nav_file = "#{Rails.root}/app/views/#{namespace_with_trailing_dash}_nav.html.#{@markup}"
1309
-
1305
+ def insert_into_nav_template # called from somewhere in the generator
1306
+ return if @no_nav_menu
1310
1307
  if include_nav_template
1308
+ if File.exist?("#{Rails.root}/app/views/#{namespace_with_trailing_dash}_nav.html.#{@markup}")
1309
+ nav_file = "#{Rails.root}/app/views/#{namespace_with_trailing_dash}_nav.html.#{@markup}"
1310
+ elsif File.exist?("#{Rails.root}/app/views/#{namespace_with_trailing_dash}_nav.#{@markup}")
1311
+ nav_file = "#{Rails.root}/app/views/#{namespace_with_trailing_dash}_nav.#{@markup}"
1312
+ end
1313
+
1314
+
1311
1315
  append_text = " <li class='nav-item'>
1312
1316
  <%= link_to '#{@list_label_heading.humanize}', #{path_helper_plural(@nested_set.any? ? true: false)}, class: \"nav-link \#{'active' if nav == '#{plural_name}'}\" %>
1313
1317
  </li>"
@@ -1604,20 +1608,26 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1604
1608
 
1605
1609
  def post_action_parental_updates
1606
1610
  if @nested_set.any?
1607
- @nested_set.collect { |data|
1611
+ @nested_set.collect { |data|
1608
1612
  parent = data[:singular]
1609
- "@#{singular}.#{parent}.reload"
1610
- }
1613
+ "#{parent}.reload"
1614
+ }
1611
1615
  else
1612
1616
  []
1613
1617
  end
1614
1618
  end
1615
1619
 
1616
1620
  def turbo_parental_updates
1621
+ set_path = @nested_set.collect { |data| "#{data[:singular]}" }.join("/") + "/"
1622
+ puts "constructing for #{set_path}"
1617
1623
  @nested_set.collect { |data|
1618
- "<%= turbo_stream.replace \"__#{@namespace if @namespace}\#{dom_id(@#{data[:singular]})}\" do %>
1619
- <%= render partial: \"#{@namespace}/#{data[:plural]}/line\", locals: {#{data[:singular]}: @#{singular}.#{data[:singular]}.reload} %>
1624
+ res = "<%= turbo_stream.replace \"__#{@namespace if @namespace}\#{dom_id(@#{data[:singular]})}\" do %>
1625
+ <%= render partial: \"#{@namespace}/#{data[:plural]}/line\", locals: {#{@nested_set.collect { |d|
1626
+ (set_path.index(data[:singular] + "/") > set_path.index(d[:singular] + "/") || d[:singular] == data[:singular] ) ? "#{d[:singular]}: @#{d[:singular]}" : nil
1627
+ }.compact.join(", ")}} %>
1620
1628
  <% end %>"
1629
+
1630
+ res
1621
1631
  }.join("\n")
1622
1632
  end
1623
1633
  end
@@ -60,13 +60,13 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
60
60
  <% if !@self_auth %>
61
61
  def load_<%= singular_name %>
62
62
  <% if @nested_set[0] && @nested_set[0][:optional] %>if params.include?(:<%= @nested_set.last[:singular] %>_id)
63
- @<%= singular_name %> = <%= object_scope.gsub("@",'') %><%= @record_scope %>.find(params[:id])
64
- else <% end %>@<%= singular_name %> = <%= object_scope %><%= @record_scope %>.find(params[:id])<% if @nested_set[0] && @nested_set[0][:optional] %>
63
+ @<%= singular_name %> = <%= object_scope.gsub("@",'') %>.find(params[:id])
64
+ else <% end %>@<%= singular_name %> = <%= object_scope %>.find(params[:id])<% if @nested_set[0] && @nested_set[0][:optional] %>
65
65
  end<% end %>
66
66
  end
67
67
  <% else %>
68
68
  def load_<%= singular_name %>
69
- @<%= 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 %><%= @record_scope %>
69
+ @<%= 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 %>
70
70
  end<% end %>
71
71
  <% if @paginate_per_page_selector %>def per
72
72
  params[:per] || 10
@@ -115,7 +115,7 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
115
115
  <%= @code_before_create ? "\n " + @code_before_create.gsub(";", "\n") : "" %>
116
116
  if @<%= singular_name %>.save<%= @code_after_create ? ("\n " + @code_after_create.gsub(";", "\n")) : ""%>
117
117
  flash[:notice] = "Successfully created #{@<%= singular %>.<%= display_class %>}"
118
- <%= post_action_parental_updates.join("\n ") %>
118
+ <%= post_action_parental_updates.compact.join("\n ") %>
119
119
  load_all_<%= plural %>
120
120
  <% unless @display_edit_after_create %>render :create<% else %>redirect_to <%= HotGlue.optionalized_ternary(namespace: @namespace,
121
121
  top_level: true,
@@ -131,7 +131,7 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
131
131
  <% unless @display_edit_after_create %>render :create, status: :unprocessable_entity<% else %>render :new , status: :unprocessable_entity<% end %>
132
132
  end<% if @pundit %>
133
133
  rescue Pundit::NotAuthorizedError => e
134
- @user.errors.add(:base, e.message)
134
+ @<%= singular %>.errors.add(:base, e.message)
135
135
  render :create, status: :unprocessable_entity<% end %>
136
136
  end
137
137
 
@@ -181,10 +181,11 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
181
181
  authorize @<%= singular_name %>
182
182
  <%= @code_before_update ? "\n " + @code_before_update.gsub(";", "\n") : "" %>
183
183
  @<%= singular_name %>.save
184
- <% else %>
184
+ <% else %>
185
185
  <%= @code_before_update ? "\n " + @code_before_update.gsub(";", "\n") : "" %>
186
186
  if @<%= singular_name %>.update(modified_params)
187
187
  <% end %>
188
+ <%= post_action_parental_updates.compact.join("\n ") %>
188
189
  <%= @code_after_update ? "\n " + @code_after_update.gsub(";", "\n") : "" %>
189
190
  <% if @display_list_after_update %> load_all_<%= plural %><% end %>
190
191
  flash[:notice] << "Saved #{@<%= singular %>.<%= display_class %>}"
@@ -3,7 +3,9 @@
3
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
+ <!-- parental updated -->
6
7
  <%= turbo_parental_updates %>
8
+ <!-- errors -->
7
9
  <\%= turbo_stream.replace "<%= @namespace %>__<%= singular %>-new" do %>
8
10
  <\% if @<%= singular %>.errors.none? %>
9
11
  <\%= render partial: "new_button", locals: {}<%= @nested_set.collect{|arg| ".merge(@" + arg[:singular] + " ? {" + arg[:singular] + ": @" + arg[:singular] + "} : {})"}.join() %> %>
@@ -4,7 +4,7 @@
4
4
  <div class="col-md-12">
5
5
  <\%= link_to "<% if @button_icons == 'font-awesome' %><i class='fa fa-arrow-circle-left 2x'></i><% end %> Back to list".html_safe, <%= path_helper_plural(true) %> %>
6
6
  <% end %>
7
- <\%= render partial: "edit", locals: {<%= singular %>: @<%= singular %><%= @nested_set.any? ? () : "" %>} %>
7
+ <\%= render partial: "edit", locals: {<%= singular %>: @<%= singular %><%= @nested_set.any? ? ", " + (@nested_set.collect{|x| "#{x[:singular]}: @#{x[:singular]}"}.join(", ") ) : "" %>} %>
8
8
  <% if @big_edit %>
9
9
  </div>
10
10
  </div>
@@ -14,7 +14,7 @@
14
14
  <% each_downnest_width = @downnest_children.count == 1 ? 33 : (53/@downnest_children.count).floor %>
15
15
  <% @downnest_object.each do |downnest, size| %>
16
16
  <div class="row">
17
- <div class="col-md-6">
17
+ <div class="col-md-<%= @big_edit ? 12 : 6 %>">
18
18
  <% downnest_object = eval("#{singular_class}.reflect_on_association(:#{downnest})") %>
19
19
  <% if downnest_object.nil?; raise "no relationship for downnested portal `#{downnest}` found on `#{singular_class}`; please check relationship for has_many :#{downnest}"; end; %>
20
20
  <% downnest_class = downnest_object.class_name %>
@@ -1,10 +1,13 @@
1
1
  <% if !@display_list_after_update %><\%= turbo_stream.replace "<%= @namespace %>__#{dom_id(@<%= singular %>)}" do %>
2
- <\%= render partial: 'line', locals: {<%= singular %>: @<%= singular %> }<%= @nested_set.collect{|arg| ".merge(@#{arg[:singular]} ? {#{arg[:singular]}: @#{arg[:singular]}} : {})" }.join %> \%>
2
+ <\%= render partial: 'line', locals: {<%= singular %>: @<%= singular %>, <%= @nested_set.collect{|arg| " #{arg[:singular]}: @#{arg[:singular]}"}.join(", ") %> } \%>
3
3
  <\% end %><% else %><\%= turbo_stream.replace "<%= plural %>-list" do %>
4
- <\%= render partial: '<%= list_path_partial %>', locals: {<%= plural %>: @<%= plural %>}<%= @nested_set.collect{|arg| ".merge(@#{arg[:singular]} ? {#{arg[:singular]}: @#{arg[:singular]}} : {})" }.join %> \%>
4
+ <\%= render partial: '<%= list_path_partial %>', locals: {<%= plural %>: @<%= plural %><%= @nested_set.collect{|arg| " #{arg[:singular]}: @#{arg[:singular]}"}.join(", ") %>
5
+ \%>
5
6
  <\% end %>
6
7
  <% end %>
8
+ <!-- parental updated -->
7
9
  <%= turbo_parental_updates %>
10
+ <!-- flash notices -->
8
11
  <\%= turbo_stream.update "flash_notices" do %>
9
12
  <\%= render partial: "layouts/flash_notices", locals: {resource: @<%= singular %>} %>
10
13
  <\% end %>
@@ -1,5 +1,5 @@
1
1
  module HotGlue
2
2
  class Version
3
- CURRENT = '0.6.9.1'
3
+ CURRENT = '0.6.10'
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.6.9.1
4
+ version: 0.6.10
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: 2024-12-16 00:00:00.000000000 Z
11
+ date: 2024-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails