hot-glue 0.6.18 → 0.6.19

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ddd7d67de32f74ce4e79fabcaaa216e9e5cfbbd84c4bb6d9ab53b6ba2dd57f00
4
- data.tar.gz: 5e4e51cce50f7c7e3579bb09c452c5c0b02b4331870a22c9bd249281dab8cd7a
3
+ metadata.gz: 9e7085c942cab4dc377c75180d546b57f6ca76bdb3c96f3b2a837d1fdd887b0f
4
+ data.tar.gz: 04fd50131e53977f25c8817c7fd7bd33e34cb0aa784c995394c94302491b1426
5
5
  SHA512:
6
- metadata.gz: e250a3b6598e3e83312bad3b27d7da0f200563ab7e89a544f23aa46913eb1f23ea796854dcdf7d2939291ec8b8ce92fe245c629658982b4f47a71e20a19e1c5f
7
- data.tar.gz: '08b99eba601f426decbcd5e2fe5daf6c9b121c1285e847d2f7b827da14f1c16a30bb20e2813770a68b20a623fe85584e1e9fe6784c86f42eb5d97c375715421d'
6
+ metadata.gz: fa984faeba62c9303c5ae0c64b32143e054289380ffdfecf2f0d457c7b2c2d69912b69901d78ee6fff75f1e6997ed19e86a4cc00a8c048341fbf2505e687a984
7
+ data.tar.gz: 052122bbbc7d15c134653efc4da2b74df8400447eccae13d395627bd5d79b2a616f612c97ac995f07b563a8589c9609406320562616f7efe637b94d7289a5e8a
data/README.md CHANGED
@@ -1443,6 +1443,16 @@ If you leave the 2nd parameter blank when using the 3rd parameter, it will defau
1443
1443
 
1444
1444
  `--attachments='avatar{thumbnail||direct}'`
1445
1445
 
1446
+ #### `--attachments` Long form syntax with 4 parameters
1447
+
1448
+ The final (4th) parameter should be `dropzone` to enable dropzone support for this attachment.
1449
+
1450
+ ```
1451
+ bin/rails generate hot_glue:scaffold Video --auth='current_user' --auth-identifier='user' --namespace='account_dashboard' --nested='account' --smart-layout --attachments='video_file{thumbnail||direct|dropzone}'
1452
+ ```
1453
+
1454
+ See below for dropzone details.
1455
+
1446
1456
 
1447
1457
  #### For S3 Setup
1448
1458
 
@@ -1944,21 +1954,35 @@ These automatic pickups for partials are detected at build time. This means that
1944
1954
 
1945
1955
  # VERSION HISTORY
1946
1956
 
1957
+ #### 2025-06-10 v0.6.19
1958
+
1959
+ • Fixes magic button output behavior to correctly show the string returned by the bang menthod
1960
+ • Fixes internal syntax of modify_as for modified fields; note default is now 'Yes' and 'No' for radio buttons
1961
+ • fixes destroy behavior with explicit .destroy! and ActiveRecord::RecordNotDestroyed; documents previously undocumented 4th parameter for attachment input
1962
+
1963
+
1947
1964
  #### 2025-05-18 v0.6.18
1948
- • Significant additions to `--alt-foreign-key-lookups` which can now work:
1949
- - on its on, without needing a factory
1965
+ • Significant additions to `--alt-foreign-key-lookup` which can now work:
1966
+ - on its own, without needing a factory (`--factory-creation`)
1950
1967
  - with a factory
1951
1968
  - with our without the hawk
1952
- - in Gd mode or, if not, use with `--factory-creation` or use with `--hawk`
1969
+ - in Gd mode
1970
+ - if not in Gd mode, use with `--factory-creation` or use with the `--hawk`
1953
1971
 
1954
1972
  See notes above for details.
1955
1973
 
1956
- Adds Integer as serachable field
1974
+ example apps
1975
+ https://github.com/hot-glue-for-rails/HGHumanSpaMay25
1976
+ https://github.com/hot-glue-for-rails/HGAltLookups11
1977
+
1978
+
1979
+ • Adds Integer as searchable field
1957
1980
 
1958
1981
  _ foo and bar are integers _
1959
1982
 
1960
1983
  `rails g hot_glue:scaffold Thing --include=foo,bar --search=set --search-fields=foo,bar`
1961
1984
 
1985
+ • On show only association fields, view output is now safe-nil using `&` to not crash if the association doesn't exist.
1962
1986
 
1963
1987
 
1964
1988
  #### 2025-05-09 - v0.6.17
@@ -148,7 +148,7 @@ class AssociationField < Field
148
148
  if @stimmify
149
149
  col_target = HotGlue.to_camel_case(name.to_s.gsub("_", " "))
150
150
  data_attr = ", data: {'#{@stimmify}-target': '#{col_target}'} "
151
- els
151
+ else
152
152
  data_attr = ""
153
153
  end
154
154
 
@@ -23,9 +23,9 @@ class BooleanField < Field
23
23
 
24
24
  def radio_button_display
25
25
  " <%= f.radio_button(:#{name}, '0', checked: #{singular}.#{name} ? '' : 'checked', class: '#{@layout_strategy.form_checkbox_input_class}') %>\n" +
26
- " <%= f.label(:#{name}, value: '#{modify_binary? && modify_as[name.to_sym][:binary][:falsy] || 'No'}', for: '#{singular}_#{name}_0') %>\n" +
26
+ " <%= f.label(:#{name}, value: '#{modify_binary? && modify_as[:binary][:falsy] || 'No'}', for: '#{singular}_#{name}_0') %>\n" +
27
27
  " <br /> <%= f.radio_button(:#{name}, '1', checked: #{singular}.#{name} ? 'checked' : '' , class: '#{@layout_strategy.form_checkbox_input_class}') %>\n" +
28
- " <%= f.label(:#{name}, value: '#{modify_binary? && modify_as[name.to_sym][:binary][:truthy] || 'Yes'}', for: '#{singular}_#{name}_1') %>\n"
28
+ " <%= f.label(:#{name}, value: '#{modify_binary? && modify_as[:binary][:truthy] || 'Yes'}', for: '#{singular}_#{name}_1') %>\n"
29
29
  end
30
30
 
31
31
  def checkbox_display
@@ -59,9 +59,9 @@ class BooleanField < Field
59
59
  "<% if #{singular}.#{name}.nil? %>
60
60
  <span class=''>MISSING</span>
61
61
  <% elsif #{singular}.#{name} %>
62
- #{modify_as[name.to_sym][:binary][:truthy]}
62
+ #{modify_as[:binary][:truthy]}
63
63
  <% else %>
64
- #{modify_as[name.to_sym][:binary][:falsy]}
64
+ #{modify_as[:binary][:falsy]}
65
65
  <% end %>"
66
66
  else
67
67
  "<% if #{singular}.#{name}.nil? %>
@@ -75,11 +75,11 @@ class BooleanField < Field
75
75
  end
76
76
 
77
77
  def truthy_value
78
- modify_as[name.to_sym][:binary][:truthy] || 'Yes'
78
+ modify_as[:binary][:truthy] || 'Yes'
79
79
  end
80
80
 
81
81
  def falsy_value
82
- modify_as[name.to_sym][:binary][:falsy] || 'No'
82
+ modify_as[:binary][:falsy] || 'No'
83
83
  end
84
84
 
85
85
  def label_class
@@ -25,7 +25,7 @@ class Field
25
25
  @form_placeholder_labels = scaffold.form_placeholder_labels
26
26
  @ownership_field = scaffold.ownership_field
27
27
  @form_labels_position = scaffold.form_labels_position
28
- @modify_as = scaffold.modify_as
28
+ @modify_as = scaffold.modify_as[name.to_sym] # note whenever used as field, don't relookup the key
29
29
  @display_as = scaffold.display_as
30
30
  @pundit = scaffold.pundit
31
31
  @plural = scaffold.plural
@@ -113,7 +113,7 @@ class Field
113
113
  end
114
114
 
115
115
  def viewable_output
116
- if modify_as[:modify]
116
+ if modify_as
117
117
  modified_display_output(show_only: true)
118
118
  else
119
119
  field_view_output
@@ -159,7 +159,6 @@ class Field
159
159
  # end
160
160
  # res = "<span class='badge <%= #{badge_code} %>'>" + res + "</span>"
161
161
  # end
162
- # byebug
163
162
  res
164
163
  end
165
164
 
@@ -186,8 +186,13 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
186
186
  flash[:alert] = nil
187
187
  <% @magic_buttons.each do |button| %>
188
188
  if <%= singular_name %>_params[:__<%= button %>]
189
- @<%= singular_name %>.<%= button %>!
190
- flash[:notice] << "<% singular %> <%= button.titlecase %>."
189
+
190
+ if res = @<%= singular_name %>.<%= button %>!
191
+ flash[:notice] << "<% singular %> <%= button.titlecase %>"
192
+ flash[:notice] << " #{res}" if res.is_a?(String)
193
+ else
194
+ flash[:alert] = " <%= button.titlecase %> failed."
195
+ end
191
196
  end
192
197
  <% end %>
193
198
 
@@ -254,9 +259,9 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
254
259
  skip_authorization
255
260
  raise Pundit::NotAuthorizedError if ! <%= @pundit_policy_override %>.destroy?<% end %>
256
261
  begin
257
- @<%=singular_name%>.destroy
262
+ @<%=singular_name%>.destroy!
258
263
  flash[:notice] = '<%= singular_name.titlecase %> successfully deleted'
259
- rescue ActiveRecordError => e
264
+ rescue ActiveRecord::RecordNotDestroyed => e
260
265
  flash[:alert] = '<%= singular_name.titlecase %> could not be deleted'
261
266
  end
262
267
  <%= post_action_parental_updates.join("\n ") %>
@@ -1,5 +1,5 @@
1
1
  module HotGlue
2
2
  class Version
3
- CURRENT = '0.6.18'
3
+ CURRENT = '0.6.19'
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.18
4
+ version: 0.6.19
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: 2025-05-18 00:00:00.000000000 Z
11
+ date: 2025-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails