hot-glue 0.7.2 → 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 +4 -4
- data/Gemfile.lock +1 -1
- data/LICENSE +0 -4
- data/README.md +45 -5
- data/lib/generators/hot_glue/helpers/generator_helpers.rb +6 -0
- data/lib/generators/hot_glue/scaffold_generator.rb +18 -4
- data/lib/generators/hot_glue/templates/erb/edit.erb +6 -1
- data/lib/hotglue/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bfc39c61887ed0298e7d1fe0f784e3071620275aa34f77047089d2a070de5cf1
|
|
4
|
+
data.tar.gz: 87ef37cb2b9f26efe20e912580f25b3d22f94ac035eaa760a926bff53fae3c0d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 010cfb6db2d191589d49cce82f3abe7bfb29e10326d60c66c4fb85fc212e6135fc3d240855ef023837e6da6f80ab63a045ff272c9738601b9ed4eb0ebc454bc8
|
|
7
|
+
data.tar.gz: a154009c019ba820e5145f1e3bf70e5ec15cd5d5c9330005d18d0f22751d2ba177f723f9ba2315350aa2ab5b1787944d484f822d6e76f72c53306b8773c42b23
|
data/Gemfile.lock
CHANGED
data/LICENSE
CHANGED
|
@@ -9,9 +9,5 @@ The above copyright notice and this permission notice shall be included in all c
|
|
|
9
9
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
TO PURCHASE A COMMERCIAL USAGE LICENSE PLEASE VISIT
|
|
14
|
-
https://heliosdev.shop/hot-glue-license
|
|
15
|
-
|
|
16
12
|
OR PURCHASE THE TUTORIALS AT
|
|
17
13
|
https://school.jasonfleetwoodboldt.com/8188/?utm_source=github.com
|
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
|
-
*
|
|
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,10 +2473,35 @@ 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
2481
|
|
|
2467
|
-
#### 2025-12-
|
|
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)
|
|
2491
|
+
|
|
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),
|
|
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.
|
|
2494
|
+
|
|
2495
|
+
That's because although the list of the current object exists as its own page, it isn't in the normal flow of what the user sees (it is via a lazy-loaded subview).
|
|
2496
|
+
|
|
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.
|
|
2498
|
+
|
|
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)
|
|
2500
|
+
|
|
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.
|
|
2502
|
+
|
|
2503
|
+
|
|
2504
|
+
#### 2025-12-12 - v0.7.2
|
|
2468
2505
|
- Using the object (of the scaffold being built) inside of the hawk now adds `@` to a variable named as the singular name of the scaffold;
|
|
2469
2506
|
see "Using the object inside of the hawk"
|
|
2470
2507
|
- error catching for missing parent relationships
|
|
@@ -2485,7 +2522,7 @@ These automatic pickups for partials are detected at build time. This means that
|
|
|
2485
2522
|
|
|
2486
2523
|
Hot Glue already has a robust set of tools to provide field-by-field access control, hiding or turning visible-only fields by multiple methods, described under Access Control & Field Visibility Features.
|
|
2487
2524
|
|
|
2488
|
-
Remember that Hot Glue's opinionated design has two ways a field is displayed: show (which appears on the list view and is always just viewable), and form (which is
|
|
2525
|
+
Remember that Hot Glue's opinionated design has two ways a field is displayed: show (which appears on the list view and is always just viewable), and form (which is used by both the new and edit actions to display a form). Within the `form` output, the form might be used for either new or edit, and further refinements can be applied to new or edit.
|
|
2489
2526
|
|
|
2490
2527
|
Here's a quick review those methods now:
|
|
2491
2528
|
|
|
@@ -2515,10 +2552,13 @@ Here's a quick review those methods now:
|
|
|
2515
2552
|
Today, with v0.7 of this gem, I'm introducing three more features that are all available from within the `--include` setting.
|
|
2516
2553
|
|
|
2517
2554
|
• Omitted fields: using `-` is omit on list & show; use `=` to omit the field on the form (new & edit)
|
|
2555
|
+
|
|
2518
2556
|
• Dynamic blocks (which can also be omitted using
|
|
2557
|
+
|
|
2519
2558
|
• Set column widths when using specified grouping made (--include contains `:`)
|
|
2520
2559
|
|
|
2521
|
-
For details, see "Layout & Manipulation Features"
|
|
2560
|
+
For details, see "Omitted fields", "Dynamic Blocks", and "Omitted Dynamic Blocks" in the "Layout & Manipulation Features"
|
|
2561
|
+
(those three features were introduced in v0.7)
|
|
2522
2562
|
|
|
2523
2563
|
|
|
2524
2564
|
|
|
@@ -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
|
|
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,6 +133,8 @@ 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
|
|
136
|
+
class_option :back_link_to_parent, default: nil
|
|
137
|
+
|
|
133
138
|
|
|
134
139
|
# FOR THE PREDICATE SEARCH
|
|
135
140
|
# TDB
|
|
@@ -169,7 +174,12 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
|
169
174
|
|
|
170
175
|
|
|
171
176
|
if Gem::Specification.find_all_by_name('pagy').any?
|
|
172
|
-
|
|
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
|
|
173
183
|
elsif Gem::Specification.find_all_by_name('will_paginate').any?
|
|
174
184
|
@pagination_style = 'will_paginate'
|
|
175
185
|
elsif Gem::Specification.find_all_by_name('kaminari').any?
|
|
@@ -492,6 +502,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
|
492
502
|
@include_object_names = options['include_object_names'] || get_default_from_config(key: :include_object_names)
|
|
493
503
|
|
|
494
504
|
|
|
505
|
+
@back_link_to_parent = options['back_link_to_parent'] || false
|
|
495
506
|
|
|
496
507
|
if @god
|
|
497
508
|
# @auth = nil
|
|
@@ -1056,6 +1067,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
|
1056
1067
|
|
|
1057
1068
|
if @object_owner_sym && !@self_auth
|
|
1058
1069
|
auth_assoc_field = auth_assoc + "_id" unless @god
|
|
1070
|
+
|
|
1059
1071
|
assoc = eval("#{singular_class}.reflect_on_association(:#{@object_owner_sym})")
|
|
1060
1072
|
|
|
1061
1073
|
if assoc
|
|
@@ -1362,17 +1374,19 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
|
1362
1374
|
top_level: top_level)
|
|
1363
1375
|
end
|
|
1364
1376
|
|
|
1365
|
-
def edit_parent_path_helper
|
|
1377
|
+
def edit_parent_path_helper(top_level = false)
|
|
1366
1378
|
# the path to the edit route of the PARENT
|
|
1367
1379
|
if @nested_set.any? && @nested
|
|
1368
1380
|
"edit_#{@namespace + "_" if @namespace}#{(@nested_set.collect { |x| x[:singular] }.join("_") + "_" if @nested_set.any?)}path(" +
|
|
1369
|
-
"#{@nested_set.collect { |x| x[:singular] }.join(", ")}" + ")"
|
|
1381
|
+
"#{@nested_set.collect { |x| (top_level ? "@": "" ) + x[:singular] }.join(", ")}" + ")"
|
|
1370
1382
|
|
|
1371
1383
|
else
|
|
1372
1384
|
"edit_#{@namespace + "_" if @namespace}path"
|
|
1373
1385
|
end
|
|
1374
1386
|
end
|
|
1375
1387
|
|
|
1388
|
+
|
|
1389
|
+
|
|
1376
1390
|
def datetime_fields_list
|
|
1377
1391
|
@columns.each_with_object({}) do |col, hash|
|
|
1378
1392
|
column = @the_object.columns_hash[col.to_s]
|
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
<div class="container">
|
|
6
6
|
<div class="row">
|
|
7
7
|
<div class="col-md-12">
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
<% if @back_link_to_parent %>
|
|
10
|
+
<\%= link_to "⬅️ Back to <%= parent_resource_name %>".html_safe, <%= edit_parent_path_helper(true) %> %>
|
|
11
|
+
<% else %>
|
|
12
|
+
<\%= link_to "⬅️ Back to list".html_safe, <%= path_helper_plural(true) %> %>
|
|
13
|
+
<% end %>
|
|
9
14
|
<% end %>
|
|
10
15
|
<\%= render partial: "edit", locals: {<%= singular %>: @<%= singular %><%= @nested_set.any? ? ", " + (@nested_set.collect{|x| "#{x[:singular]}: @#{x[:singular]}"}.join(", ") ) : "" %>} %>
|
|
11
16
|
<% if @big_edit %>
|
data/lib/hotglue/version.rb
CHANGED
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.
|
|
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-
|
|
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
|
|
@@ -139,7 +140,7 @@ files:
|
|
|
139
140
|
- script/test
|
|
140
141
|
homepage: https://heliosdev.shop/p/hot-glue?utm_source=rubygems.org&utm_campaign=rubygems_link
|
|
141
142
|
licenses:
|
|
142
|
-
-
|
|
143
|
+
- MIT
|
|
143
144
|
metadata:
|
|
144
145
|
source_code_uri: https://github.com/hot-glue-for-rails/hot-glue
|
|
145
146
|
homepage: https://heliosdev.shop/hot-glue
|