hot-glue 0.7.3 → 0.7.4

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: 00062223cad2c1adb79987dc16eec8e5a1cb612f18106c6b01878346630737d7
4
- data.tar.gz: fd0fcf30cccc20b02e552d44628cf4856e08582338e296eea08699ff1318b85d
3
+ metadata.gz: bfc39c61887ed0298e7d1fe0f784e3071620275aa34f77047089d2a070de5cf1
4
+ data.tar.gz: 87ef37cb2b9f26efe20e912580f25b3d22f94ac035eaa760a926bff53fae3c0d
5
5
  SHA512:
6
- metadata.gz: 1ec04a5a3a6783caac2efc0035b409d9ac768a0d8094729b2f9551cdb363629f6433e24364a8caaaee675877ad996cbc51a219d666b9bfa05055143d372f3f77
7
- data.tar.gz: '028e4f5fc7cb0a490ee715df7201976f79d026ff8916b5b0c9568901e215b61f61d54d4987a2748f40d48b7f91620acf719f59f6d52ed586853de6756eaefd61'
6
+ metadata.gz: 010cfb6db2d191589d49cce82f3abe7bfb29e10326d60c66c4fb85fc212e6135fc3d240855ef023837e6da6f80ab63a045ff272c9738601b9ed4eb0ebc454bc8
7
+ data.tar.gz: a154009c019ba820e5145f1e3bf70e5ec15cd5d5c9330005d18d0f22751d2ba177f723f9ba2315350aa2ab5b1787944d484f822d6e76f72c53306b8773c42b23
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hot-glue (0.7.2)
4
+ hot-glue (0.7.3)
5
5
  ffaker (~> 2.16)
6
6
  rails (> 5.1)
7
7
 
data/README.md CHANGED
@@ -22,13 +22,13 @@ Hot Glue generates quick and dirty functionality. It lets you be crafty. However
22
22
  * Automatically reads your models (make them, add relationships, **and** migrate your database before building your scaffolding!)
23
23
  * Excellent for CREATE-READ-UPDATE-DELETE (CRUD), lists with pagination
24
24
  * Great for prototyping, but you should learn Rails fundamentals first.
25
- * 'Packaged' with Devise, Kaminari, Rspec
25
+ * Defaults to Devise & Rspec, but these are optional
26
+ * Use Pagy for pagination
26
27
  * Create system specs automatically along with the generated code.
27
28
  * Nest your routes model-by-model for built-in poor man's authentication.
28
29
  * Throw the scaffolding away when your app is ready to graduate to its next phase.
29
30
 
30
31
  How is it different than Rails scaffolding?
31
- 77
32
32
  Although inspired by the Rails scaffold generators (built-in to Rails), Hot Glue does something similiar but has made opinionated decisions that deviate from the normal Rails scaffold:
33
33
 
34
34
  1. The Hot Glue scaffolds are complete packages and are pre-optimized for 'edit-in-place' so that new and edit operations happen in-page smoothly.
@@ -2146,6 +2146,18 @@ https://jasonfleetwoodboldt.com/courses/rails-7-crash-course/rails-7-stimulus-js
2146
2146
  # SPECIAL FEATURES DISCUSSION
2147
2147
  This section discusses features that don't correspond to a single option or flag.
2148
2148
 
2149
+ ## PAGINATION
2150
+ - Although legacy support Kaminari and will_paginate exist, I recommend Pagy.
2151
+
2152
+ For Pagy version 9 or below
2153
+ 1. include the gem
2154
+ 2. in `config/initializers/pagy.rb` add `require 'pagy/extras/bootstrap'`
2155
+ 3. add `include Pagy::Backend` to ApplicationController
2156
+ 4. add `include Pagy::Frontend` to ApplicationHelper
2157
+
2158
+ For Pagy version 43 (there was a version jump)
2159
+ *NOT YET COMPATIBLE WITH PAGY 43*
2160
+ TODO: implement pagy 43
2149
2161
 
2150
2162
  ## "Thing" Label
2151
2163
 
@@ -2461,11 +2473,21 @@ The `within` partials should do operations within the form (like hidden fields),
2461
2473
  These automatic pickups for partials are detected at build time. This means that if you add these partials later, you must rebuild your scaffold.
2462
2474
 
2463
2475
 
2476
+
2477
+
2478
+
2464
2479
  # VERSION HISTORY
2465
2480
 
2466
- #### 2025-12-24 - v0.7.3
2467
2481
 
2468
- `--list-back-link-to-parent` (default: false)
2482
+ #### 2025-12-28 - v0.7.4
2483
+ • `--list-back-link-to-parent` has been renamed `--back-link-to-parent`
2484
+ • something was wrong with non-nested scaffolder calling `parent_resource_name` — thor invoked this method even when it wasn't called; it has been moved into a helper to prevent this
2485
+ • Check to only support Pagy version 9 or below; Pagy 43 has breaking changes and cannot yet be used (coming soon)
2486
+
2487
+
2488
+ #### 2025-12-24 - v0.7.3
2489
+ (previously `--list-back-link-to-parent`; release notes retroactively edited)
2490
+ `--back-link-to-parent` (default: false)
2469
2491
 
2470
2492
  If the parent is itself a big edit, and we got to the nested edit (also a big edit) through a tab showing subview list (loaded lazily via Turbo's built-in mechanism),
2471
2493
  then we don't typically want the "back to" link at the top of the edit page to take us back to the list of the current object.
@@ -2474,7 +2496,7 @@ That's because although the list of the current object exists as its own page, i
2474
2496
 
2475
2497
  The user came to _this_ edit page from the parent's edit page, so we should go back to the parent's edit page.
2476
2498
 
2477
- Use `--list-back-link-to-parent` to tell this build to use a "Back to ____" link at the top of the edit page (where ____ is the name of the parent)
2499
+ Use `--back-link-to-parent` to tell this build to use a "Back to ____" link at the top of the edit page (where ____ is the name of the parent)
2478
2500
 
2479
2501
  Otherwise, the link at the top of the edit page will read "Back to list" and take the user back to the list view of the current build.
2480
2502
 
@@ -0,0 +1,6 @@
1
+ module GeneratorHelpers
2
+
3
+ def parent_resource_name
4
+ @nested_set.last[:singular]
5
+ end
6
+ end
@@ -10,9 +10,12 @@ require_relative './layout_strategy/base'
10
10
  require_relative './layout_strategy/bootstrap'
11
11
  require_relative './layout_strategy/hot_glue'
12
12
  require_relative './layout_strategy/tailwind'
13
+ require_relative './helpers/generator_helpers'
14
+
13
15
 
14
16
  class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
15
17
  include DefaultConfigLoader
18
+ include GeneratorHelpers
16
19
  hook_for :form_builder, :as => :scaffold
17
20
 
18
21
  source_root File.expand_path('templates', __dir__)
@@ -31,7 +34,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
31
34
  :search_clear_button, :search_autosearch, :include_object_names,
32
35
  :stimmify, :stimmify_camel, :hidden_create, :hidden_update,
33
36
  :invisible_create, :invisible_update, :phantom_create_params,
34
- :phantom_update_params, :lazy, :list_back_link_to_parent
37
+ :phantom_update_params, :lazy, :back_link_to_parent
35
38
  # important: using an attr_accessor called :namespace indirectly causes a conflict with Rails class_name method
36
39
  # so we use namespace_value instead
37
40
 
@@ -130,7 +133,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
130
133
  class_option :search_position, default: 'vertical' # choices are vertical or horizontal
131
134
  class_option :search_clear_button, default: false
132
135
  class_option :search_autosearch, default: false
133
- class_option :list_back_link_to_parent, default: nil
136
+ class_option :back_link_to_parent, default: nil
134
137
 
135
138
 
136
139
  # FOR THE PREDICATE SEARCH
@@ -171,7 +174,12 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
171
174
 
172
175
 
173
176
  if Gem::Specification.find_all_by_name('pagy').any?
174
- @pagination_style = 'pagy'
177
+ if Gem::Specification.find_all_by_name('pagy').first.version.to_s.split(".").first.to_i <= 9
178
+ @pagination_style = 'pagy9'
179
+ else
180
+ raise "Pagy version 43 not yet compatible"
181
+ @pagination_style = 'pagy43'
182
+ end
175
183
  elsif Gem::Specification.find_all_by_name('will_paginate').any?
176
184
  @pagination_style = 'will_paginate'
177
185
  elsif Gem::Specification.find_all_by_name('kaminari').any?
@@ -494,7 +502,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
494
502
  @include_object_names = options['include_object_names'] || get_default_from_config(key: :include_object_names)
495
503
 
496
504
 
497
- @list_back_link_to_parent = options['list_back_link_to_parent'] || false
505
+ @back_link_to_parent = options['back_link_to_parent'] || false
498
506
 
499
507
  if @god
500
508
  # @auth = nil
@@ -1377,9 +1385,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1377
1385
  end
1378
1386
  end
1379
1387
 
1380
- def parent_object_name
1381
- @nested_set.last[:singular]
1382
- end
1388
+
1383
1389
 
1384
1390
  def datetime_fields_list
1385
1391
  @columns.each_with_object({}) do |col, hash|
@@ -6,8 +6,8 @@
6
6
  <div class="row">
7
7
  <div class="col-md-12">
8
8
 
9
- <% if @list_back_link_to_parent %>
10
- <\%= link_to "&#11013;&#65039; Back to <%= parent_object_name %>".html_safe, <%= edit_parent_path_helper(true) %> %>
9
+ <% if @back_link_to_parent %>
10
+ <\%= link_to "&#11013;&#65039; Back to <%= parent_resource_name %>".html_safe, <%= edit_parent_path_helper(true) %> %>
11
11
  <% else %>
12
12
  <\%= link_to "&#11013;&#65039; Back to list".html_safe, <%= path_helper_plural(true) %> %>
13
13
  <% end %>
@@ -1,5 +1,5 @@
1
1
  module HotGlue
2
2
  class Version
3
- CURRENT = '0.7.3'
3
+ CURRENT = '0.7.4'
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.7.3
4
+ version: 0.7.4
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-12-24 00:00:00.000000000 Z
11
+ date: 2025-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -82,6 +82,7 @@ files:
82
82
  - lib/generators/hot_glue/fields/time_field.rb
83
83
  - lib/generators/hot_glue/fields/uuid_field.rb
84
84
  - lib/generators/hot_glue/flash_notices_install_generator.rb
85
+ - lib/generators/hot_glue/helpers/generator_helpers.rb
85
86
  - lib/generators/hot_glue/hot_glue.rb
86
87
  - lib/generators/hot_glue/install_generator.rb
87
88
  - lib/generators/hot_glue/layout/builder.rb