hot-glue 0.6.27 → 0.6.29

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: a5a077658d795c25ef41694b36014191f2590351f6a1fa87e8419b049f03f5ad
4
- data.tar.gz: f2effbb98f5728fd70e2b7807903f86ad352a1dd3598562c3a450a804dcd51fb
3
+ metadata.gz: b2adecf8cc5b25919ee16219a6dbf4176a178a1a393adf6a79ae1370a9fe89a9
4
+ data.tar.gz: 0e02cf776a658911f19bc65f057eb60b57cb04e54a783883e6eb17cc05c0a2fb
5
5
  SHA512:
6
- metadata.gz: bc1d59497e67ba88e9da7305bfe5b2664874178243c744860bc30335a6f835808e784cf0b67533bf7c31166c48fdc4e5af0db55382623e9c07a3dc9f754beb81
7
- data.tar.gz: 6fbc0bfbc0cb9651802525f711566bf3b67ad9b34a4742600412c1addfe69fb20eab93a6bab363776a7eead66245fc120e22a554ecbd45303fafbdaaec49468f
6
+ metadata.gz: 7789fd5eae2defcc87512f2d10fb3e40c8c68c8ae33380ea072b80239b985edd4f3a1cb4593472fc468e084b4ff480c450ea6edc79384fa3a3013fede972aff6
7
+ data.tar.gz: 0c5ed6e3d2478c86c6bfa08ed0b4e0306ff9160673c557cb02e633509ce5e93d636b4bd36c11e5d955de5443e5945d71c23caca424979dc9cc0f6377e88b418a
data/Gemfile.lock CHANGED
@@ -1,9 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hot-glue (0.6.26.1)
4
+ hot-glue (0.6.28)
5
5
  ffaker (~> 2.16)
6
- kaminari (~> 1.2)
7
6
  rails (> 5.1)
8
7
 
9
8
  GEM
@@ -114,18 +113,6 @@ GEM
114
113
  importmap-rails (1.1.5)
115
114
  actionpack (>= 6.0.0)
116
115
  railties (>= 6.0.0)
117
- kaminari (1.2.2)
118
- activesupport (>= 4.1.0)
119
- kaminari-actionview (= 1.2.2)
120
- kaminari-activerecord (= 1.2.2)
121
- kaminari-core (= 1.2.2)
122
- kaminari-actionview (1.2.2)
123
- actionview
124
- kaminari-core (= 1.2.2)
125
- kaminari-activerecord (1.2.2)
126
- activerecord
127
- kaminari-core (= 1.2.2)
128
- kaminari-core (1.2.2)
129
116
  loofah (2.19.0)
130
117
  crass (~> 1.0.2)
131
118
  nokogiri (>= 1.5.9)
data/README.md CHANGED
@@ -1658,12 +1658,17 @@ bin/rails generate Book --include=name,author_id --search=set --search-fields=na
1658
1658
  ```
1659
1659
 
1660
1660
  ### `--phantom-search='{type}_{name}[All|choice A:scope_a|choice B:scope_b]`
1661
+ `--phantom-search='radio_{name}[All|choice A:scope_a|choice B:scope_b]`
1662
+ `--phantom-search='checkboxes_{name}[All|choice A:off_scope_a:on_scope_a|choice B:off_scope_b:on_scope_b]`
1663
+
1661
1664
 
1662
1665
  A phantom search is a search we are doing on this result set that doesn't correspond to a single field. Currently, the only available implementation is for scopes with no arguments, as in the example below. It is called 'phantom' because it could be (probably is) querying fields within the scope, but the search doesn't match up with a single field on your model. (So it's like creating 'phantom' criteria.). Only RADIO type is implemented, dropdown & checkboxes an a way to input a search value passed into the scope as an argument is TBD.
1663
1666
 
1664
- {type} is any of: radio, dropdown, checkboxes
1667
+ {type} is any of: radio, checkboxes (showing one of each type above)
1665
1668
 
1666
- {name} is a designation for this phantom search. Should NOT match any field name on your table. This should describe the kind of categorization we are performing.
1669
+ {name} is a designation for this phantom search.
1670
+ Should NOT match any field name on your table.
1671
+ This should describe the kind of categorization we are performing. Name is used for radio only; not shown to the user for checkboxes
1667
1672
 
1668
1673
  Your phantom search selector will be appended to the search fields and will be treated like a first-class search input, able to be combined with any of the other fields specified in a set search.
1669
1674
 
@@ -1676,11 +1681,16 @@ After the type & name, comes a block marked by square braces [ ... ]
1676
1681
 
1677
1682
  Within the square braces, each search option is separated by a pipe (|) character.
1678
1683
 
1679
- Within each option is a label and ruby scope, separated by a colon (:).
1684
+ Within each option is a label and either one ruby scope (for radios) or an OFF scope and ON scope (for checkboxes), separated by a colon (:).
1680
1685
 
1681
- The label comes before the colon the ruby scope. The ruby scope should be specified here without a dot. Each ruby scope must be defined on your model. If there is no scope specified, we assume "all", but we still need to specify a label for "All", which is why in the example above "All" has no colon after it.
1686
+ The label comes before the first colon the ruby scope. For checkboxes, you will have two colons followed by an "off" and "on scope'
1687
+ label:off scope:on scope
1682
1688
 
1683
- example
1689
+ The ruby scope can be specified with or without a dot.
1690
+
1691
+ Each ruby scope must be defined on your model. If there is no scope specified (empty), we assume "all", but we still need to specify a label for "All", which is why in the example above "All" has no colon after it.
1692
+
1693
+ #### Radio Example
1684
1694
 
1685
1695
  `--phantom-search='radio_status[Pending:pending|Rejected:rejected|Accepted:accepted|All]'`
1686
1696
 
@@ -1702,10 +1712,33 @@ This produces a search interface with four options listed as radio buttons:
1702
1712
 
1703
1713
  The pending, approved, and rejected options will return search results with the corresponding scopes applied. The 'All' option will behave as a no-op, leaving the root search intact (giving all of the other modifications that Hot glue provides in different functionality).
1704
1714
 
1705
- #### Predicate Search
1706
- NOT IMPLEMENTED YET
1707
- TODO: implement me
1715
+ ##### Checkboxes example
1716
+
1717
+ `rails generate hot_glue:scaffold Invoice --gd --phantom-search='checkboxes_AAA[With Paid:not_paid:|Hide free accounts::without_free_accounts]'`
1718
+
1719
+
1720
+ The syntax is similiar to the radio buttons except that each choice (within `[...]`, separated by `|`) is required to have THREE options, separated by colons `:`
1721
+ 1) the label
1722
+ 2) the OFF case (checkbox is unchecked)
1723
+ 3) the ON case (checkbox is checked)
1724
+
1725
+ The scope definition between the `:` characters **may be empty**, in which case this is interprested as "all"
1726
+
1727
+ Since checkboxes start as off (unchecked) by default, you can create layouts that show the normal case with the checkboxes off, but show special cases with the checkboxes on.
1728
+ (This can either exclude or include depending on your preference.)
1729
+
1730
+ In this Invoice scaffold, we have two scopes, searching for fields on our invoice model:
1731
+
1732
+ `scope :not_paid, -> {where(paid_at: nil)}`
1733
+ `scope :without_free_accounts, -> {where(free_account: false)}`
1734
+
1735
+ In the checkboxes phantom search we build above, notice by default:
1736
+
1737
+ - the PAID invoices do not appear in the search result (the scope `.not_paid` is applied as the OFF scope for the "With Paid" choice. So when you load the page, you see only unpaid invoices. If you check "With Paid" checkbox, there is no scope specified "all" is used indicating not modification is applied and all records are shown.
1738
+ - both free & non-free accounts (which are simply tracked by a boolean `free_account`) are shown by default, but when you use the "Hide free accounts" checkbox, the scope `.without_free_accounts` is applied, thus hiding the free accounts.
1708
1739
 
1740
+ Remember, unlike radio choices which apply exclusively (since the user can select only 1 radio choice at time), checkboxes create
1741
+ combined search criteria. These combine with all of the other search criteria within the search set, making one big "AND ... AND ... AND" query.
1709
1742
 
1710
1743
  ### `--stimmify` or `--stimmify=xyz`
1711
1744
 
@@ -2210,6 +2243,37 @@ These automatic pickups for partials are detected at build time. This means that
2210
2243
 
2211
2244
 
2212
2245
  # VERSION HISTORY
2246
+
2247
+ #### 2025-10-11 - v0.6.39
2248
+
2249
+ • When specifying a alt lookup in non-Gd mode, we treat this a security concern because alt lookups can get any related record from the database; if you use a factory when creating your object, you can pass the lookup to the factory and scope your lookup in there; fix to not raise exception when specified an alt lookup in non-Gd mode if you are also using a factory
2250
+
2251
+ • Attachments now have a graceful fail if the attachment is invariable (cannot be made into a thumbnail), and so there is no thumbnail to display. Instead, a small box with the file type ("pdf" or "msword") is shown in place where the thumbnail would display
2252
+
2253
+ • Adds a 'tripple' implementation for newer pagination gems: will_paginate and pagy. HG will auto detect which pagination gem you have in your Gemfile, and pick ONE of the three based on this preference order: Pagy over will_paginate; will_paginate over Kaminari, no pagination if none of the three are installed.
2254
+
2255
+ Kaminari is barely workable with newer Rails and seems somewhat abandoned; will_paginate is officially in maintenance mode, so Pagy is the way to go. I have implemented all three for the widest legacy support. On my Rails Cookbook pages, I have replaced Kaminari with Pagy.
2256
+
2257
+ Migrating a large app from Kaminari to Pagy:
2258
+
2259
+ - If you rip out Kaminari right away, it will be necessary to rebuild all of your Hot Glue controllers & views. On a large or customized app, this will be too tedious to do at once. Instead, contrary to the Pagy documentation, which encourages you to aggressively rip out the old gem (Kaminari), you can leave both gems in place, operating side-by-side. As you rebuild each scaffold controller by controller, newly built scaffolds will use Pagy, replacing the older Kaminari syntax.
2260
+
2261
+ • Hot Glue is now _OFFICIALLY dependency-free_! I've been building and working with Rails gems for years and years, and one of the interesting challenges that Rails 7 & 8 posed is that when the JavaScript and CSS delivery paradigms shift, it caused a massive atrophy of several old Rails gems. Codebases that relied on, for example, the old jquery-rails gem suddenly found themselves pantless. JS tool-only Gems are now discouraged, in favor of importmaps, propshaft, or JSBundling.
2262
+
2263
+ When you build a gem, the naive gem builder thinks to themselves: Let me pull in other people's tools to make my tool stand on the shoulders of giants.
2264
+
2265
+ But when paradigms shift, those gems the gem depends on become a blocker for your Gem moving forward.
2266
+
2267
+ I already had very few dependencies in Hot Glue — really just Rspec, Kaminari, and Rails itself. Although you need Turbo (and by extension JS), bootstrap is optional (but recommended), and Rspec is optional (but default).
2268
+
2269
+ The ONLY remaining dependency is ffaker (sorry!), which is necessary for the specs.
2270
+
2271
+ Hot Glue is a companion tool to Turbo itself. Where Turbo Rails goes, we go. Although this gem is primarily built for Bootstrap, Bootstrap remains officially optional. Although you need Turbo for it to work, how you bring Turbo is up to you (bundling, pinning, propshafting, etc). With the removal of Kaminari and new support for will_paginate and Pagy, I hope this Gem can be integrated into more apps who may already have chosen their pagination system.
2272
+
2273
+ #### 2025-09-26 - v0.6.28
2274
+ - Checkboxes option for Phantom Search (previously phantom searches only supported radio).
2275
+ See "Checkboxes example" under the docs for `--phantom-search` above
2276
+
2213
2277
  #### 2025-09-24 - v0.6.27
2214
2278
  - Fixes to namespaced models (this is when the model file has a namespace); it now correctly does not namespace the route (fix to plurality)
2215
2279
 
@@ -42,7 +42,16 @@ def spec_setup_and_change_act(which_partial = nil)
42
42
 
43
43
  def line_field_output
44
44
  thumbnail = attachment_data[:thumbnail]
45
-
46
- (thumbnail ? "<%= #{singular}.#{name}.attached? ? image_tag(#{singular}.#{name}.variant(:#{thumbnail})) : '' %>" : "")
45
+ if thumbnail
46
+ "<% if #{singular}.#{name}.attached? %>
47
+ <% if !#{singular}.#{name}.variable? %>
48
+ <span class=\"badge bg-secondary\"><%= #{singular}.#{name}.blob.content_type.split('/')[1] %></span>
49
+ <% else %>
50
+ <%= image_tag(#{singular}.#{name}.variant(:thumb)) %>
51
+ <% end %>
52
+ <% end %>"
53
+ else
54
+ ""
55
+ end
47
56
  end
48
57
  end
@@ -12,7 +12,7 @@ module HotGlue
12
12
  :search, :search_fields, :search_query_fields, :search_position,
13
13
  :form_path, :layout_object, :search_clear_button, :search_autosearch,
14
14
  :stimmify, :stimmify_camel, :hidden_create, :hidden_update, :invisible_create,
15
- :invisible_update, :plural, :phantom_search
15
+ :invisible_update, :plural, :phantom_search, :pagination_style
16
16
 
17
17
 
18
18
  def initialize(singular:, singular_class: ,
@@ -25,7 +25,8 @@ module HotGlue
25
25
  search:, search_fields:, search_query_fields: , search_position:,
26
26
  search_clear_button:, search_autosearch:, layout_object:,
27
27
  form_path: , stimmify: , stimmify_camel:, hidden_create:, hidden_update: ,
28
- invisible_create:, invisible_update: , plural: , phantom_search:)
28
+ invisible_create:, invisible_update: , plural: , phantom_search:,
29
+ pagination_style: )
29
30
 
30
31
 
31
32
  @form_path = form_path
@@ -66,6 +67,7 @@ module HotGlue
66
67
  @attachments = attachments
67
68
  @related_sets = related_sets
68
69
  @phantom_search = phantom_search
70
+ @pagination_style = pagination_style
69
71
  end
70
72
 
71
73
  def add_spaces_each_line(text, num_spaces)
@@ -149,22 +151,29 @@ module HotGlue
149
151
  # phantom searches
150
152
  @phantom_search.each_key do |search_field|
151
153
  data = @phantom_search[search_field]
152
- if data[:type] == "radio"
153
- res << "<div>"
154
+ res << "<div>"
155
+ res << "<label>#{data[:name]}</label><br />"
154
156
 
155
- res << "<label>#{data[:name]}</label><br />"
156
-
157
- data[:choices].each do |choice|
157
+ data[:choices].each do |choice|
158
+ dom_label = choice[:label].downcase.gsub(" ","_")
159
+ if data[:type] == "radio"
158
160
  res << "\n<input type='radio'
159
- id='#{search_field}_search__#{choice[:label]}'
160
- name='q[0][#{search_field}_search]' value='#{choice[:label]}'
161
- <%= 'checked' if @q['0'][:#{search_field}_search] == \"#{choice[:label]}\" %> />"
162
- res << "\n<label for='#{search_field}_search__#{choice[:label]}'>#{choice[:label]}</label> <br/>"
161
+ id='#{search_field}_search__#{dom_label}}'
162
+ name='q[0][#{search_field}_search]' value='#{dom_label}'
163
+ <%= 'checked' if @q['0'][:#{search_field}_search] == \"#{dom_label}\" %> />"
164
+ elsif data[:type] == "checkboxes"
165
+ res << "\n<input type='checkbox'
166
+ id='#{search_field}_search__#{dom_label}'
167
+ name='q[0][#{search_field}_search__#{dom_label}]'
168
+ value='1'
169
+ <%= 'checked' if @q['0'][:#{search_field}_search__#{dom_label}] %> />"
170
+
163
171
  end
172
+ res << "\n<label for='#{search_field}_search__#{dom_label}'>#{choice[:label]}</label> <br/>"
173
+ end
164
174
 
165
- res << "</div>"
175
+ res << "</div>"
166
176
 
167
- end
168
177
  end
169
178
 
170
179
 
@@ -259,7 +268,17 @@ module HotGlue
259
268
  def paginate(*args)
260
269
  plural = args[0][:plural]
261
270
 
262
- "<% if #{plural}.respond_to?(:total_pages) %><%= paginate(#{plural}) %> <% end %>"
271
+ if @pagination_style == "kaminari"
272
+ "<% if #{plural}.respond_to?(:total_pages) %><%= paginate(#{plural}) %> <% end %>"
273
+ elsif @pagination_style == "will_paginate"
274
+ "<% if #{plural}.respond_to?(:total_pages) %><%= will_paginate(#{plural}) %> <% end %>"
275
+ elsif @pagination_style == "pagy"
276
+ if !@layout_strategy == "bootstrap"
277
+ "<%== pagy_nav(@pagy, anchor_string: 'data-turbo-action=\"advance\"') %>"
278
+ else
279
+ "<%== pagy_bootstrap_nav(@pagy, anchor_string: 'data-turbo-action=\"advance\"') %>"
280
+ end
281
+ end
263
282
  end
264
283
 
265
284
 
@@ -166,6 +166,15 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
166
166
  @stimulus_syntax = true
167
167
  end
168
168
 
169
+
170
+ if Gem::Specification.find_all_by_name('pagy').any?
171
+ @pagination_style = 'pagy'
172
+ elsif Gem::Specification.find_all_by_name('will_paginate').any?
173
+ @pagination_style = 'will_paginate'
174
+ elsif Gem::Specification.find_all_by_name('kaminari').any?
175
+ @pagination_style = 'kaminari'
176
+ end
177
+
169
178
  if !options['markup'].nil?
170
179
  message = "Using --markup flag in the generator is deprecated; instead, use a file at config/hot_glue.yml with a key markup set to `erb` or `haml`"
171
180
  raise(HotGlue::Error, message)
@@ -704,7 +713,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
704
713
  raise "You specified an alt-lookup for #{key} but that field is not an association field"
705
714
  elsif !@columns_map[key.to_sym]
706
715
  raise "You specified an alt-lookup for #{key} but that field does not exist in the list of columns"
707
- elsif !@god && !@hawk_keys.include?(key.to_sym)
716
+ elsif !@god && !@hawk_keys.include?(key.to_sym) && !@factory_creation
708
717
  raise "You specified an alt-lookup for #{key} in non-Gd mode but this would leave the lookup unprotected. To fix, use with --hawk or with --factory-creation "
709
718
  end
710
719
  end
@@ -731,16 +740,30 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
731
740
  }
732
741
 
733
742
  choices.each do |choice|
734
- choice_label = choice.split(":")[0]
735
- choice_scope = choice.split(":")[1]
736
- if choice_scope.nil?
743
+ if type == "radio"
744
+ choice_label = choice.split(":")[0]
745
+ choice_scope = choice.split(":")[1]
746
+ elsif type == "checkboxes"
747
+ choice_label = choice.split(":")[0]
748
+ choice_scope_negative = choice.split(":")[1]
749
+ choice_scope = choice.split(":")[2]
750
+ end
751
+
752
+ if choice_scope.nil? || choice_scope.strip.empty?
737
753
  choice_scope = "all"
738
754
  end
739
755
 
756
+ if choice_scope_negative.nil? || choice_scope_negative.strip.empty?
757
+ choice_scope_negative = "all"
758
+ end
759
+
740
760
  choice_scope = ".#{choice_scope}" if !choice_scope.start_with?(".")
761
+ choice_scope_negative = ".#{choice_scope_negative}" if !choice_scope_negative.start_with?(".")
762
+
741
763
  @phantom_search[label.to_sym][:choices] << {
742
764
  label: choice_label,
743
765
  scope: choice_scope,
766
+ scope_negative: choice_scope_negative,
744
767
  }
745
768
  end
746
769
  puts "phantom search #{@phantom_search}"
@@ -831,7 +854,8 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
831
854
  hidden_update: @hidden_update,
832
855
  invisible_create: @invisible_create,
833
856
  invisible_update: @invisible_update,
834
- phantom_search: @phantom_search
857
+ phantom_search: @phantom_search,
858
+ pagination_style: @pagination_style
835
859
  )
836
860
  elsif @markup == "slim"
837
861
  raise(HotGlue::Error, "SLIM IS NOT IMPLEMENTED")
@@ -1434,10 +1458,10 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1434
1458
  def any_nested?
1435
1459
  @nested_set.any?
1436
1460
  end
1437
-
1438
- def all_objects_variable
1439
- all_objects_root + ".page(params[:page])"
1440
- end
1461
+ #
1462
+ # def all_objects_variable
1463
+ # all_objects_root + ".page(params[:page])"
1464
+ # end
1441
1465
 
1442
1466
  def auth_object
1443
1467
  @auth
@@ -1801,7 +1825,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1801
1825
  else
1802
1826
  if !@self_auth
1803
1827
 
1804
- res << spaces(4) + "@#{ plural_name } = #{ object_scope.gsub("@",'') }#{ n_plus_one_includes }#{record_scope}"
1828
+ res << spaces(4) + "@#{ plural_name } = #{ object_scope.gsub("@",'') }#{ n_plus_one_includes }#{record_scope}#{".all" if n_plus_one_includes.blank? && record_scope.blank? }"
1805
1829
 
1806
1830
  if @search_fields
1807
1831
  res << @search_fields.collect{ |field|
@@ -1834,15 +1858,36 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1834
1858
  end
1835
1859
 
1836
1860
  @phantom_search.each do |phantom_key, phantom_data|
1837
- phantom_data[:choices].each do |choice|
1838
- unless choice[:scope] == ".all"
1839
- res << "\n @#{plural} = @#{plural}#{choice[:scope]} if @q['0'][:#{phantom_key}_search] == \"#{choice[:label]}\""
1861
+ if phantom_data[:type] == "radio"
1862
+ phantom_data[:choices].each do |choice|
1863
+ unless choice[:scope] == ".all"
1864
+ res << "\n @#{plural} = @#{plural}#{choice[:scope]} if @q['0'][:#{phantom_key}_search] == \"#{choice[:label]}\""
1865
+ end
1866
+ end
1867
+ elsif phantom_data[:type] == "checkboxes"
1868
+ phantom_data[:choices].each do |choice|
1869
+
1870
+ # positive case
1871
+ unless choice[:scope] == ".all"
1872
+ res << "\n @#{plural} = @#{plural}#{choice[:scope]} if @q['0'][:#{phantom_key}_search__#{choice[:label].gsub(" ", "_").downcase}] == \"1\""
1873
+ end
1874
+ unless choice[:scope_negative] == ".all"
1875
+ res << "\n @#{plural} = @#{plural}#{choice[:scope_negative]} if @q['0'][:#{phantom_key}_search___#{choice[:label].gsub(" ", "_").downcase}] != \"1\""
1876
+ end
1840
1877
  end
1841
1878
  end
1879
+
1842
1880
  res << "\n"
1843
1881
  end
1844
1882
 
1845
- res << " @#{plural} = @#{plural}.page(params[:page])#{ ".per(per)" if @paginate_per_page_selector }"
1883
+
1884
+ if @pagination_style == "kaminari"
1885
+ res << " @#{plural} = @#{plural}.page(params[:page])#{ ".per(per)" if @paginate_per_page_selector }"
1886
+ elsif @pagination_style == "will_paginate"
1887
+ res << " @#{plural} = @#{plural}.paginate(page: params[:page], #{ ", per_page: per" if @paginate_per_page_selector })"
1888
+ elsif @pagination_style == "pagy"
1889
+ res << " @pagy, @#{plural} = pagy(@#{plural})"
1890
+ end
1846
1891
  res
1847
1892
  end
1848
1893
 
@@ -1907,12 +1952,24 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1907
1952
  }.reduce({}, :merge)
1908
1953
 
1909
1954
  phantom_search_fields = @phantom_search.collect{| k,v|
1910
- default = v[:choices][0]
1911
- {
1912
- "#{k}_match".to_sym => "",
1913
- "#{k}_search".to_sym => "#{default[:label]}"
1914
- }
1915
- }.reduce({}, :merge)
1955
+ if v[:type] == "radio"
1956
+ default = v[:choices][0]
1957
+ {
1958
+ "#{k}_match".to_sym => "",
1959
+ "#{k}_search".to_sym => "#{default[:label]}"
1960
+ }
1961
+ elsif v[:type] == "checkboxes"
1962
+ v[:choices].collect{ |c|
1963
+ {
1964
+ "#{k}_#{c[:label].gsub(" ", "_").downcase}".to_sym => ""
1965
+ }
1966
+ }
1967
+ end
1968
+ }
1969
+
1970
+ phantom_search_fields.flatten!
1971
+ phantom_search_fields = phantom_search_fields.reduce({}, :merge)
1972
+
1916
1973
  return {"0" => (default_fields.merge(phantom_search_fields))}
1917
1974
  end
1918
1975
  end
data/lib/hot-glue.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require "hotglue/engine"
2
- require 'kaminari'
3
2
 
4
3
  module HotGlue
5
4
  module TemplateBuilders
@@ -10,7 +9,6 @@ module HotGlue
10
9
  class Error < StandardError
11
10
  end
12
11
 
13
-
14
12
  def self.to_camel_case(str)
15
13
  words = str.split(/[^a-zA-Z0-9]/) # split by non-alphanumeric characters
16
14
  return '' if words.empty?
@@ -1,5 +1,5 @@
1
1
  module HotGlue
2
2
  class Version
3
- CURRENT = '0.6.27'
3
+ CURRENT = '0.6.29'
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.27
4
+ version: 0.6.29
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-09-24 00:00:00.000000000 Z
11
+ date: 2025-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '5.1'
27
- - !ruby/object:Gem::Dependency
28
- name: kaminari
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.2'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.2'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: ffaker
43
29
  requirement: !ruby/object:Gem::Requirement