main
main copied to clipboard
re-introduce custom signup forms [3]
[stub]
Context
- realized while blocked playing #613 that cusom forms are heavy and we don't actually need them yet, so we ditched them until we do
- by "heavy" i mean: it is difficult to introduce non-text fields into the schema (like passwords and dropdowns) and difficult to run migrations from the schema that worked for just text fields
- when groups start asking for different fields in their signup forms or multiple signup forms that allow them to track the source for new signups, then play this
Implementation Notes
- currently we store a
FormInputGroupthat has astringfield forinputsandrequiredwhich is stored in postgres as an array (ie::inputs, :string, array: true, default: []settings in the original migration) - we could changes this to
:inputs, :text, default: '[]', but is requires non-trivial backfills and breaks rollbacks - instead, i think we should ditch the
inputsandrequiredfields altogether and instead introduce ahas_many-belongs-torelationship betweenFormInputGroupand a new class calledFormInputGroup - where
FormInputGrouphas the fieldstype(an enum with possible values:text,textarea,select,password, etc.),attr_name(for the attribute the form field will create),label(for the form label), and, optionallyoptions(if it is a select). - this will allow cleaner logic for aliasing and recongizing required fields and will generally be cleaner than trying to do it with hashes
- it will require slightly rewriting
SignupForm.for