hot-glue 0.6.4 → 0.6.5

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: 1dba1b859e4d938e78c7b52783d63bdbda1a777443cfd3ffaa563b09d30e87d8
4
- data.tar.gz: a4ca56dc9f3d29b3824ec5f9d305c1bca3ec54ea500cc9d5e334a294affd9449
3
+ metadata.gz: e3eed7ea3e4a53cd699a7c6dcbc3b3ddc32daaaa2d4c2c1404b273a558c56164
4
+ data.tar.gz: 1969aecb3e38316da444557cc636aeb4b199bcabf74230212abf4a0c0b50039f
5
5
  SHA512:
6
- metadata.gz: e04f745ed5b0c699ef10ba60bb0aad77f8870720ffaea550976901342c6289e031a565fbc2c663555db7fed1fd98678ac58c594ba0dc191558b05e3fc3852261
7
- data.tar.gz: 280916089abee5264deda93738c2cf5922da5da90eaffb268959f403d091019e851980e59130938ba5cede468217e40f8b69a0bfd55b673a390096eec92d944e
6
+ metadata.gz: c68c27d95ed2359a8f8518aac33dbbf363cfd86b97252849445750680a4f04bf0caad6bf70639c35392baf9212e1f4224c1dec9a9658ab7a4e02b03ef2787bdf
7
+ data.tar.gz: ba2e7f93b676bb2e50b2ebb96b4d88b1f8153c6fbd6aef119c17585ac6ad623030604927224e78da5df2510280ccb275250a9eab9e6d8304c3adef391141d1a5
@@ -35,7 +35,7 @@ jobs:
35
35
  - name: Checkout code
36
36
  uses: actions/checkout@v3
37
37
  - name: Install Ruby and gems
38
- uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
38
+ uses: ruby/setup-ruby@v1 # v1.146.0
39
39
  with:
40
40
  bundler-cache: true
41
41
 
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.2
1
+ 3.2.4
data/Gemfile.lock CHANGED
@@ -255,6 +255,7 @@ GEM
255
255
  PLATFORMS
256
256
  arm64-darwin-21
257
257
  arm64-darwin-22
258
+ arm64-darwin-23
258
259
  x86_64-linux
259
260
 
260
261
  DEPENDENCIES
data/README.md CHANGED
@@ -62,7 +62,8 @@ Instantly get a simple CRUD interface
62
62
  # Getting Started Video
63
63
  [Hot Glue Getting Started (JSBundling)](https://www.youtube.com/watch?v=bzpXOhBkiDk)
64
64
 
65
- _If you are on Rails 6, see [LEGACY SETUP FOR RAILS 6](https://github.com/jasonfb/hot-glue/README2.md) and complete those steps FIRST._
65
+ _If you are on Rails 6, see [LEGACY SETUP FOR RAILS 6](https://github.com/hot-glue-for-rails/hot-glue/blob/main/README2.md) and complete those steps FIRST._
66
+
66
67
 
67
68
  ## The Super-Quick Setup
68
69
  https://jasonfleetwoodboldt.com/courses/stepping-up-rails/jason-fleetwood-boldts-rails-cookbook/hot-glue-quick-install-mega-script/
@@ -113,7 +114,7 @@ To run Turbo (which Hot Glue requires), you must either (1) be running an Import
113
114
 
114
115
  (For the old method of installing Bootstrap [see this post](https://jasonfleetwoodboldt.com/courses/stepping-up-rails/rails-7-bootstrap/))
115
116
 
116
- (Remember, for Rails 6 you must go through the [LEGACY SETUP FOR RAILS 6](https://github.com/jasonfb/hot-glue/blob/main/README2.md) before continuing.)
117
+ (Remember, for Rails 6 you must go through the [LEGACY SETUP FOR RAILS 6](https://github.com/hot-glue-for-rails/hot-glue/blob/main/README2.md) before continuing.)
117
118
 
118
119
 
119
120
  ### 2. ADD RSPEC, FACTORY-BOT, AND FFAKER
@@ -681,13 +682,15 @@ You will need to separately specify them as show-only if you want them to be non
681
682
 
682
683
  Notice that each modifiers can be used with specific field types.
683
684
 
684
- | user modifier | what it does | Field types | | |
685
- |-------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|---|---|
686
- | $ | wraps output in `number_to_currency()` | floats and integers | | |
685
+ | user modifier | what it does | Field types | | |
686
+ |-------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|---|---|
687
+ | $ | wraps output in `number_to_currency()` | floats and integers | | |
687
688
  | (truthy label)\|(falsy label) | specify a binary switch with a pipe (\|) character if the value is truthy, it will display as "truthy label" if the value is falsy, it will display as "falsy label" | booleans, datetimes, dates, times | | |
688
- | partials | applies to enums only, you must have a partial whose name matches each enum type | enums only | | |
689
- | tinymce | applies to text fields only, be sure to setup TineMCE globally | text fields only | | |
690
- | typeahead | turns a foreign key (only) into a searchable typeahead field | foreign keys only | | |
689
+ | partials | applies to enums only, you must have a partial whose name matches each enum type | enums only | | |
690
+ | tinymce | applies to text fields only, be sure to setup TineMCE globally | text fields only | | |
691
+ | typeahead | turns a foreign key (only) into a searchable typeahead field | foreign keys only | | |
692
+ | timezone | turns a string (varchar) into a drop down of timezones | foreign keys only | | |
693
+
691
694
 
692
695
  Except for "(truthy label)" and "(falsy label)" which use the special syntax, use the modifier _exactly_ as it is named.
693
696
 
@@ -1612,6 +1615,19 @@ These automatic pickups for partials are detected at buildtime. This means that
1612
1615
 
1613
1616
  # VERSION HISTORY
1614
1617
 
1618
+ #### 2024-10-11 - v0.6.5
1619
+ • Adds timezone support as a modify option
1620
+
1621
+ `--modify='time_zone{timezone}'`
1622
+
1623
+ Note that this is a string field that will be displayed as a dropdown list of timezones using the rails `time_zone_select` helper.
1624
+
1625
+ Unlike the previous implementation which used `timezone`, this one uses the Rails locale names as provided by the `name` method returned from the `ActiveSupport::TimeZone` object.
1626
+
1627
+ • Fixes redisplay issue on big edit
1628
+
1629
+ • Fix for time parsing
1630
+
1615
1631
 
1616
1632
  #### 2024-08-08 - v0.6.4 (renumbered v 6.0.3.3)
1617
1633
 
@@ -2309,3 +2325,9 @@ To run only the internal specs, use
2309
2325
 
2310
2326
  Internal Test coverage as of 2023-10-15 (v0.5.24)
2311
2327
  All Files ( 86.29% covered at 75.64 hits/line )
2328
+
2329
+
2330
+ ### Reference
2331
+
2332
+ https://stackoverflow.com/questions/78313570/unable-to-bundle-install-nio4r-on-a-new-mac-m3
2333
+
@@ -70,7 +70,6 @@ module HotGlue
70
70
 
71
71
  def modify_date_inputs_on_params(modified_params, current_user_object = nil, field_list = nil)
72
72
  use_offset = (current_user_object.try(:timezone)) || server_timezone_offset
73
-
74
73
  modified_params = modified_params.tap do |params|
75
74
  params.keys.each{|k|
76
75
 
@@ -81,18 +80,14 @@ module HotGlue
81
80
  end
82
81
  if include_me
83
82
  if use_offset != 0
84
- puts "changing #{params[k]}"
83
+ zone = DateTime.now.in_time_zone(use_offset).zone
85
84
 
86
85
  if use_offset.is_a? String
87
- puts "parsing #{use_offset}"
88
- zone = DateTime.now.in_time_zone(use_offset).zone
89
86
  params[k] = DateTime.parse(params[k].gsub("T", " ") + " #{zone}")
90
87
  else
91
- puts "parsing #{use_offset}"
92
- params[k] = DateTime.strptime("#{params[k]} #{use_offset}", '%Y-%m-%dT%H:%M %z').new_offset(0)
88
+ parse_date = "#{params[k].gsub("T", " ")} #{zone}"
89
+ params[k] = Time.strptime(parse_date, "%Y-%m-%d %H:%M:%S %Z")
93
90
  end
94
- puts "changed #{params[k]}"
95
-
96
91
  end
97
92
  end
98
93
  }
@@ -137,6 +137,8 @@ class Field
137
137
  res += "<%= #{singular}.#{name} ? '#{modify_as[:binary][:truthy]}' : '#{modify_as[:binary][:falsy]}' %>"
138
138
  elsif modify_as[:tinymce]
139
139
 
140
+ elsif modify_as[:timezone]
141
+ res += "<%= #{singular}.#{name} %>"
140
142
  elsif modify_as[:enum]
141
143
  res += "<%= render partial: #{singular}.#{name}, locals: {#{singular}: #{singular}} %>"
142
144
  end
@@ -153,7 +155,11 @@ class Field
153
155
  end
154
156
 
155
157
  def field_output(type = nil, width )
156
- " <%= f.text_field :#{name}, value: #{singular}.#{name}, autocomplete: 'off', size: #{width}, class: 'form-control', type: '#{type}'" + (form_placeholder_labels ? ", placeholder: '#{name.to_s.humanize}'" : "") + " %>\n " + "\n"
158
+ if modify_as && modify_as[:timezone]
159
+ "<%= f.time_zone_select :#{name}, ActiveSupport::TimeZone.all, {}, {class: 'form-control'} %>"
160
+ else
161
+ " <%= f.text_field :#{name}, value: #{singular}.#{name}, autocomplete: 'off', size: #{width}, class: 'form-control', type: '#{type}'" + (form_placeholder_labels ? ", placeholder: '#{name.to_s.humanize}'" : "") + " %>\n " + "\n"
162
+ end
157
163
  end
158
164
 
159
165
  def text_area_output(field_length, extra_classes: "")
@@ -258,6 +258,8 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
258
258
  @modify_as[key.to_sym] = {tinymce: 1, badges: $3}
259
259
  elsif $2 == "typeahead"
260
260
  @modify_as[key.to_sym] = {typeahead: 1, badges: $3}
261
+ elsif $2 == "timezone"
262
+ @modify_as[key.to_sym] = {timezone: 1, badges: $3}
261
263
  else
262
264
  raise "unknown modification direction #{$2}"
263
265
  end
@@ -1175,7 +1177,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1175
1177
  def copy_view_files
1176
1178
  return if @specs_only
1177
1179
  @edit_within_form_partial = File.exist?("#{filepath_prefix}app/views#{namespace_with_dash}/#{@controller_build_folder}/_edit_within_form.html.#{@markup}")
1178
- @edit_after_form_partial = File.exist?("#{filepath_prefix}app/views#{namespace_with_dash}/#{@controller_build_folder}/_edit_within_form.html.#{@markup}")
1180
+ @edit_after_form_partial = File.exist?("#{filepath_prefix}app/views#{namespace_with_dash}/#{@controller_build_folder}/_edit_after_form.html.#{@markup}")
1179
1181
  @new_within_form_partial = File.exist?("#{filepath_prefix}app/views#{namespace_with_dash}/#{@controller_build_folder}/_new_within_form.html.#{@markup}")
1180
1182
  @new_after_form_partial = File.exist?("#{filepath_prefix}app/views#{namespace_with_dash}/#{@controller_build_folder}/_new_within_form.html.#{@markup}")
1181
1183
  @index_before_list_partial = File.exist?("#{filepath_prefix}app/views#{namespace_with_dash}/#{@controller_build_folder}/_index_before_list.html.#{@markup}")
@@ -73,7 +73,8 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
73
73
  end<% end %>
74
74
  <% unless @no_list %>
75
75
  def load_all_<%= plural %>
76
- <%= load_all_code %> end
76
+ <%= load_all_code %>
77
+ end
77
78
 
78
79
  def index<% if @search == "set" %>
79
80
  @q = params[:q] || <%= {"0" => @search_fields.collect{|foo|
@@ -185,15 +186,16 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
185
186
  <% if @display_list_after_update %> load_all_<%= plural %><% end %>
186
187
  flash[:notice] << "Saved #{@<%= singular %>.<%= display_class %>}"
187
188
  flash[:alert] = @hawk_alarm if @hawk_alarm
188
- render :update
189
+ <% unless @big_edit %>render :update, status: :unprocessable_entity<% else %>redirect_to <%= @namespace %>_<%= @plural %>_path<% end %>
189
190
  else
190
191
  flash[:alert] = "<%= singular_name.titlecase %> could not be saved. #{@hawk_alarm}"
191
192
  @action = 'edit'
192
- render :update, status: :unprocessable_entity
193
+ <% unless @big_edit %>render :update<% else %>render :edit<% end %>, status: :unprocessable_entity
193
194
  end<% if @pundit %>
194
195
  rescue Pundit::NotAuthorizedError
195
196
  flash[:alert] = "Updating #{@<%= singular_name %>.<%= display_class %>} not authorized. "
196
- render :update<% end %>
197
+ <% unless @big_edit %>render :update<% else %>render :edit<% end %>, status: :unprocessable_entity
198
+ <% end %>
197
199
  end
198
200
 
199
201
  <% end %><% if destroy_action %> def destroy
@@ -8,6 +8,6 @@
8
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 %> \%>
9
9
  <% if @edit_within_form_partial %><\%= render partial: "edit_within_form", locals: {f: f, <%= singular %>: <%= singular %>}<%= @nested_set.collect{|arg| ".merge(#{arg[:singular]} ? {#{arg[:singular]}: #{arg[:singular]}} : {})" }.join %> %><% end %>
10
10
  <\% end %>
11
- <% if @edit_within_form_partial %><\%= render partial: "edit_after_form", locals: {<%= singular %>: <%= singular %>}<%= @nested_set.collect{|arg| ".merge(#{arg[:singular]} ? {#{arg[:singular]}: #{arg[:singular]}} : {})" }.join %> %><% end %>
11
+ <% if @edit_after_form_partial %><\%= render partial: "edit_after_form", locals: {<%= singular %>: <%= singular %>}<%= @nested_set.collect{|arg| ".merge(#{arg[:singular]} ? {#{arg[:singular]}: #{arg[:singular]}} : {})" }.join %> %><% end %>
12
12
  </div>
13
13
  <\% end %>
@@ -1,3 +1,3 @@
1
1
  <\%= turbo_stream.replace "<%= @namespace %>__#{dom_id(<%= singular %>)}" do %>
2
- <\%= render 'edit', locals: {<%= singular %>: @<%= singular %><%= @nested_set.collect{|arg| ", #{arg[:singular]}: @#{arg[:singular]}} " }.join("") %> %>
2
+ <\%= render 'edit', locals: { <%= singular %>: @<%= singular %><%= @nested_set.collect{|arg| ", #{arg[:singular]}: @#{arg[:singular]} " }.join("") %> } %>
3
3
  <\% end %>
@@ -1,5 +1,5 @@
1
1
  module HotGlue
2
2
  class Version
3
- CURRENT = '0.6.4'
3
+ CURRENT = '0.6.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.6.4
4
+ version: 0.6.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: 2024-08-08 00:00:00.000000000 Z
11
+ date: 2024-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
176
  - !ruby/object:Gem::Version
177
177
  version: '0'
178
178
  requirements: []
179
- rubygems_version: 3.5.7
179
+ rubygems_version: 3.4.19
180
180
  signing_key:
181
181
  specification_version: 4
182
182
  summary: A gem to build Turbo Rails scaffolding.