[openstreetmap/openstreetmap-website] Use a form builder for bootstrap forms (#2654)

Andy Allan notifications at github.com
Wed Jul 1 13:53:44 UTC 2020


So we have two options - #2655 (using the `simple_form` gem) and #2667 (using the `bootstrap_form` gem). Overall there's not much to choose between them, but as I said in #2667 I lean slightly towards the bootstrap_form option.

Today I've been tackling integrating the richtext input (that we use in diary entries and elsewhere). This would be nice to have as a custom input, so that we could do `f.richtext_field :body` and get the label, textarea, help, preview buttons etc automatically. After a bit of trial and error I [found a way](https://github.com/gravitystorm/openstreetmap-website/commit/aeaf0404e7d805871b7fe3c4252adec92223d2b9) that works reasonably well.

Unfortunately bootstrap_form doesn't appear to have any way to develop custom inputs, either from scratch (e.g.  `f.richtext_field :body`) nor by options (e.g. `f.textarea :body, as: :richtextarea). I settled on creating a custom formbuilder, as in the linked commit, and it works well enough but still feels a bit clunky. The only relevant issue that I found was https://github.com/bootstrap-ruby/bootstrap_form/issues/139 . `simple_form`, as linked to in that issue, supports a number of nice methods to create custom inputs and other customisations.

@tordans do you have any experience with custom inputs like this?

Overall it's not a showstopper, so we can definitely move forward with bootstrap_form, but it would be nice to see if there's a smoother way to do the richtext fields.



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/2654#issuecomment-652432302
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20200701/9a558a3f/attachment.htm>


More information about the rails-dev mailing list