Releases: hot-glue-for-rails/hot-glue
v0.6.11 - Typeahead with nested features for scoping results, more flags
• Typeahead now can use --auth, --auth-identifier, --namespace, and --nested
• Works similar to how same flags work on scaffold generator. (Notice that the typeahead generator is a completely separate generator).
• When using nested, your results are scoped the parent objects in the nest chain (which is the last one)
e.g.
bin/rails generate hot_glue:scaffold Member --namespace=account_dashboard --nested=account/room --auth='current_user' --auth-identifier='user' --modify='user_id{typeahead}[account]'
here the user_id
field on members will use a typeahead under 1 parent: account
(even though this scaffold is under two parents: account/room, the typeahead is built only with --nested=account
as shown below)
The scaffold expects the typeahead to be in the same namespace (in this case account_dashboard
).
The current_user
object is the auth root, so the account in the nest chain must belong to the current_user. As well, account must have many rooms and the rooms must have many members (the room must belong to the account and the member will automatically belong to the parent room)
This would be used in conjunction with a typeahead built within the same namespace:
bin/rails generate hot_glue:typeahead User --namespace='account_dashboard' --nested='account' --auth-identifier='user' --auth='current_user'
Notice that the scaffold controller for Member operates two levels deep in the nest chain (account/room) but the Typeahead controller operates only 1 level deep in the same nest chain and also the same namespace (account). The typeahead must be in the same namespace, but it is not required that the typeahead exist in the same nested structure. Indeed, the Users are loaded from accounts because that's what we need to scope them in the typeahead (we only want to return users belonging to this account), but to join a User to a Room, we are building a separate join table (members). The typeahead controller within the same namespace may be used by more than one typeahead field — for example, if you have separate scaffolds with references to Users and want the typeahead to work for both.
(See 'typeahead' section for details)
--include-object-names
When you are "Editing X" we specify that X is a ___ (author, book, room, etc)
e.g. "Editing author Edgar Allan Poe" vs "Editing Edgar Allan Poe"
Can also be specified globally in config/hot_glue.yml
--new-button-position
(above, below; default: above)
Show the new button above or below the list.
--downnest-shows-headings
(default: false)
Show headings above downnested portals.
v0.6.10 - passdown fixes, adds `--no-nav-menu` option; other fixes
- adds
--no-nav-menu
option to supress writing to the _nav template - the _nav template itself can now end with either .html.erb or .erb
- Removing feature: optionalized nested params (this was a bad idea)
- enum partials now correctly render within a namespace
- fixes for detecting missing belongs_to relationships
- fixes to post-create and post-update parental reloads
- refactors passdown strategy when nested
v0.6.9.2 - adds alt_lookup to related_set_field.rb and fixes a variable passdown problem in edit.html.erb
(released to rubygems 2024-12-17)
• adds alt_lookup to related_set_field.rb and fixes a variable passdown problem in edit.html.erb
v0.6.9 - `--record-scope` feature and fixes in nesting and `--big-edit`
Record scope allows you to apply a model based scope for the controller being generated.
This is applied on top of all other scopes, searches, and modifiers applied to the built controller.
bin/rails :generate hot_glue:scaffold Order --record-scope='.is_open'
Be sure to use single quotes ('
) and don't forget the dot (.
) before your scope(s).
Make sure your Order model has a scope is_open
, like so:
scope :is_open, -> {where(state == 'open')}
Now all records displayed through the generated controller
More fixes:
• --big-edit
now always uses non-turbo form submits, for update + magic buttons; this fixes the awkward save interaction that took the user to the otherwise unfindable show screen.
• refactor of modified datetime feature to prefer current user as set by the --auth setting (will not work in @gd
mode). future implementation will further refine
• when using big edit, update.turbo_stream.erb
is no longer written
• removes Pundit policy_scope() around new operations
• refactors to how parent objects from a nested controller pass these variables to lower-level partials; this implementation hard-codes the nested set as locals and also builds a nested_for
key (string)
v0.6.8 - adds back alt lookups and more
• fixes in modify_date_inputs_on_params for current_user_object
• adds back alt_lookup feature from version 0.5.7; use with --alt-foreign-key-lookup
• badges can be added to modified fields using [
and ]
which come after the modification flag inside {...}
.
for booleans separate with pipes |
• you can add badges to fields that have no other modification using the none
modifier
Full Changelog: v0.6.7...v0.6.8
v0.6.7 - Patch for my non-:00 seconds for datetimes
Patch for my non-:00 seconds problem. I have discovered that the root of my issues was a quirk in how browsers display datetime-local fields.
This implementation favors a no-seconds approach, which is a good idea for most applications. If you need seconds, you should use a different approach.
here is a note about the problem:
# note: as according to https://stackoverflow.com/questions/20111413/html5-datetime-local-control-how-to-hide-seconds
# there is no way to tell the browser not to display seconds in the datetime-local input field
# as I have implemented a "seconds don't matter" solution,
# the only solution is to avoid setting any non-00 datetime values into the database
# if they already exist in your database, you should zero them out
# or apply .change(sec: 0) when displaying them as output in the form
# this will prevent seconds from being added by the browser
v0.6.6.1 - Adds `hg-` and other fixes
- Adds hg- classes to the form fields for easier styling
(add this css to your app)
div.hg-heading-row {
background-color: #aab7d1;
font-weight: bold;
}
div.hg-row {
border: solid 1px grey;
}
.hg-col {
border: solid 1px grey;
overflow: hidden;
}
- Fixes in
modify_date_inputs_on_params
- Fixes in named_variants for Rails 7.1 (applies to attachments)
v0.6.6 - Refactor contextual timezone support
• Major refactor of contextual timezone support
NEW INSTALL: your current_user object should have
(1) a field on the database time_zone (notice underscore) this is a string field storing the name of the Rails timezone,
(2) a method like
def timezone ActiveSupport::TimeZone[time_zone] end
(notice no underscore in method name) This method returns a TimeZone object
UPGRADING: you will need to convert your existing timezone fields which were previously offset integers into strings using a new string field on your user object time_zone (notice underscores)
v0.6.5 - Adds timezone dropdown support, other fixes
• Adds timezone support as a modify
option
rails generate hot_glue:scaffold User --include=my_timezone --modify='my_timezone{timezone}'
Note that my_timezone
is a string field on the User object. By specifying like so above, hot glue will generate a dropdown list of timezones using the rails time_zone_select
helper.
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. full parity is still WIP but I intend to create a seamless backwards-compatible bridge
• Fixes redisplay issue on big edit
• Fix for time parsing
v0.6.4 - More pickup partials + Rails 7.1 fix
(rerelease of v6.0.3.3)
• Adds pickup partials for
_index_before_list
_list_after_each_row
_list_after_each_row_heading
Remember, to use pickup partials these partials must exist in the build folder at the time you are building scaffolding.
• Fixes issue with Rails 7.1 when using --no-edit
or --no-delete
flags
(Rails 7.1 enforces the presence of action names flagged with only
on the before hook, which caused The show action could not be found for the :load_charge callback...
)