[openstreetmap/openstreetmap-website] Refactor Diary Entry forms to use a custom form builder (#3017)

Andy Allan notifications at github.com
Thu Dec 24 13:43:58 UTC 2020


This PR refactors the Diary Entry forms to use bootstrap, including using a custom form builder to create a `f.richtext_field` form component that does everything we need it to.

I've kept all the javascript the same, and the relevant ids the same, and the previews etc worked for me. The new form fields are built on the bootstrap form layout, so it's responsive as the screen width changes.

I did consider making a form component for the latitude/longitude/use_map stuff, since we also have lat/lon inputs elsewhere (e.g. user home location). But I left that aside for now, since having a form control related to two fields is a bit tricky, and the javascript and exact behaviour differs between diary entries and user home locations anyway.

This should unlock the conversion of most of our forms to bootstrap.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/3017

-- Commit Summary --

  * Ensure richtext editing style rules are only applied on standard forms
  * Refactor diary entry forms to use a custom form builder

-- File Changes --

    M app/assets/stylesheets/common.scss (114)
    M app/views/diary_entries/_form.html.erb (48)
    M app/views/diary_entries/edit.html.erb (4)
    M app/views/diary_entries/new.html.erb (4)
    A app/views/shared/_html_help.erb (0)
    A app/views/shared/_markdown_help.html.erb (19)
    A app/views/shared/_richtext_field.html.erb (18)
    M config/locales/en.yml (27)
    A lib/richtext_form_builder.rb (15)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/3017.patch
https://github.com/openstreetmap/openstreetmap-website/pull/3017.diff

-- 
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/pull/3017
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20201224/725acbfa/attachment.htm>


More information about the rails-dev mailing list