From c839932ecad682266b1739c27d6d9148e7d9e05e Mon Sep 17 00:00:00 2001 From: Jason Fleetwood-Boldt Date: Sun, 6 Mar 2022 08:15:45 -0500 Subject: [PATCH] adds info to README --- README.md | 14 ++++++++++++++ lib/generators/hot_glue/scaffold_generator.rb | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5abd9db2..9cb23493 100644 --- a/README.md +++ b/README.md @@ -472,6 +472,13 @@ Please note that this example would produce non-functional code, so you would ne You don't need this if the pluralized version is just + "s" of the singular version. Only use for non-standard plurlizations, and be sure to pass it as TitleCase (as if you pluralized the model name which is non-standard for Rails) +### `--form-labels-position` (default: `after`; options are **before**, **after**, and **omit**) +By default form labels appear after the form inputs. To make them appear before or omit them, use this flag. + +See also `--form-placeholder-labels` to use placeolder labels. + + + ### `--exclude=` (separate field names by COMMA) @@ -680,6 +687,13 @@ Omits list LABEL itself above the list. (Do not confuse with the field labels.) Note that list labels may be automatically omitted on downnested scaffolds. +### `--form-placeholder-labels` (default: false) + +When set to true, fields, numbers, and text areas will have placeholder labels. +Will not apply to dates, times, datetimes, dropdowns (enums + foreign keys), or booleans. + +See also setting `--form-labels-position` to control position or omit normal labels. + ### `--no-list-heading` Omits the heading of column names that appears above the 1st row of data. diff --git a/lib/generators/hot_glue/scaffold_generator.rb b/lib/generators/hot_glue/scaffold_generator.rb index dac2a4b3..a7281607 100644 --- a/lib/generators/hot_glue/scaffold_generator.rb +++ b/lib/generators/hot_glue/scaffold_generator.rb @@ -133,8 +133,10 @@ class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator class_option :form_labels_position, default: 'after' # choices are before, after, omit class_option :form_placeholder_labels, default: false # puts the field names into the placeholder labels + + # NOT YET IMPLEMENTED # determines if labels appear within the rows of the VIEWABLE list (does NOT affect the list heading) - class_option :inline_list_labels, default: 'omit' # choices are before, after, omit + # class_option :inline_list_labels, default: 'omit' # choices are before, after, omit def initialize(*meta_args) super @@ -170,7 +172,6 @@ def initialize(*meta_args) if !options['markup'].nil? 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`" raise(HotGlue::Error, message) - end if !options['markup'].nil?