Releases: hot-glue-for-rails/hot-glue
v0.4.2 - Smart Layouts
• Several additions to spec coverage
Specified Grouping for the --include
list
To specify grouped columns, separate COLUMNS by a COLON, then separate fields with commas. Specified groupings work like smart layouts (see below), except you drive which groupings make up the columns.
(Smarty layouts, below, achieves the same effect but automatically groups your fields into a smart number of columns. )
If you want to group up fields together into columns, use a COLON (:
) character to specify columns.
Your input may have a COLON at the end of it, but otherwise your columns will made flush left.
Without specified grouping (and not using smart layout), no group will happen, so these two fields would display in two columns:
--include=api_id,api_key
With a trailing colon you would be specifying the grouping. You're telling Hot Glue to make the two fields into column #1. (There is no other column.)
--include=api_id,api_key:
If, for example, you wanted to put the name
field into column #1 and then the api_id and api_key into column #2, you would use:
--include=name:api_id,api_key
Specifying any colon in your include syntax switches the builder into specified grouping mode. The effect will be that the fields will be stacked together into nicely fit columns. (This will look confusing if your user expect an Excel-like interface.)
With Bootstrap in specified grouping or smart layout mode, it automatically attempts to fit everything into 12-columns.
Using Bootstrap with neither specified grouping nor smart layouts may make 12 columns, which will produce strange result. (Bootstrap is not designed to work with, for example, a 13-column layout.)
You should typically either specify your grouping or use smart layouts when building with Bootstrap, but if your use case does not fit the stacking feature you can specify neither and then you may have deal with the over-stuffed layouts as explained above.
--smart-layout
Smart layouts are like specified grouping but Hot Glue does the work of figuring out how many fields you want in each column.
It will concatinate your fields into groups that will fit into the Bootstraps 12-column grid.
The effect will be that the fields will be stacked together into nicely fit columns.
Some people expect each field to be a column and think this looks strange.
If your customer is used to Excel, this feature will confuse them.
Also, this feature will probably not be supported by the SORTING (not yet implemented; TBD). I'm not really sure it makes sense to build a non-columnar layout with sorting, so I think I probably won't support smart layouts if you want sorting. (You will be forced to choose between the two which I think makes sense.)
The layout builder works from right-to-left and starts with 12, the number of Bootstrap's columns.
It reserves 2 columns for the default buttons. Then +1 additional column for each magic button you have specified.
Then it takes 4 columns for each downnested portal.
If you're keeping track, that means we may have used 6 to 8 out of our Bootstrap columns already if we have buttons & portals. (With no portals and no magic buttons you have a nice even 10 columns to work with.)
If we have 2 downnested portals and only the default buttons, that uses 10 out of 12 Bootstrap columns, leaving only 2 bootstrap columns for the fields.
THe layout builder takes the number of columns left and then distributes the feilds 'evenly' among them. However, note that order specified translates to up-to-down within the column, and then left-to-right across the columns, like so:
A D G
B E H
C F I
This is what would happen if 9 fields, specified in the order A,B,C,D,E,F,G,H,I, were distributed across 3 columns.
(If you had a number of fields that wasn't easily divisible by the number of columns, it would leave the final column a few fields short of the others.)
The effect can be seen here in the Example 1 app in the Tutorial:
Hot Glue Tutorial
GET THE COURSE TODAY (includes Hot Glue License) only $60 USD!
Now available on Teachable |
Full Changelog: v0.3.9...v0.4.2
v0.3.9 - Magic Button can be disabled
--magic-buttons
Remember you can add ____able?
methods to your models to enable or disable your magic button!
For example, if we had magic buttons for accept
and reject
you can now add acceptable?
and rejectable?
method onto your models to produce this:
Hot Glue Tutorial
GET THE COURSE TODAY (includes Hot Glue License) only $60 USD!
Now available on Teachable |
v0.3.8 - Magic Buttons
--magic-buttons
If you pass a list of magic buttons (separated by commas), they will appear in the button area on your list.
It will be assumed there will be corresponding bang methods on your models.
The bang methods can respond in one of four ways:
• With true, in which case a generic success message will be shown in the flash notice (“Approved” or “Rejected” in this case)
• With false, in which case a generic error message will be shown in the flash alert (“Could not approve…”)
• With a string, which will be assumed to be a “success” case, and will be passed to the front-end in the alert notice.
• Raise an ActiveRecord exception
This means you can be a somewhat lazy about your bang methods, but keep in mind the truth operator compares boolean true NOT any object is truth. So your return object must either be actually true (boolean), or an object that is string or string-like (responds to .to_s). Want to just say it didn’t work? Return false. Want to just say it was OK? Return true. Want to say it was successful but provide a more detailed response? Return a string.
Finally, you can raise an ActiveRecord error which will also get passed to the user, but in the flash alert area
For more information see Example 5 in the Tutorial
Hot Glue Tutorial
GET THE COURSE TODAY (includes Hot Glue License) only $60 USD!
Now available on Teachable |
v0.3.5 - First Stable Release & Hot Glue Tutorial Now Available
I am pleased to announce the first 'mostly stable' release of my Gem, Hot Glue.
Although Rails is very much a sunset technology right now, its raw power is undeniable. As well, for web-only and API-driven projects it remains an incredibly solid choice to iterate on quickly, to build prototypes on, and to launch businesses on. However, Rails' "hard parts" still make it somewhat inaccessible to new entrants.
As well, the official Rails Guides, while doing a great job at teaching many of the basics and documenting many parts of the large framework, leave off some of the most important parts of teaching new Rails developers about good application architecture, access control, and how to thinking about object graphs.
This tool's goal is to one thing and one thing only, and do it very, very well. While CRUD and list views are perhaps the oldest relic from the early days of the internet, arguably 80-90% of the internet's needs are for CRUD and list views.
That is, out of the context of the latest fancy mobile app, most of the time most people just want to click-click-click, have clean, clear, and consistent UIs, not be distracted with bells and whistles, see errors and problems right away in an intuitive way, and not have the UX/UI get in the way of the way of their productivity.
That's the power of scaffold-built admin interfaces in Rails. What could take teams and teams of developers working months and months to build in other languages or frameworks — and probably build poorly— can be now be built using Hot Glue in just an afternoon.
Look, the best application frameworks aren't about flash & wizbang. They are about getting out of your way and letting you focus on your application logic, business rules, user experience, and product-market fit.
What you don't want to have to worry about is how many parameters are in "options_for_collection_select" (the answer is 4), how to use it, setting up your value lists, worrying about getting your Enums to display correctly, displaying your date & times in the right timezone, re-displaying pages on errors correctly & with informative markings showing the user where the errors are, how Turbo Rails handles swap-outs, how Turbo Rails handles http status codes, etc, etc, etc. All of that stuff just slows you down when during prototyping what you need is to move fast.
Turbo Rails is a major step forward, but it is a steep learning curve. Although it is very new, I do believe Turbo Rails is a superior technology for many websites. Although I do not fully agree with DHH's assessment of modern JS paradigms, I do agree that 80% of the web apps (not mobile apps) on the planet just need CRUD, list, and a few bells & whistles.
Obviously, when you're talking about designing a super-UX— like a game or an interactive chart— you simply should not use a tool like this. But for many small businesses, banks, consumer web apps, industrial projects, etc— most of the time most people actually need simple UXs that work, are intuitive, and fast.
Turbo Rails has, far and way, the fastest interaction speeds I've seen on the internet. There is absolutely no JS frontend framework that can match the interaction speed of these pages. It's just not possible when you have that much business logic on the frontend.
Hot Glue is a great choice for you if you know you don't want business logic in JS, like Rails and Turbo-Rails, and want an easy framework to get a lot of UI built quickly and consistently.
This release (0.3.5) includes a key feature called "Downnesting" which brings portals of related records to your views. With downnesting you can easily add a list view to any existing page, giving your users instant functionality at very little cost.
Check out the new Hot Glue Tutorial available on my Teachable channel:
https://jfb.teachable.com/p/hot-glue-in-depth-tutorial
The first two sections of the course are free.
Thank you so much for supporting this project!
Jason
v0.3.5 RELASE NOTES
NEW INSTALLATION
You now should pass the installer two flags: --layout
(bootstrap or hotglue) and --markup
(erb or haml)
If you already have a previous version of Hot Glue, you'll want to re-run the installer. It will not create a file at config/hot_glue.yml
with your preferences so that Hot Glue remembers these two choices globally for all of your scaffoldings.
example:
rails generate hot_glue:install --layout=bootstrap --markup=erb
--layout flag
If you do NOT specify --layout=bootstrap
, then hotglue
will be assumed. When constructing scaffold with bootstrap layout (at this time Hot Glue peeks into config/hot_glue.yml to see what you've set there), your views come out with divs that have classes like .container-fluid, .row, and .col. You'll need to install Bootstrap separately, any way you like, but jQuery is not required as Hot Glue does not rely on jQuery-dependant Bootstrap features.
If instead you install Hot Glue (or switch the setting) using the default layout mode (--layout=hotglue), your scaffolding will be built using no-Bootstrap syntax: It has its own syntax with classes like .scaffold-container, .scaffold-list, .scaffold-row, and .scaffold-cell
During the installation, if your --layout flag is left unspecified or set to hotglue you must also pass --theme flag.
the themes are: • like_mountain_view (Google) • like_los_gatos (Netflix) • like_bootstrap (bootstrap 4 copy) • dark_knight (The Dark Night (2008) inspired) • like_cupertino (modern Apple-UX inspired) • gradeschool (spiral bound/lined notebook inspired)
BOOTSTRAP NO LONGER NEEDED. IF you are using layout=bootstrap, you must install Bootstrap here. However, please note that the scaffold build with different market up for boostrap, so you cannot switch between the Bootstrap and Hotglue layouts without rebuilding the scaffold.
(On the other hand, if you build within the Hotglue layout, all of the Hotglue theme file CAN be swapped out without rebuilding the scaffood.)
The themes are just SCSS files installed into app/assets/stylesheets. You can tweak or modify or remove them afer they get installed.
--markup flag
default is erb
--downnest
Automatically create subviews down your object tree. This should be the name of a has_many relationship based from the current object. You will need to build scaffolding with the same name for the related object as well. On the list view, the object you are currently building will be built with a sub-view list of the objects related from the given line.
--display-list-after-update
(default: false)
After an update-in-place normally only the edit view is swapped out for the show view of the record you just edited.
Sometimes you might want to redisplay the entire list after you make an update (for example, if your action removes that record from the result set).
To do this, use flag --display_list_after_update
. The update will behave like delete and re-fetch all the records in the result and tell Turbo to swap out the entire list.
makes all field types texted in generated system specs; install generation now checks extra files for setup
this version is all about developer happyness:
- significant fixes for the behavioral (system) specs. they now create new & update interactions
for (almost) all field types
- the install generator now checks your layouts/application.html.erb for render partial: 'layouts/flash_messages'
and adds it if it isn't there already
- the install generator also checks your spec/rails_helper for config.include FactoryBot::Syntax::Methods
and adds it at the top of the Rspec configure block if it isn't there
Native support for Enum field types
Hot Glue now has native support for enum field types.
On a model, you might implement an enum like so:
include PGEnum(rate_period_schedule: %w[day month year])
include PGEnum(bill_strategy: %w[per_diem flat])
(This requires the activerecord-pgenum
gem to be in your app.) It will create a simple enum on your model:
enum rate_period_schedule: {day: 'day', month: 'month', year: 'year'}
Hot Glue now will detect your enum fields and display them accordingly. As well, the edit screen will automatically have drop down value lists to pick a value from the defined type list:
so easy!
To use with Postgres, check out my blog post here https://jasonfleetwoodboldt.com/courses/stepping-up-rails/enumerated-types-in-rails-and-postgres/
v0.2.0 - Hot Glue Now support ERB templates as an alternative to HAML
Hot Glue — the fastest way to build scaffolding in Ruby on Rails with turbo views — now supports HAML and ERB ; use the option --markup=erb
or --markup=haml
(default is now erb)
if anyone would like to help me add SLIM please leave a comment on #3
~
About Hot Glue
Hot Glue is a Rails scaffold builder for the Turbo era. It is an evolution of the admin-interface style scaffolding systems of the 2010s (activeadmin, rails_admin, and active_scaffold).
Using Turbo-Rails and Hotwire you get a lightning-fast out-of-the-box CRUD building experience. Every page displays only a list view: new and edit operations happen as 'edit-in-place', so the user never leaves the page.
It will read your relationships and field types to generate your code for you, leaving you with a 'sourdough starter' to work from. If you modify the generated code, you're on your own if you want to preserve your changes and also re-generate scaffold after adding fields.
v0.1.2 - Fixes issue with namespaced helpers
v0.1.1 - Cancel buttons
Full behavior specs included
• Very pleased to introduce full behavior specs as part of the generated code.
You can find them in specs/system/
, generated by default on all built code
They are built for Rspec with Capybara and look, unsurprisingly, just like Capybara specs
• Also many fixes involving nesting and authentication
The complete git diff since the last release v0.9.0 (sorry I skipped the release notes for that version). There are few odds & ends but the bulk of this release is the automatic behavior spec coverage.
commit dc1c81d (HEAD -> main, tag: v0.1.0, origin/main)
Author: Jason Fleetwood-Boldt [email protected]
Date: Wed Apr 28 08:48:29 2021 -0400
release notes for 0.1.0; fixes internal specs (removes old request spec assertions)
commit ea132a0
Author: Jason Fleetwood-Boldt [email protected]
Date: Wed Apr 28 08:43:16 2021 -0400
Update README.md
commit 379cd98
Author: Jason Fleetwood-Boldt [email protected]
Date: Wed Apr 28 08:42:18 2021 -0400
read me and prepares for v0.1.0
commit 745bbbc
Author: Jason Fleetwood-Boldt [email protected]
Date: Tue Apr 27 20:35:09 2021 -0400
working field-by-field behavior specs (generated in spec/system)
commit 5787b84
Author: Jason Fleetwood-Boldt [email protected]
Date: Tue Apr 27 20:03:53 2021 -0400
a reasonable system spec output
commit 022767e
Author: Jason Fleetwood-Boldt [email protected]
Date: Tue Apr 27 19:59:37 2021 -0400
almost finished skinned system behavior specs
commit c2b271d
Author: Jason Fleetwood-Boldt [email protected]
Date: Tue Apr 27 16:55:41 2021 -0400
behavior spec generating
commit f425663
Author: Jason Fleetwood-Boldt [email protected]
Date: Tue Apr 27 16:00:34 2021 -0400
takes away failing snapshot test
commit 4cdffaf
Author: Jason Fleetwood-Boldt [email protected]
Date: Tue Apr 27 15:54:37 2021 -0400
fixes for objects with @ symbols, fixes nest chain
commit bc16e65
Author: Jason Fleetwood-Boldt [email protected]
Date: Mon Apr 19 18:34:46 2021 -0400
spec fixes; makes error messages more robust; spec coverage for --nest option