hot-glue 0.6.14 → 0.6.15

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: 3e3938ec168ea29eb7311c82742601f1d19ceb5c670e909ddd6ab5efda1a8bca
4
- data.tar.gz: 4a2a21046045ab745e0c2d3ba3b5faddab2507628e245d5caae159f9c6c8bca2
3
+ metadata.gz: 4e3993f35ba9d926cec0a205bb06708be83c2d72012eaafebce6cb384da07a92
4
+ data.tar.gz: 509b98c64699c6561435d63da9b0ae6afe2924d6c1624dbcedf1a3288a5dfc0d
5
5
  SHA512:
6
- metadata.gz: 37aa5ce09632029e929cd9d085c48bab155ee4db0560e76d9a8bf9aac5ab541929fd604111674da4390383c123e3b7c53b2826a0a374e2de507f665bb440d49c
7
- data.tar.gz: 50b1a2f1fac6ae0e144bb949c9febb63165a3eeec7d0780035998234e7b854631c949246c06886d0a75c9dc0baf83fe8103948981d2fec3167086ecff1c8fa34
6
+ metadata.gz: b3d097f4f7130718597c9024173980e2d7b59826d4bb355ce34c22f70f0fec01e6265784007bdc296f41e0cd232d96d7a1ed2e0b055a6f7dbb1eef644fac5da7
7
+ data.tar.gz: 83905ccb51e15676d2dff4253f656ef29a330272ed0549ebbbb74a7272ee9aa42b04491ba4ef88c2bf9fb84ec047991da89fa027e519cf048f3197bd7687ccd1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hot-glue (0.6.12)
4
+ hot-glue (0.6.14)
5
5
  ffaker (~> 2.16)
6
6
  kaminari (~> 1.2)
7
7
  rails (> 5.1)
@@ -140,14 +140,14 @@ GEM
140
140
  mini_mime (1.1.2)
141
141
  mini_portile2 (2.8.4)
142
142
  minitest (5.16.3)
143
- net-imap (0.5.5)
143
+ net-imap (0.5.6)
144
144
  date
145
145
  net-protocol
146
146
  net-pop (0.1.2)
147
147
  net-protocol
148
148
  net-protocol (0.2.2)
149
149
  timeout
150
- net-smtp (0.5.0)
150
+ net-smtp (0.5.1)
151
151
  net-protocol
152
152
  nio4r (2.5.8)
153
153
  nokogiri (1.13.9)
data/README.md CHANGED
@@ -1751,6 +1751,13 @@ These automatic pickups for partials are detected at build time. This means that
1751
1751
 
1752
1752
  # VERSION HISTORY
1753
1753
 
1754
+ #### 2025-03-17 - v0.6.15
1755
+
1756
+ • now store on your current_user model (this is automatically passed into the method modify_date_inputs_on_params). HG will set user-inputted values correctly to daylight savings time during April-Nov months only (#195)
1757
+ • fixes issue with turbo frame name after create is rendered (#194)
1758
+ • removes vestigates of optionalized partents
1759
+
1760
+
1754
1761
  #### 2025-02-28 - v0.6.14
1755
1762
 
1756
1763
  • fixes bug in association field involving scaffolds built without nesting
@@ -68,8 +68,16 @@ module HotGlue
68
68
  end
69
69
  end
70
70
 
71
+ def is_dst_now?
72
+ Time.now.utc.month > 3 && Time.now.month < 11 ||
73
+ (Time.now.utc.month == 3 && Time.now.day >= (14 - Time.now.utc.wday)) ||
74
+ (Time.now.utc.month == 11 && Time.now.utc.day < (7 - Time.now.utc.wday))
75
+ end
76
+
71
77
  def modify_date_inputs_on_params(modified_params, current_user_object = nil, field_list = nil)
72
78
  use_timezone = (current_user_object.try(:timezone)) || Time.zone
79
+ uses_dst = (current_user_object.try(:locale_uses_dst)) || false
80
+
73
81
  modified_params = modified_params.tap do |params|
74
82
  params.keys.each{|k|
75
83
 
@@ -88,7 +96,9 @@ module HotGlue
88
96
  # if they already exist in your database, you should zero them out
89
97
  # or apply .change(sec: 0) when displaying them as output in the form
90
98
  # this will prevent seconds from being added by the browser
91
- params[k] = Time.strptime(parse_date, "%Y-%m-%d %H:%M %Z")
99
+ parsed_time = Time.strptime(parse_date, "%Y-%m-%d %H:%M %Z")
100
+ parsed_time = parsed_time.to_time - 60.minutes if uses_dst && is_dst_now?
101
+ params[k] = parsed_time
92
102
  end
93
103
  end
94
104
  }
@@ -155,6 +155,7 @@ class AssociationField < Field
155
155
  hawked_association = "#{assoc.class_name}.all"
156
156
  end
157
157
 
158
+
158
159
  (is_owner ? "<% unless @#{assoc_name} %>\n" : "") +
159
160
  " <%= f.collection_select(:#{name}, #{hawked_association}, :id, :#{display_column}, {prompt: true, selected: #{singular}.#{name} }, class: 'form-control') %>\n" +
160
161
  (is_owner ? "<% else %>\n <%= @#{assoc_name}.#{display_column} %>" : "") +
@@ -253,6 +254,13 @@ class AssociationField < Field
253
254
  # "\n "
254
255
  end
255
256
 
257
+ def newline_after_field?
258
+ if modify_as && modify_as[:typeahead]
259
+ false
260
+ else
261
+ true
262
+ end
263
+ end
256
264
 
257
265
  def where_query_statement
258
266
  ".where(*#{name}_query)"
@@ -219,4 +219,9 @@ class Field
219
219
  def code_to_reset_match_if_search_is_blank
220
220
  nil
221
221
  end
222
+
223
+ def newline_after_field?
224
+ false
225
+ end
226
+
222
227
  end
@@ -158,6 +158,8 @@ module HotGlue
158
158
  # show only on the update action overrides any pundit policy
159
159
  elsif @pundit && eval("defined? #{singular_class}Policy") && eval("#{singular_class}Policy").instance_methods.include?("#{col}_able?".to_sym)
160
160
  "<% if policy(@#{singular}).#{col}_able? %>" + columns_map[col].form_field_output + "<% else %>" + columns_map[col].form_show_only_output + "<% end %>"
161
+ elsif update_show_only.include?(col)
162
+ "<% if @action == 'edit' %>" + columns_map[col].form_show_only_output + "<% else %>" + columns_map[col].form_field_output + "<% end %>"
161
163
  else
162
164
  columns_map[col].form_field_output
163
165
  end
@@ -168,7 +170,7 @@ module HotGlue
168
170
  add_spaces_each_line( "\n <span #{@tinymce_stimulus_controller}class='<%= \"alert alert-danger\" if #{singular}.errors.details.keys.include?(:#{field_error_name}) %>' #{'style="display: inherit;"'} >\n" +
169
171
  add_spaces_each_line( (form_labels_position == 'before' ? (the_label || "") + "<br />\n" : "") +
170
172
  + field_result +
171
- (form_labels_position == 'after' ? "<br />\n" + (the_label || "") : "") , 4) +
173
+ (form_labels_position == 'after' ? ( columns_map[col].newline_after_field? ? "<br />\n" : "") + (the_label || "") : "") , 4) +
172
174
  "\n </span>\n ", 2)
173
175
 
174
176
  }.join("") + "\n </div>"
@@ -77,7 +77,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
77
77
  class_option :no_list_heading, type: :boolean, default: false
78
78
 
79
79
  # determines if the labels show up BEFORE or AFTER on the NEW/EDIT (form)
80
- class_option :form_labels_position, type: :string, default: 'after' # choices are before, after, omit
80
+ class_option :form_labels_position, type: :string # choices are before, after, omit
81
81
  class_option :form_placeholder_labels, type: :boolean, default: false # puts the field names into the placeholder labels
82
82
 
83
83
  # determines if labels appear within the rows of the VIEWABLE list (does NOT affect the list heading)
@@ -310,10 +310,18 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
310
310
  @inline_list_labels = options['inline_list_labels'] || get_default_from_config(key: :inline_list_labels) || 'omit' # 'before','after','omit'
311
311
 
312
312
  @form_labels_position = options['form_labels_position']
313
- if !['before', 'after', 'omit'].include?(@form_labels_position)
314
- raise HotGlue::Error, "You passed '#{@form_labels_position}' as the setting for --form-labels-position but the only allowed options are before, after (default), and omit"
313
+ if @form_labels_position.nil?
314
+ @form_labels_position = get_default_from_config(key: :form_labels_position)
315
+ if @form_labels_position.nil?
316
+ @form_labels_position = 'after'
317
+ end
318
+ else
319
+ if !['before', 'after', 'omit'].include?(@form_labels_position)
320
+ raise HotGlue::Error, "You passed '#{@form_labels_position}' as the setting for --form-labels-position but the only allowed options are before, after (default), and omit"
321
+ end
315
322
  end
316
323
 
324
+
317
325
  if !['before', 'after', 'omit'].include?(@inline_list_labels)
318
326
  raise HotGlue::Error, "You passed '#{@inline_list_labels}' as the setting for --inline-list-labels but the only allowed options are before, after, and omit (default)"
319
327
  end
@@ -651,6 +659,10 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
651
659
  @menu_file_exists = true if @nested_set.none? && File.exist?("#{Rails.root}/app/views/#{namespace_with_trailing_dash}_menu.#{@markup}")
652
660
 
653
661
  @turbo_streams = !!options['with_turbo_streams']
662
+
663
+ puts "show only #{@show_only}"
664
+ puts "update show only #{@update_show_only}"
665
+
654
666
  end
655
667
 
656
668
  def setup_hawk_keys
@@ -1330,9 +1342,12 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1330
1342
  append_text = " <li class='nav-item'>
1331
1343
  <%= link_to '#{@list_label_heading.humanize}', #{path_helper_plural(@nested_set.any? ? true: false)}, class: \"nav-link \#{'active' if nav == '#{plural_name}'}\" %>
1332
1344
  </li>"
1345
+ alt_append_text = " <li class='nav-item'>
1346
+ <%= link_to '#{@list_label_heading.humanize.upcase}', #{path_helper_plural(@nested_set.any? ? true: false)}, class: \"nav-link \#{'active' if nav == '#{plural_name}'}\" %>
1347
+ </li>"
1333
1348
 
1334
1349
  text = File.read(nav_file)
1335
- if text.include?(append_text)
1350
+ if text.include?(append_text) || text.include?(alt_append_text)
1336
1351
  puts "SKIPPING: Nav link for #{singular_name} already exists in #{nav_file}"
1337
1352
  else
1338
1353
  puts "APPENDING: nav link for #{singular_name} #{nav_file}"
@@ -1531,9 +1546,9 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1531
1546
  if @nested_set.none?
1532
1547
  "\"\""
1533
1548
  else
1534
- @nested_set.collect { |arg|
1535
- "(((\"__#{arg[:singular]}-\#{" + "@" + arg[:singular] + ".id}\") if @" + arg[:singular] + ") || \"\")"
1536
- }.join(" + ")
1549
+ "\"" + @nested_set.collect { |arg|
1550
+ "__#{arg[:singular]}-\#{" + "@" + arg[:singular] + ".id}"
1551
+ }.join("") + "\""
1537
1552
  end
1538
1553
  end
1539
1554
 
@@ -1,7 +1,8 @@
1
1
  <\% if @<%= singular %>.errors.none? %>
2
2
  <\%= turbo_stream.replace "<%= @namespace %>__<%= plural %>-list" + <%= nested_for_turbo_nested_constructor %> do %>
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
- <\% end %>
3
+ <\%= render partial: "list", locals: {<%= plural %>: @<%= plural %><% if @nested_set.any? %>, <%= @nested_set.collect{|arg| "#{arg[:singular]}: @#{arg[:singular]}"}.join(", ") %>, nested_for: '<%= @nested_set.collect{|arg| "\"#{arg[:singular]}-\#{@#{arg[:singular]}.id}\""}.join("__") %>' <% end %> } %>
4
+
5
+ <\% end %>
5
6
  <\% end %>
6
7
  <!-- parental updated -->
7
8
  <%= turbo_parental_updates %>
@@ -15,5 +16,4 @@
15
16
  <\% end %>
16
17
  <\%= turbo_stream.replace "flash_notices" do %>
17
18
  <\%= render partial: "layouts/flash_notices", locals: {resource: @<%= singular %>} %>
18
-
19
19
  <\% end %>
@@ -1,5 +1,5 @@
1
1
  module HotGlue
2
2
  class Version
3
- CURRENT = '0.6.14'
3
+ CURRENT = '0.6.15'
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.14
4
+ version: 0.6.15
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-02-28 00:00:00.000000000 Z
11
+ date: 2025-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails