[openstreetmap/openstreetmap-website] Allow user_blocks to be created for longer periods (#2225)

Andy Allan notifications at github.com
Wed May 15 09:49:32 UTC 2019


This avoids admins from having to manually change end periods in the database.

Most of this diff is the helper to display durations in the dropdown menu in more friendly terms than e.g. "8766 hours". The hours are carefully picked to show up as rounded durations. It's possible to pick particular hours that don't fit the pattern, e.g. 36 hours, but handling those situations was becoming an exercise in over-engineering.

![Screenshot from 2019-05-15 11-44-47](https://user-images.githubusercontent.com/360803/57766250-52d9e980-7707-11e9-971d-ac5867c9dc5d.png)


 I also wanted to preserve the "0 hours" label since that's how those blocks are referred to in common parlance, and to avoid e.g. "about 1 month" and similar vagueness, so that precluded using the standard rails time_to_words helpers.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Allow user_blocks to be created for longer periods

-- File Changes --

    M app/helpers/user_blocks_helper.rb (15)
    M app/views/user_blocks/edit.html.erb (2)
    M app/views/user_blocks/new.html.erb (2)
    M config/locales/en.yml (19)
    M config/settings.yml (2)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/2225.patch
https://github.com/openstreetmap/openstreetmap-website/pull/2225.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/2225
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190515/2b66a6b2/attachment.html>


More information about the rails-dev mailing list