From: Tom Hughes Date: Thu, 29 Apr 2021 18:42:51 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/3029' X-Git-Tag: live~2350 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/0e78061cdba5cfb3f299f57b7643d2b396ee235b?hp=f36b6375e9a61f44b20bc638e07a7024f4437869 Merge remote-tracking branch 'upstream/pull/3029' --- diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..e3e5e1ba4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +docker-db-data +log +tmp +docker-cache +.travis.yml +.git diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..4bf0f5f57 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,36 @@ +name: Docker +on: + - push + - pull_request +jobs: + test: + name: Docker + runs-on: ubuntu-20.04 + steps: + - name: Checkout source + uses: actions/checkout@v2.3.4 + - name: Poke config + run: | + cp config/example.storage.yml config/storage.yml + cp config/docker.database.yml config/database.yml + touch config/settings.local.yml + - name: Build Docker Image + run: | + docker-compose build + - name: Start Docker-Compose + run: | + docker-compose up -d + sleep 15 # let the DB warm up a little + - name: Prepare Database + run: | + docker-compose run --rm web rake db:migrate + docker-compose run web bundle exec rake i18n:js:export + docker-compose run --rm web osmosis --rx docker/null-island.osm.xml --wd host=db database=openstreetmap user=openstreetmap password=openstreetmap validateSchemaVersion=no + - name: Test Basic Website + run: | + curl -siL http://127.0.0.1:3000 | egrep '^HTTP/1.1 200 OK' + curl -siL http://127.0.0.1:3000 | grep 'OpenStreetMap is the free wiki world map' + curl -siL http://127.0.0.1:3000/api/0.6/node/1 | grep 'Null Island' + - name: Test Complete Suite + run: | + docker-compose run --rm web bundle exec rails test:db diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e9b7cfd4a..f764a804f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,13 +11,13 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Setup ruby - uses: actions/setup-ruby@v1.1.2 + uses: actions/setup-ruby@v1 with: ruby-version: ${{ env.ruby }} - name: Cache gems - uses: actions/cache@v2 + uses: actions/cache@v2.1.5 with: path: vendor/bundle key: bundle-${{ env.os }}-${{ env.ruby }}-${{ hashFiles('Gemfile.lock') }} @@ -35,13 +35,13 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Setup ruby - uses: actions/setup-ruby@v1.1.2 + uses: actions/setup-ruby@v1 with: ruby-version: ${{ env.ruby }} - name: Cache gems - uses: actions/cache@v2 + uses: actions/cache@v2.1.5 with: path: vendor/bundle key: bundle-${{ env.os }}-${{ env.ruby }}-${{ hashFiles('Gemfile.lock') }} @@ -59,20 +59,20 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Setup ruby - uses: actions/setup-ruby@v1.1.2 + uses: actions/setup-ruby@v1 with: ruby-version: ${{ env.ruby }} - name: Cache gems - uses: actions/cache@v2 + uses: actions/cache@v2.1.5 with: path: vendor/bundle key: bundle-${{ env.os }}-${{ env.ruby }}-${{ hashFiles('Gemfile.lock') }} restore-keys: | bundle-${{ env.os }}-${{ env.ruby }}- - name: Cache node modules - uses: actions/cache@v1 + uses: actions/cache@v2.1.5 with: path: node_modules key: yarn-${{ env.os }}-${{ hashFiles('yarn.lock') }} @@ -94,13 +94,13 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Setup ruby - uses: actions/setup-ruby@v1.1.2 + uses: actions/setup-ruby@v1 with: ruby-version: ${{ env.ruby }} - name: Cache gems - uses: actions/cache@v2 + uses: actions/cache@v2.1.5 with: path: vendor/bundle key: bundle-${{ env.os }}-${{ env.ruby }}-${{ hashFiles('Gemfile.lock') }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b111da933..04caddf41 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,20 +15,20 @@ jobs: OPENSTREETMAP_MEMCACHE_SERVERS: 127.0.0.1 steps: - name: Checkout source - uses: actions/checkout@v1 + uses: actions/checkout@v2.3.4 - name: Setup ruby uses: actions/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - name: Cache gems - uses: actions/cache@v1 + uses: actions/cache@v2.1.5 with: path: vendor/bundle key: bundle-ubuntu-${{ matrix.ubuntu }}-ruby-${{ matrix.ruby }}-${{ hashFiles('Gemfile.lock') }} restore-keys: | bundle-ubuntu-${{ matrix.ubuntu }}-ruby-${{ matrix.ruby }}- - name: Cache node modules - uses: actions/cache@v1 + uses: actions/cache@v2.1.5 with: path: node_modules key: yarn-ubuntu-${{ matrix.ubuntu }}-${{ hashFiles('yarn.lock') }} diff --git a/.gitignore b/.gitignore index 1328658c6..73316769e 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,6 @@ public/attachments public/export storage tmp + +# docker-compose database directory +docker-db-data diff --git a/.rubocop.yml b/.rubocop.yml index 200ab8a00..9b7a28d87 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,7 +6,7 @@ require: - rubocop-rails AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: 2.5 NewCops: enable Exclude: - 'vendor/**/*' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 890fcc83c..5833a6e35 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-09-02 06:16:56 UTC using RuboCop version 0.90.0. +# on 2021-01-11 19:00:54 UTC using RuboCop version 1.8.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -13,12 +13,12 @@ require: - rubocop-performance - rubocop-rails -# Offense count: 568 +# Offense count: 544 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Layout/LineLength: - Max: 250 + Max: 254 # Offense count: 36 # Configuration parameters: AllowSafeAssignment. @@ -39,14 +39,24 @@ Lint/AssignmentInCondition: - 'lib/osm.rb' - 'script/deliver-message' -# Offense count: 682 -# Configuration parameters: IgnoredMethods. +# Offense count: 8 +# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. +Lint/DuplicateBranch: + Exclude: + - 'app/controllers/api_controller.rb' + - 'app/controllers/diary_entries_controller.rb' + - 'app/controllers/geocoder_controller.rb' + - 'app/helpers/browse_tags_helper.rb' + - 'lib/password_hash.rb' + +# Offense count: 487 +# Configuration parameters: IgnoredMethods, CountRepeatedAttributes. Metrics/AbcSize: - Max: 194 + Max: 235 -# Offense count: 72 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods. -# ExcludedMethods: refine +# Offense count: 62 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +# IgnoredMethods: refine Metrics/BlockLength: Max: 71 @@ -55,43 +65,41 @@ Metrics/BlockLength: Metrics/BlockNesting: Max: 5 -# Offense count: 25 +# Offense count: 24 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 644 + Max: 587 -# Offense count: 68 +# Offense count: 52 # Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: Max: 26 -# Offense count: 735 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods. +# Offense count: 553 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. Metrics/MethodLength: Max: 179 -# Offense count: 4 -# Configuration parameters: CountKeywordArgs. +# Offense count: 1 +# Configuration parameters: CountKeywordArgs, MaxOptionalParameters. Metrics/ParameterLists: - Max: 9 + Max: 6 -# Offense count: 69 +# Offense count: 56 # Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: Max: 26 -# Offense count: 540 +# Offense count: 365 Minitest/MultipleAssertions: - Max: 81 + Max: 97 -# Offense count: 6 +# Offense count: 4 Naming/AccessorMethodName: Exclude: - 'app/controllers/application_controller.rb' - 'app/helpers/title_helper.rb' - - 'app/models/old_way.rb' - 'lib/osm.rb' - - 'lib/potlatch.rb' # Offense count: 8 # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. @@ -101,7 +109,6 @@ Naming/AccessorMethodName: # MethodDefinitionMacros: define_method, define_singleton_method Naming/PredicateName: Exclude: - - 'spec/**/*' - 'app/models/changeset.rb' - 'app/models/old_node.rb' - 'app/models/old_relation.rb' @@ -127,7 +134,7 @@ Rails/HasAndBelongsToMany: - 'app/models/changeset.rb' - 'app/models/user.rb' -# Offense count: 4 +# Offense count: 3 # Configuration parameters: Include. # Include: app/helpers/**/*.rb Rails/HelperInstanceVariable: @@ -145,30 +152,31 @@ Rails/NotNullColumn: - 'db/migrate/025_add_end_time_to_changesets.rb' - 'db/migrate/20120404205604_add_user_and_description_to_redaction.rb' -# Offense count: 19 +# Offense count: 8 Rails/OutputSafety: Exclude: + - 'app/controllers/sessions_controller.rb' - 'app/controllers/users_controller.rb' - 'app/helpers/application_helper.rb' - 'lib/rich_text.rb' - 'test/helpers/application_helper_test.rb' -# Offense count: 95 +# Offense count: 80 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: strict, flexible Rails/TimeZone: Enabled: false -# Offense count: 572 +# Offense count: 558 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: always, always_true, never Style/FrozenStringLiteralComment: Enabled: false -# Offense count: 78 +# Offense count: 54 # Cop supports --auto-correct. # Configuration parameters: Strict. Style/NumericLiterals: - MinDigits: 11 + MinDigits: 15 diff --git a/CONFIGURE.md b/CONFIGURE.md index 598ea3f65..c165c6d46 100644 --- a/CONFIGURE.md +++ b/CONFIGURE.md @@ -8,7 +8,7 @@ Many settings are available in `config/settings.yml`. You can customize your ins ## Populating the database -Your installation comes with no geographic data loaded. You can either create new data using one of the editors (Potlatch 2, iD, JOSM etc) or by loading an OSM extract. +Your installation comes with no geographic data loaded. You can either create new data using one of the editors (iD, JOSM etc) or by loading an OSM extract. After installing but before creating any users or data, import an extract with [Osmosis](https://wiki.openstreetmap.org/wiki/Osmosis) and the [``--write-apidb``](https://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usage#--write-apidb_.28--wd.29) task. @@ -28,7 +28,7 @@ If you create a user by signing up to your local website, you need to confirm th ``` $ bundle exec rails console ->> user = User.find_by_display_name("My New User Name") +>> user = User.find_by(:display_name => "My New User Name") => #[ ... ] >> user.status = "active" => "active" @@ -43,7 +43,7 @@ To give administrator or moderator permissions: ``` $ bundle exec rails console ->> user = User.find_by_display_name("My New User Name") +>> user = User.find_by(:display_name => "My New User Name") => #[ ... ] >> user.roles.create(:role => "administrator", :granter_id => user.id) => #[ ... ] @@ -58,11 +58,10 @@ $ bundle exec rails console Three of the built-in applications communicate via the API, and therefore need OAuth consumer keys configured. These are: -* Potlatch 2 * iD * The website itself (for the Notes functionality) -For example, to use the Potlatch 2 editor you need to register it as an OAuth application. +For example, to use the iD editor you need to register it as an OAuth application. Do the following: * Log into your Rails Port instance - e.g. http://localhost:3000 @@ -70,25 +69,25 @@ Do the following: * Click on "my settings" on the user page * Click on "oauth settings" on the My settings page * Click on 'Register your application'. -* Unless you have set up alternatives, use Name: "Local Potlatch" and URL: "http://localhost:3000" +* Unless you have set up alternatives, use Name: "Local iD" and URL: "http://localhost:3000" * Check the 'modify the map' box. * Everything else can be left with the default blank values. * Click the "Register" button * On the next page, copy the "consumer key" * Edit config/settings.local.yml in your rails tree -* Add the "potlatch2_key" configuration key and the consumer key as the value +* Add the "id_key" configuration key and the consumer key as the value * Restart your rails server An example excerpt from settings.local.yml: ``` # Default editor -default_editor: "potlatch2" -# OAuth consumer key for Potlatch 2 -potlatch2_key: "8lFmZPsagHV4l3rkAHq0hWY5vV3Ctl3oEFY1aXth" +default_editor: "id" +# OAuth consumer key for iD +id_key: "8lFmZPsagHV4l3rkAHq0hWY5vV3Ctl3oEFY1aXth" ``` -Follow the same process for registering and configuring iD (`id_key`) and the website/Notes (`oauth_key`), or to save time, simply reuse the same consumer key for each. +Follow the same process for registering and configuring the website/Notes (`oauth_key`), or to save time, simply reuse the same consumer key for each. ## Troubleshooting diff --git a/DOCKER.md b/DOCKER.md new file mode 100644 index 000000000..ce0430939 --- /dev/null +++ b/DOCKER.md @@ -0,0 +1,99 @@ +# Using Docker and Docker Compose for Development and Testing + +These instructions are designed for setting up The Rails Port for development and testing using [Docker](https://www.docker.com/). This will allow you to install the OpenStreetMap application and all its dependencies in Docker images and then run them in containers, almost with a single command. You will need to install Docker and Docker Compose on your development machine: + +- [Install Docker](https://docs.docker.com/install/) +- [Install Docker Compose](https://docs.docker.com/compose/install/) + +The first step is to fork/clone the repo to your local machine: + + git clone https://github.com/openstreetmap/openstreetmap-website.git + +Now change working directory to the `openstreetmap-website`: + + cd openstreetmap-website + +## Initial Setup + +### Storage + + cp config/example.storage.yml config/storage.yml + +### Database + + cp config/docker.database.yml config/database.yml + +## Prepare local settings file + +This is a workaround. [See issues/2185 for details](https://github.com/openstreetmap/openstreetmap-website/issues/2185#issuecomment-508676026). + + touch config/settings.local.yml + +## Installation + +To build local Docker images run from the root directory of the repository: + + docker-compose build + +If this is your first time running or you have removed cache this will take some time to complete. Once the Docker images have finished building you can launch the images as containers. + +To launch the app run: + + docker-compose up -d + +This will launch one Docker container for each 'service' specified in `docker-compose.yml` and run them in the background. There are two options for inspecting the logs of these running containers: + +- You can tail logs of a running container with a command like this: `docker-compose logs -f web` or `docker-compose logs -f db`. +- Instead of running the containers in the background with the `-d` flag, you can launch the containers in the foreground with `docker-compose up`. The downside of this is that the logs of all the 'services' defined in `docker-compose.yml` will be intermingled. If you don't want this you can mix and match - for example, you can run the database in background with `docker-compose up -d db` and then run the Rails app in the foreground via `docker-compose up web`. + +### Migrations + +Run the Rails database migrations: + + docker-compose run --rm web bundle exec rake db:migrate + +### Tests + +Run the test suite by running: + + docker-compose run --rm web bundle exec rake test:db + +### Loading an OSM extract + +This installation comes with no geographic data loaded. You can either create new data using one of the editors (Potlatch 2, iD, JOSM etc) or by loading an OSM extract. Here an example for loading an OSM extract into your Docker-based OSM instance. + +For example, let's download the District of Columbia from Geofabrik or [any other region](https://download.geofabrik.de): + + wget https://download.geofabrik.de/north-america/us/district-of-columbia-latest.osm.pbf + +You can now use Docker to load this extract into your local Docker-based OSM instance: + + docker-compose run --rm web osmosis \ + -verbose \ + --read-pbf district-of-columbia-latest.osm.pbf \ + --log-progress \ + --write-apidb \ + host="db" \ + database="openstreetmap" \ + user="openstreetmap" \ + validateSchemaVersion="no" + +Once you have data loaded for Washington, DC you should be able to navigate to [`http://localhost:3000/#map=12/38.8938/-77.0146`](http://localhost:3000/#map=12/38.8938/-77.0146) to begin working with your local instance. + +### Additional Configuration + +See [`CONFIGURE.md`](CONFIGURE.md) for information on how to manage users and enable OAuth for iD, JOSM etc. + +### Bash + +If you want to get into a web container and run specific commands you can fire up a throwaway container to run bash in via: + + docker-compose run --rm web bash + +Alternatively, if you want to use the already-running `web` container then you can `exec` into it via: + + docker-compose exec web bash + +Similarly, if you want to `exec` in the db container use: + + docker-compose exec db bash diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..e8ff01387 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +FROM ubuntu:20.04 + +ENV DEBIAN_FRONTEND=noninteractive + +# Install system packages then clean up to minimize image size +RUN apt-get update \ + && apt-get install --no-install-recommends -y \ + build-essential \ + curl \ + default-jre-headless \ + file \ + firefox-geckodriver \ + imagemagick \ + libarchive-dev \ + libffi-dev \ + libgd-dev \ + libmagickwand-dev \ + libpq-dev \ + libsasl2-dev \ + libxml2-dev \ + libxslt1-dev \ + locales \ + nodejs \ + postgresql-client \ + ruby2.7 \ + ruby2.7-dev \ + tzdata \ + unzip \ + yarnpkg \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Install compatible Osmosis to help users import sample data in a new instance +RUN curl -OL https://github.com/openstreetmap/osmosis/releases/download/0.47.2/osmosis-0.47.2.tgz \ + && tar -C /usr/local -xzf osmosis-0.47.2.tgz + +ENV DEBIAN_FRONTEND=dialog + +# Setup app location +RUN mkdir -p /app +WORKDIR /app + +# Install Ruby packages +ADD Gemfile Gemfile.lock /app/ +RUN gem install bundler \ + && bundle install + +# Install NodeJS packages using yarnpkg +# `bundle exec rake yarn:install` will not work +ADD package.json yarn.lock /app/ +RUN yarnpkg install diff --git a/Gemfile b/Gemfile index a880a8534..a5b7d401f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,13 +1,7 @@ source "https://rubygems.org" # Require rails -gem "rails", "6.0.3.4" - -# Require things which have moved to gems in ruby 1.9 -gem "bigdecimal", "~> 1.1.0", :platforms => :ruby_19 - -# Require things which have moved to gems in ruby 2.0 -gem "psych", :platforms => :ruby_20 +gem "rails", "6.0.3.6" # Require json for multi_json gem "json" @@ -49,11 +43,10 @@ gem "cancancan" gem "composite_primary_keys", "~> 12.0.0" gem "config" gem "delayed_job_active_record" -gem "dynamic_form" gem "http_accept_language", "~> 2.1.1" gem "i18n-js", ">= 3.0.0" gem "oauth-plugin", ">= 0.5.1" -gem "openstreetmap-deadlock_retry", ">= 1.3.0", :require => "deadlock_retry" +gem "openstreetmap-deadlock_retry", ">= 1.3.1", :require => "deadlock_retry" gem "rack-cors" gem "rails-i18n", "~> 6.0.0" gem "rinku", ">= 2.0.6", :require => "rails_rinku" @@ -67,12 +60,13 @@ gem "quad_tile", "~> 1.0.1" gem "rack-uri_sanitizer" # Omniauth for authentication -gem "omniauth" +gem "omniauth", "~> 2.0.2" gem "omniauth-facebook" gem "omniauth-github" gem "omniauth-google-oauth2", ">= 0.6.0" gem "omniauth-mediawiki", ">= 0.0.4" gem "omniauth-openid" +gem "omniauth-rails_csrf_protection", "~> 1.0" gem "omniauth-windowslive" # Markdown formatting support @@ -114,7 +108,7 @@ gem "logstasher" gem "bzip2-ffi" gem "ffi-libarchive" gem "gd2-ffij", ">= 0.4.0" -gem "mimemagic" +gem "marcel" # Used for browser detection gem "browser" @@ -130,7 +124,7 @@ group :development do gem "annotate" gem "better_errors" gem "binding_of_caller" - gem "debug_inspector", "< 1.0.0" + gem "debug_inspector" gem "listen" gem "vendorer" end @@ -144,7 +138,7 @@ group :test do gem "minitest", "~> 5.1" gem "puma", "~> 5.0" gem "rails-controller-testing" - gem "rubocop", "~> 0.93" + gem "rubocop" gem "rubocop-minitest" gem "rubocop-performance" gem "rubocop-rails" diff --git a/Gemfile.lock b/Gemfile.lock index c9a6ee6b0..31d64b6b8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,62 +3,62 @@ GEM specs: aasm (5.1.1) concurrent-ruby (~> 1.0) - actioncable (6.0.3.4) - actionpack (= 6.0.3.4) + actioncable (6.0.3.6) + actionpack (= 6.0.3.6) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.3.4) - actionpack (= 6.0.3.4) - activejob (= 6.0.3.4) - activerecord (= 6.0.3.4) - activestorage (= 6.0.3.4) - activesupport (= 6.0.3.4) + actionmailbox (6.0.3.6) + actionpack (= 6.0.3.6) + activejob (= 6.0.3.6) + activerecord (= 6.0.3.6) + activestorage (= 6.0.3.6) + activesupport (= 6.0.3.6) mail (>= 2.7.1) - actionmailer (6.0.3.4) - actionpack (= 6.0.3.4) - actionview (= 6.0.3.4) - activejob (= 6.0.3.4) + actionmailer (6.0.3.6) + actionpack (= 6.0.3.6) + actionview (= 6.0.3.6) + activejob (= 6.0.3.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.3.4) - actionview (= 6.0.3.4) - activesupport (= 6.0.3.4) + actionpack (6.0.3.6) + actionview (= 6.0.3.6) + activesupport (= 6.0.3.6) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) actionpack-page_caching (1.2.3) actionpack (>= 5.0.0) - actiontext (6.0.3.4) - actionpack (= 6.0.3.4) - activerecord (= 6.0.3.4) - activestorage (= 6.0.3.4) - activesupport (= 6.0.3.4) + actiontext (6.0.3.6) + actionpack (= 6.0.3.6) + activerecord (= 6.0.3.6) + activestorage (= 6.0.3.6) + activesupport (= 6.0.3.6) nokogiri (>= 1.8.5) - actionview (6.0.3.4) - activesupport (= 6.0.3.4) + actionview (6.0.3.6) + activesupport (= 6.0.3.6) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) active_record_union (1.3.0) activerecord (>= 4.0) - activejob (6.0.3.4) - activesupport (= 6.0.3.4) + activejob (6.0.3.6) + activesupport (= 6.0.3.6) globalid (>= 0.3.6) - activemodel (6.0.3.4) - activesupport (= 6.0.3.4) - activerecord (6.0.3.4) - activemodel (= 6.0.3.4) - activesupport (= 6.0.3.4) - activerecord-import (1.0.7) + activemodel (6.0.3.6) + activesupport (= 6.0.3.6) + activerecord (6.0.3.6) + activemodel (= 6.0.3.6) + activesupport (= 6.0.3.6) + activerecord-import (1.0.8) activerecord (>= 3.2) - activestorage (6.0.3.4) - actionpack (= 6.0.3.4) - activejob (= 6.0.3.4) - activerecord (= 6.0.3.4) - marcel (~> 0.3.1) - activesupport (6.0.3.4) + activestorage (6.0.3.6) + actionpack (= 6.0.3.6) + activejob (= 6.0.3.6) + activerecord (= 6.0.3.6) + marcel (~> 1.0.0) + activesupport (6.0.3.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -69,30 +69,30 @@ GEM annotate (3.1.1) activerecord (>= 3.2, < 7.0) rake (>= 10.4, < 14.0) - ast (2.4.1) - autoprefixer-rails (10.1.0.0) + ast (2.4.2) + autoprefixer-rails (10.2.4.0) execjs - aws-eventstream (1.1.0) - aws-partitions (1.414.0) - aws-sdk-core (3.110.0) + aws-eventstream (1.1.1) + aws-partitions (1.447.0) + aws-sdk-core (3.114.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-kms (1.40.0) - aws-sdk-core (~> 3, >= 3.109.0) + aws-sdk-kms (1.43.0) + aws-sdk-core (~> 3, >= 3.112.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.87.0) - aws-sdk-core (~> 3, >= 3.109.0) + aws-sdk-s3 (1.93.1) + aws-sdk-core (~> 3, >= 3.112.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) - aws-sigv4 (1.2.2) + aws-sigv4 (1.2.3) aws-eventstream (~> 1, >= 1.0.2) better_errors (2.9.1) coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) - better_html (1.0.15) + better_html (1.0.16) actionview (>= 4.0) activesupport (>= 4.0) ast (~> 2.0) @@ -100,10 +100,9 @@ GEM html_tokenizer (~> 0.0.6) parser (>= 2.4) smart_properties - bigdecimal (1.1.0) binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) - bootsnap (1.5.1) + bootsnap (1.7.4) msgpack (~> 1.0) bootstrap (4.5.3) autoprefixer-rails (>= 9.1.0) @@ -112,43 +111,43 @@ GEM bootstrap_form (4.5.0) actionpack (>= 5.2) activemodel (>= 5.2) - brakeman (4.10.1) - browser (5.2.0) + brakeman (5.0.0) + browser (5.3.1) builder (3.2.4) - bzip2-ffi (1.0.0) + bzip2-ffi (1.1.0) ffi (~> 1.0) cancancan (3.2.1) canonical-rails (0.2.11) rails (>= 4.1, < 6.2) - capybara (3.34.0) + capybara (3.35.3) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - regexp_parser (~> 1.5) + regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) childprocess (3.0.0) coderay (1.1.3) - composite_primary_keys (12.0.5) + composite_primary_keys (12.0.9) activerecord (~> 6.0.0) - concurrent-ruby (1.1.7) - config (2.2.3) + concurrent-ruby (1.1.8) + config (3.1.0) deep_merge (~> 1.2, >= 1.2.1) dry-validation (~> 1.0, >= 1.0.0) crack (0.4.5) rexml crass (1.0.6) dalli (2.7.11) - debug_inspector (0.0.3) + debug_inspector (1.1.0) deep_merge (1.2.1) delayed_job (4.1.9) activesupport (>= 3.0, < 6.2) - delayed_job_active_record (4.1.5) + delayed_job_active_record (4.1.6) activerecord (>= 3.0, < 6.2) delayed_job (>= 3.0, < 5) - docile (1.3.4) - dry-configurable (0.12.0) + docile (1.3.5) + dry-configurable (0.12.1) concurrent-ruby (~> 1.0) dry-core (~> 0.5, >= 0.5.0) dry-container (0.7.2) @@ -159,22 +158,20 @@ GEM dry-equalizer (0.3.0) dry-inflector (0.2.0) dry-initializer (3.0.4) - dry-logic (1.1.0) + dry-logic (1.2.0) concurrent-ruby (~> 1.0) dry-core (~> 0.5, >= 0.5) - dry-schema (1.5.6) + dry-schema (1.6.2) concurrent-ruby (~> 1.0) dry-configurable (~> 0.8, >= 0.8.3) - dry-core (~> 0.4) - dry-equalizer (~> 0.2) + dry-core (~> 0.5, >= 0.5) dry-initializer (~> 3.0) dry-logic (~> 1.0) - dry-types (~> 1.4) - dry-types (1.4.0) + dry-types (~> 1.5) + dry-types (1.5.1) concurrent-ruby (~> 1.0) dry-container (~> 0.3) - dry-core (~> 0.4, >= 0.4.4) - dry-equalizer (~> 0.3) + dry-core (~> 0.5, >= 0.5) dry-inflector (~> 0.1, >= 0.1.2) dry-logic (~> 1.0, >= 1.0.2) dry-validation (1.6.0) @@ -184,14 +181,13 @@ GEM dry-equalizer (~> 0.2) dry-initializer (~> 3.0) dry-schema (~> 1.5, >= 1.5.2) - dynamic_form (1.1.4) - erb_lint (0.0.35) + erb_lint (0.0.37) activesupport better_html (~> 1.0.7) html_tokenizer parser (>= 2.7.1.4) rainbow - rubocop (~> 0.79) + rubocop smart_properties erubi (1.10.0) execjs (2.7.0) @@ -201,13 +197,17 @@ GEM factory_bot_rails (6.1.0) factory_bot (~> 6.1.0) railties (>= 5.0.0) - faraday (1.3.0) + faraday (1.4.1) + faraday-excon (~> 1.1) faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.1) multipart-post (>= 1.2, < 3) - ruby2_keywords - faraday-net_http (1.0.0) - ffi (1.14.2) - ffi-libarchive (1.0.4) + ruby2_keywords (>= 0.0.4) + faraday-excon (1.1.0) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.1.0) + ffi (1.15.0) + ffi-libarchive (1.0.17) ffi (~> 1.0) fspath (3.1.2) gd2-ffij (0.4.0) @@ -219,9 +219,9 @@ GEM html_tokenizer (0.0.7) htmlentities (4.3.4) http_accept_language (2.1.1) - i18n (1.8.5) + i18n (1.8.10) concurrent-ruby (~> 1.0) - i18n-js (3.8.0) + i18n-js (3.8.2) i18n (>= 0.6.6) image_optim (0.28.0) exifr (~> 1.2, >= 1.2.2) @@ -235,7 +235,7 @@ GEM sprockets image_size (2.1.0) in_threads (1.5.4) - jbuilder (2.10.1) + jbuilder (2.11.2) activesupport (>= 5.0.0) jmespath (1.4.0) jquery-rails (4.4.0) @@ -243,39 +243,38 @@ GEM railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (2.5.1) - jwt (2.2.2) + jwt (2.2.3) kgio (2.11.3) - kramdown (2.3.0) + kramdown (2.3.1) rexml libxml-ruby (3.2.1) - listen (3.4.0) + listen (3.5.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) logstasher (2.1.5) activesupport (>= 5.2) request_store - loofah (2.8.0) + loofah (2.9.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - marcel (0.3.3) - mimemagic (~> 0.3.2) + marcel (1.0.1) maxminddb (0.1.22) method_source (1.0.0) - mimemagic (0.3.5) mini_magick (4.11.0) - mini_mime (1.0.2) - mini_portile2 (2.4.0) - minitest (5.14.2) - msgpack (1.3.3) + mini_mime (1.1.0) + mini_portile2 (2.5.0) + minitest (5.14.4) + msgpack (1.4.2) multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) - nio4r (2.5.4) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) - nokogumbo (2.0.4) + nio4r (2.5.7) + nokogiri (1.11.3) + mini_portile2 (~> 2.5.0) + racc (~> 1.4) + nokogumbo (2.0.5) nokogiri (~> 1.8, >= 1.8.4) oauth (0.4.7) oauth-plugin (0.5.1) @@ -283,76 +282,82 @@ GEM oauth (~> 0.4.4) oauth2 (>= 0.5.0) rack - oauth2 (1.4.4) + oauth2 (1.4.7) faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - omniauth (1.9.1) + omniauth (2.0.4) hashie (>= 3.4.6) rack (>= 1.6.2, < 3) + rack-protection omniauth-facebook (8.0.0) omniauth-oauth2 (~> 1.2) - omniauth-github (1.4.0) - omniauth (~> 1.5) - omniauth-oauth2 (>= 1.4.0, < 2.0) - omniauth-google-oauth2 (0.8.1) + omniauth-github (2.0.0) + omniauth (~> 2.0) + omniauth-oauth2 (~> 1.7.1) + omniauth-google-oauth2 (1.0.0) jwt (>= 2.0) oauth2 (~> 1.1) - omniauth (>= 1.1.1) - omniauth-oauth2 (>= 1.6) + omniauth (~> 2.0) + omniauth-oauth2 (~> 1.7.1) omniauth-mediawiki (0.0.4) jwt (~> 2.0) omniauth-oauth (~> 1.0) - omniauth-oauth (1.1.0) + omniauth-oauth (1.2.0) oauth - omniauth (~> 1.0) - omniauth-oauth2 (1.7.0) + omniauth (>= 1.0, < 3) + omniauth-oauth2 (1.7.1) oauth2 (~> 1.4) - omniauth (~> 1.9) - omniauth-openid (1.0.1) - omniauth (~> 1.0) - rack-openid (~> 1.3.1) + omniauth (>= 1.9, < 3) + omniauth-openid (2.0.1) + omniauth (>= 1.0, < 3.0) + rack-openid (~> 1.4.0) + omniauth-rails_csrf_protection (1.0.0) + actionpack (>= 4.2) + omniauth (~> 2.0) omniauth-windowslive (0.0.12) multi_json (~> 1.12) omniauth-oauth2 (~> 1.4) - openstreetmap-deadlock_retry (1.3.0) + openstreetmap-deadlock_retry (1.3.1) parallel (1.20.1) - parser (3.0.0.0) + parser (3.0.1.0) ast (~> 2.4.1) pg (1.2.3) popper_js (1.16.0) - progress (3.5.2) - psych (3.3.0) + progress (3.6.0) public_suffix (4.0.6) - puma (5.1.1) + puma (5.2.2) nio4r (~> 2.0) quad_tile (1.0.1) r2 (0.2.7) + racc (1.5.2) rack (2.2.3) rack-cors (1.1.1) rack (>= 2.0.0) - rack-openid (1.3.1) + rack-openid (1.4.2) rack (>= 1.1.0) ruby-openid (>= 2.1.8) + rack-protection (2.1.0) + rack rack-test (1.1.0) rack (>= 1.0, < 3) rack-uri_sanitizer (0.0.2) - rails (6.0.3.4) - actioncable (= 6.0.3.4) - actionmailbox (= 6.0.3.4) - actionmailer (= 6.0.3.4) - actionpack (= 6.0.3.4) - actiontext (= 6.0.3.4) - actionview (= 6.0.3.4) - activejob (= 6.0.3.4) - activemodel (= 6.0.3.4) - activerecord (= 6.0.3.4) - activestorage (= 6.0.3.4) - activesupport (= 6.0.3.4) + rails (6.0.3.6) + actioncable (= 6.0.3.6) + actionmailbox (= 6.0.3.6) + actionmailer (= 6.0.3.6) + actionpack (= 6.0.3.6) + actiontext (= 6.0.3.6) + actionview (= 6.0.3.6) + activejob (= 6.0.3.6) + activemodel (= 6.0.3.6) + activerecord (= 6.0.3.6) + activestorage (= 6.0.3.6) + activesupport (= 6.0.3.6) bundler (>= 1.3.0) - railties (= 6.0.3.4) + railties (= 6.0.3.6) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -366,9 +371,9 @@ GEM rails-i18n (6.0.0) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 7) - railties (6.0.3.4) - actionpack (= 6.0.3.4) - activesupport (= 6.0.3.4) + railties (6.0.3.6) + actionpack (= 6.0.3.6) + activesupport (= 6.0.3.6) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) @@ -377,27 +382,27 @@ GEM rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) - regexp_parser (1.8.2) + regexp_parser (2.1.1) request_store (1.5.0) rack (>= 1.4) - rexml (3.2.4) + rexml (3.2.5) rinku (2.0.6) rotp (6.2.0) - rubocop (0.93.1) + rubocop (1.13.0) parallel (~> 1.10) - parser (>= 2.7.1.5) + parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8) + regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 0.6.0) + rubocop-ast (>= 1.2.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.3.0) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.4.1) parser (>= 2.7.1.5) - rubocop-minitest (0.10.2) - rubocop (>= 0.87, < 2.0) - rubocop-performance (1.9.2) - rubocop (>= 0.90.0, < 2.0) + rubocop-minitest (0.12.1) + rubocop (>= 0.90, < 2.0) + rubocop-performance (1.11.0) + rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) rubocop-rails (2.9.1) activesupport (>= 4.2.0) @@ -405,9 +410,9 @@ GEM rubocop (>= 0.90.0, < 2.0) ruby-openid (2.9.2) ruby-progressbar (1.11.0) - ruby2_keywords (0.0.2) + ruby2_keywords (0.0.4) rubyzip (2.3.0) - sanitize (5.2.1) + sanitize (5.2.3) crass (~> 1.0.2) nokogiri (>= 1.8.0) nokogumbo (~> 2.0) @@ -419,11 +424,11 @@ GEM sprockets (> 3.0) sprockets-rails tilt - secure_headers (6.3.1) + secure_headers (6.3.2) selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) - simplecov (0.20.0) + simplecov (0.21.2) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) @@ -438,20 +443,20 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - strong_migrations (0.7.4) + strong_migrations (0.7.6) activerecord (>= 5) - thor (1.0.1) + thor (1.1.0) thread_safe (0.3.6) tilt (2.0.10) tzinfo (1.2.9) thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - unicode-display_width (1.7.0) + unicode-display_width (2.0.0) validates_email_format_of (1.6.3) i18n vendorer (0.2.0) - webmock (3.11.0) + webmock (3.12.2) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -474,7 +479,6 @@ DEPENDENCIES autoprefixer-rails aws-sdk-s3 better_errors - bigdecimal (~> 1.1.0) binding_of_caller bootsnap (>= 1.4.2) bootstrap (~> 4.5.0) @@ -488,9 +492,8 @@ DEPENDENCIES composite_primary_keys (~> 12.0.0) config dalli - debug_inspector (< 1.0.0) + debug_inspector delayed_job_active_record - dynamic_form erb_lint factory_bot_rails faraday @@ -508,32 +511,32 @@ DEPENDENCIES libxml-ruby (>= 2.0.5) listen logstasher + marcel maxminddb - mimemagic mini_magick minitest (~> 5.1) oauth-plugin (>= 0.5.1) - omniauth + omniauth (~> 2.0.2) omniauth-facebook omniauth-github omniauth-google-oauth2 (>= 0.6.0) omniauth-mediawiki (>= 0.0.4) omniauth-openid + omniauth-rails_csrf_protection (~> 1.0) omniauth-windowslive - openstreetmap-deadlock_retry (>= 1.3.0) + openstreetmap-deadlock_retry (>= 1.3.1) pg - psych puma (~> 5.0) quad_tile (~> 1.0.1) r2 (~> 0.2.7) rack-cors rack-uri_sanitizer - rails (= 6.0.3.4) + rails (= 6.0.3.6) rails-controller-testing rails-i18n (~> 6.0.0) rinku (>= 2.0.6) rotp - rubocop (~> 0.93) + rubocop rubocop-minitest rubocop-performance rubocop-rails @@ -550,4 +553,4 @@ DEPENDENCIES webmock BUNDLED WITH - 2.1.4 + 2.2.16 diff --git a/INSTALL.md b/INSTALL.md index e3c5299a5..c8811fc3f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -3,7 +3,11 @@ These instructions are designed for setting up The Rails Port for development and testing. If you want to deploy the software for your own project, then see the notes at the end. -You can install the software directly on your machine, which is the traditional and probably best-supported approach. However, there is an alternative which may be easier: Vagrant. This installs the software into a virtual machine, which makes it easier to get a consistent development environment and may avoid installation difficulties. For Vagrant instructions, see [VAGRANT.md](VAGRANT.md). +You can install the software directly on your machine, which is the traditional and probably best-supported approach. However, there +are two alternatives which make it easier to get a consistent development environment and may avoid installation difficulties: + +* **Vagrant** This installs the software into a virtual machine. For Vagrant instructions see [VAGRANT.md](VAGRANT.md). +* **Docker** This installs the software using containerization. For Docker instructions see [DOCKER.md](DOCKER.md). These instructions are based on Ubuntu 20.04 LTS, which is the platform used by the OSMF servers. The instructions also work, with only minor amendments, for all other current Ubuntu releases, Fedora and MacOSX @@ -28,7 +32,7 @@ These can be installed on Ubuntu 20.04 or later with: ``` sudo apt-get update -sudo apt-get install ruby2.7 libruby2.7 ruby2.7-dev bundler \ +sudo apt-get install ruby2.7 libruby2.7 ruby2.7-dev \ libmagickwand-dev libxml2-dev libxslt1-dev nodejs \ apache2 apache2-dev build-essential git-core firefox-geckodriver \ postgresql postgresql-contrib libpq-dev libsasl2-dev \ @@ -240,7 +244,7 @@ After installing this software, you may need to carry out some [configuration st # Installing compiled shared library database functions (optional) -There are special database functions required by a (little-used) API call, the migrations and diff replication. The former two are provided as *either* pure SQL functions or a compiled shared library. The SQL versions are installed as part of the recommended install procedure above and the shared library versions are recommended only if you are running a production server making a lot of `/changes` API calls or need the diff replication functionality. +There are special database functions required by a (little-used) API call, the migrations and diff replication. The former two are provided as *either* pure SQL functions or a compiled shared library. The SQL versions are installed as part of the recommended install procedure above and the shared library versions are recommended only if you are running a production server and need the diff replication functionality. If you aren't sure which you need, stick with the SQL versions. @@ -267,14 +271,12 @@ cd ../.. If you previously installed the SQL versions of these functions, we'll need to delete those before adding the new ones: ``` -psql -d openstreetmap -c "DROP FUNCTION IF EXISTS maptile_for_point" psql -d openstreetmap -c "DROP FUNCTION IF EXISTS tile_for_point" ``` Then we create the functions within each database. We're using `pwd` to substitute in the current working directory, since PostgreSQL needs the full path. ``` -psql -d openstreetmap -c "CREATE FUNCTION maptile_for_point(int8, int8, int4) RETURNS int4 AS '`pwd`/db/functions/libpgosm', 'maptile_for_point' LANGUAGE C STRICT" psql -d openstreetmap -c "CREATE FUNCTION tile_for_point(int4, int4) RETURNS int8 AS '`pwd`/db/functions/libpgosm', 'tile_for_point' LANGUAGE C STRICT" psql -d openstreetmap -c "CREATE FUNCTION xid_to_int4(xid) RETURNS int4 AS '`pwd`/db/functions/libpgosm', 'xid_to_int4' LANGUAGE C STRICT" ``` diff --git a/README.md b/README.md index 9d5ac53eb..b96a77671 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This repository consists of: * The web site, including user accounts, diary entries, user-to-user messaging. * The XML-based editing [API](https://wiki.openstreetmap.org/wiki/API_v0.6). -* The integrated versions of the [Potlatch](https://wiki.openstreetmap.org/wiki/Potlatch_1), [Potlatch 2](https://wiki.openstreetmap.org/wiki/Potlatch_2) and [iD](https://wiki.openstreetmap.org/wiki/ID) editors. +* The integrated version of the [iD](https://wiki.openstreetmap.org/wiki/ID) editors. * The Browse pages - a web front-end to the OpenStreetMap data. * The GPX uploads, browsing and API. diff --git a/Vendorfile b/Vendorfile index d00557322..6b586f9ce 100644 --- a/Vendorfile +++ b/Vendorfile @@ -46,11 +46,4 @@ folder 'vendor/assets' do file 'es5.js', 'https://polyfill.io/v3/polyfill.js?features=es5&flags=gated,always' file 'es6.js', 'https://polyfill.io/v3/polyfill.js?features=es6&flags=gated,always' end - - folder 'swfobject' do - from 'git://github.com/swfobject/swfobject.git', :tag => '2.2' do - file 'expressInstall.swf', 'swfobject/expressInstall.swf' - file 'swfobject.js', 'swfobject/src/swfobject.js' - end - end end diff --git a/app/abilities/ability.rb b/app/abilities/ability.rb index d91b7a2e7..9c832b43a 100644 --- a/app/abilities/ability.rb +++ b/app/abilities/ability.rb @@ -16,11 +16,14 @@ class Ability if Settings.status != "database_offline" can [:index, :feed], Changeset can :index, ChangesetComment + can [:confirm, :confirm_resend, :confirm_email], :confirmation can [:index, :rss, :show, :comments], DiaryEntry can [:index], Note + can [:lost_password, :reset_password], :password can [:index, :show], Redaction + can [:new, :create, :destroy], :session can [:index, :show, :data, :georss, :picture, :icon], Trace - can [:terms, :login, :logout, :new, :create, :save, :confirm, :confirm_resend, :confirm_email, :lost_password, :reset_password, :show, :auth_success, :auth_failure], User + can [:terms, :new, :create, :save, :show, :auth_success, :auth_failure], User can [:index, :show, :blocks_on, :blocks_by], UserBlock can [:index, :show], Node can [:index, :show, :full, :ways_for_node], Way diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 97d6f8b98..8d66a7fef 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -19,12 +19,6 @@ //= link_directory ../../../vendor/assets/polyfill .js -//= link_directory ../../../vendor/assets/potlatch2/help -//= link_tree ../../../vendor/assets/potlatch2 .swf -//= link_tree ../../../vendor/assets/potlatch2 .zip - -//= link_directory ../../../vendor/assets/swfobject - //= link html5shiv/dist/html5shiv.js //= link leaflet/dist/images/marker-icon.png diff --git a/app/assets/favicons/manifest.json.erb b/app/assets/favicons/manifest.json.erb index 8938f2cd9..0826e8841 100644 --- a/app/assets/favicons/manifest.json.erb +++ b/app/assets/favicons/manifest.json.erb @@ -37,5 +37,7 @@ "type": "image\/png", "density": "4.0" } - ] + ], + "start_url": "/", + "display": "minimal-ui" } diff --git a/app/assets/images/banners/banner_community_survey_200124.png b/app/assets/images/banners/banner_community_survey_200124.png new file mode 100644 index 000000000..2664ca860 Binary files /dev/null and b/app/assets/images/banners/banner_community_survey_200124.png differ diff --git a/app/assets/images/banners/osm_16_birthday.png b/app/assets/images/banners/osm_16_birthday.png deleted file mode 100644 index 39e1fb9c7..000000000 Binary files a/app/assets/images/banners/osm_16_birthday.png and /dev/null differ diff --git a/app/assets/javascripts/edit/potlatch.js.erb b/app/assets/javascripts/edit/potlatch.js.erb deleted file mode 100644 index d55d2eab2..000000000 --- a/app/assets/javascripts/edit/potlatch.js.erb +++ /dev/null @@ -1,61 +0,0 @@ -//= require swfobject - -$(document).ready(function () { - window.changesaved = true; - - window.markChanged = function (saved) { - window.changesaved = saved; - } - - $(window).on("beforeunload", function() { - if (!window.changesaved) { - return I18n.t("site.edit.potlatch_unsaved_changes"); - } - }); - - window.updatelinks = function (lon, lat, zoom, layers, minlon, minlat, maxlon, maxlat, object) { - var hash = OSM.formatHash({ lon: lon, lat: lat, zoom: zoom }); - - if (hash !== location.hash) { - location.replace(hash); - } - - updateLinks({ lon: lon, lat: lat }, zoom); - } - - var potlatch = $("#potlatch"), - urlparams = OSM.params(), - potlatch_swf = <%= asset_path("potlatch/potlatch.swf").to_json %>, - install_swf = <%= asset_path("expressInstall.swf").to_json %>, - flashvars = {}, - params = {}, - attributes = {}; - - flashvars.winie = document.all && window.print ? true : false; - flashvars.token = potlatch.data("token"); - - if (potlatch.data("lat") && potlatch.data("lon")) { - flashvars.lat = potlatch.data("lat"); - flashvars.long = potlatch.data("lon"); - flashvars.scale = potlatch.data("zoom"); - } else { - var mapParams = OSM.mapParams(); - - flashvars.lat = mapParams.lat; - flashvars.long = mapParams.lon; - flashvars.scale = mapParams.zoom || 17; - } - - if (flashvars.scale < 11) flashvars.scale = 11; - - if (urlparams.gpx) flashvars.gpx = urlparams.gpx; - if (urlparams.way) flashvars.way = urlparams.way; - if (urlparams.node) flashvars.node = urlparams.node; - if (urlparams.custombg) flashvars.custombg = urlparams.custombg; - - attributes.id = "potlatch"; - attributes.bgcolor = "#FFFFFF"; - - swfobject.embedSWF(potlatch_swf, "potlatch", "100%", "100%", "6", - install_swf, flashvars, params, attributes); -}); diff --git a/app/assets/javascripts/edit/potlatch2.js.erb b/app/assets/javascripts/edit/potlatch2.js.erb deleted file mode 100644 index d5c6ecd7d..000000000 --- a/app/assets/javascripts/edit/potlatch2.js.erb +++ /dev/null @@ -1,83 +0,0 @@ -//= require swfobject - -$(document).ready(function () { - window.changesaved = true; - - window.markChanged = function (saved) { - window.changesaved = saved; - } - - $(window).on("beforeunload", function() { - if (!window.changesaved) { - return I18n.t("site.edit.potlatch2_unsaved_changes"); - } - }); - - window.mapMoved = $.throttle(250, function(lon, lat, zoom) { - var hash = OSM.formatHash({ lon: lon, lat: lat, zoom: zoom }); - - if (hash !== location.hash) { - location.replace(hash); - } - - updateLinks({ lon: lon, lat: lat }, zoom); - }); - - var potlatch = $("#potlatch"), - urlparams = OSM.params(), - potlatch_swf = <%= asset_path("potlatch2.swf").to_json %>, - install_swf = <%= asset_path("expressInstall.swf").to_json %>, - flashvars = {}, - params = {}; - attributes = {}; - - if (potlatch.data("lat") && potlatch.data("lon")) { - flashvars.lat = potlatch.data("lat"); - flashvars.lon = potlatch.data("lon"); - flashvars.zoom = potlatch.data("zoom"); - } else { - var mapParams = OSM.mapParams(); - - flashvars.lat = mapParams.lat; - flashvars.lon = mapParams.lon; - flashvars.zoom = mapParams.zoom || 17; - } - - if (potlatch.data("token")) { - flashvars.oauth_token = potlatch.data("token"); - flashvars.oauth_token_secret = potlatch.data("token-secret"); - flashvars.oauth_consumer_key = potlatch.data("consumer-key"); - flashvars.oauth_consumer_secret = potlatch.data("consumer-secret"); - } else { - alert(I18n.t("site.edit.potlatch2_not_configured")); - } - - flashvars.assets = <%= asset_path("potlatch2/assets.zip").to_json %>; - flashvars.font_library = <%= asset_path("potlatch2/FontLibrary.swf").to_json %>; - flashvars.locale = potlatch.data("locale"); - flashvars.locale_paths = potlatch.data("locale") + "=" + potlatch.data("locale-path"); - flashvars.intro_image = <%= asset_path("help/introduction.jpg").to_json %>; - flashvars.intro_video = <%= asset_path("help/introduction.mp4").to_json %>; - if (urlparams.gpx) flashvars.gpx = urlparams.gpx; - if (urlparams.tileurl) flashvars.tileurl = urlparams.tileurl; - flashvars.api = location.protocol + "//" + location.host + "/api/" + OSM.API_VERSION + "/"; - flashvars.policy = location.protocol + "//" + location.host + "/api/crossdomain.xml"; - flashvars.connection = "XML"; - flashvars.show_help = "once"; - flashvars.user_check = "warn"; - flashvars.maximise_function = "maximiseMap"; - flashvars.minimise_function = "minimiseMap"; - flashvars.move_function = "mapMoved"; - - params.base = "/potlatch2"; - - attributes.id = "potlatch"; - attributes.bgcolor = "#FFFFFF"; - - swfobject.embedSWF(potlatch_swf, "potlatch", "100%", "100%", "10.1.102", - install_swf, flashvars, params, attributes); - - if (flashvars.lat && flashvars.lon) { - updateLinks({ lon: flashvars.lon, lat: flashvars.lat }, flashvars.scale); - } -}); diff --git a/app/assets/javascripts/embed.js.erb b/app/assets/javascripts/embed.js.erb index 2ced018b2..d3b1ad4b2 100644 --- a/app/assets/javascripts/embed.js.erb +++ b/app/assets/javascripts/embed.js.erb @@ -39,6 +39,8 @@ window.onload = function () { if (!args.layer || args.layer === "mapnik" || args.layer === "osmarender" || args.layer === "mapquest") { new L.OSM.Mapnik(mapnikOptions).addTo(map); + } else if (args.layer === "cyclosm") { + new L.OSM.CyclOSM().addTo(map); } else if (args.layer === "cyclemap" || args.layer === "cycle map") { new L.OSM.CycleMap(thunderforestOptions).addTo(map); } else if (args.layer === "transportmap") { diff --git a/app/assets/javascripts/id.js b/app/assets/javascripts/id.js index 889a39f86..ac18da06f 100644 --- a/app/assets/javascripts/id.js +++ b/app/assets/javascripts/id.js @@ -8,7 +8,7 @@ document.addEventListener("DOMContentLoaded", function () { if (typeof iD === "undefined" || !iD.utilDetect().support) { container.innerHTML = "This editor is supported " + "in Firefox, Chrome, Safari, Opera, Edge, and Internet Explorer 11. " + - "Please upgrade your browser or use Potlatch 2 to edit the map."; + "Please upgrade your browser or use JOSM to edit the map."; container.className = "unsupported"; } else { var id = iD.coreContext() diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 68beefeb6..a2169643f 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -108,9 +108,9 @@ $(document).ready(function () { iconLoading: "icon geolocate", strings: { title: I18n.t("javascripts.map.locate.title"), - metersUnit: I18n.t("javascripts.map.locate.metersUnit"), - feetUnit: I18n.t("javascripts.map.locate.feetUnit"), - popup: I18n.t("javascripts.map.locate.popup") + popup: function (options) { + return I18n.t("javascripts.map.locate." + options.unit + "Popup", { count: options.distance }); + } } }).addTo(map); @@ -189,7 +189,7 @@ $(document).ready(function () { map._object); $.removeCookie("_osm_location"); - $.cookie("_osm_location", OSM.locationCookie(map), { expires: expiry, path: "/" }); + $.cookie("_osm_location", OSM.locationCookie(map), { secure: true, expires: expiry, path: "/" }); }); if ($.cookie("_osm_welcome") !== "hide") { @@ -198,7 +198,7 @@ $(document).ready(function () { $(".welcome .close").on("click", function () { $(".welcome").removeClass("visible"); - $.cookie("_osm_welcome", "hide", { expires: expiry, path: "/" }); + $.cookie("_osm_welcome", "hide", { secure: true, expires: expiry, path: "/" }); }); var bannerExpiry = new Date(); @@ -209,7 +209,7 @@ $(document).ready(function () { $("#banner").hide(); e.preventDefault(); if (cookieId) { - $.cookie(cookieId, "hide", { expires: bannerExpiry, path: "/" }); + $.cookie(cookieId, "hide", { secure: true, expires: bannerExpiry, path: "/" }); } }); diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 6efde27c6..a58b0af16 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -334,10 +334,8 @@ OSM.Directions = function (map) { select.on("change", function (e) { chosenEngine = engines[e.target.selectedIndex]; - $.cookie("_osm_directions_engine", chosenEngine.id, { expires: expiry, path: "/" }); - if (map.hasLayer(polyline)) { - getRoute(true, true); - } + $.cookie("_osm_directions_engine", chosenEngine.id, { secure: true, expires: expiry, path: "/" }); + getRoute(true, true); }); $(".directions_form").on("submit", function (e) { diff --git a/app/assets/javascripts/leaflet.layers.js b/app/assets/javascripts/leaflet.layers.js index f375dc08f..5c5e43c5c 100644 --- a/app/assets/javascripts/leaflet.layers.js +++ b/app/assets/javascripts/leaflet.layers.js @@ -119,7 +119,7 @@ L.OSM.layers = function (options) { .attr("class", "text-muted") .appendTo(overlaySection); - var overlays = $(" <% end %> -<% if @user_block.revoker %> -

- <%= t ".revoker" %> - <%= link_to @user_block.revoker.display_name, user_path(@user_block.revoker) %> -

-<% end %> - -

<%= t ".created" %>: <%= friendly_date_ago(@user_block.created_at) %>

- -

<%= t ".status" %>: <%= block_status(@user_block) %>

+
+ <% if @user_block.revoker %> +
<%= t ".revoker" %>
+
<%= link_to @user_block.revoker.display_name, user_path(@user_block.revoker) %>
+ <% end %> -

<%= t ".reason" %>

-
<%= @user_block.reason.to_html %>
+
<%= t ".created" %>
+
<%= friendly_date_ago(@user_block.created_at) %>
+
<%= t ".duration" %>
+
<%= block_duration_in_words(@user_block.ends_at - @user_block.created_at) %>
+
<%= t ".status" %>
+
<%= block_status(@user_block) %>
+
<%= t ".reason" %>
+
<%= @user_block.reason.to_html %>
+
diff --git a/app/views/users/_contact.html.erb b/app/views/users/_contact.html.erb index d46a61984..a5b29411c 100644 --- a/app/views/users/_contact.html.erb +++ b/app/views/users/_contact.html.erb @@ -22,7 +22,7 @@ <% changeset = contact.changesets.first %> <% if changeset %> <%= t("users.show.latest edit", :ago => time_ago_in_words(changeset.created_at, :scope => :'datetime.distance_in_words_ago')) %> - <% comment = changeset.tags["comment"].to_s != "" ? changeset.tags["comment"] : t("browse.no_comment") %> + <% comment = changeset.tags["comment"].to_s == "" ? t("browse.no_comment") : changeset.tags["comment"] %> <%= link_to(comment, { :controller => "browse", :action => "changeset", :id => changeset.id }, { :title => t("changesets.changeset.view_changeset_details") }) %> diff --git a/app/views/users/account.html.erb b/app/views/users/account.html.erb index ad6614c76..10b33063e 100644 --- a/app/views/users/account.html.erb +++ b/app/views/users/account.html.erb @@ -10,166 +10,104 @@ <% end %> -<%= error_messages_for current_user %> -<%= form_for current_user, :url => { :action => :account }, :method => :post, :html => { :multipart => true, :id => "accountForm", :class => "standard-form", :autocomplete => :off } do |f| %> -
-
- - <%= f.text_field :display_name %> -
-
- -
-
- - - <%= t ".email never displayed publicly" %> -
- -
- - <%= f.email_field :new_email, :autocomplete => :off %> - <%= t ".email never displayed publicly" %> +<%= bootstrap_form_for current_user, :url => { :action => :account }, :method => :post, :html => { :multipart => true, :id => "accountForm", :autocomplete => :off } do |f| %> + + <%= f.text_field :display_name %> + <%= f.email_field :email, :disabled => true, :label => t(".current email address") %> + <%= f.email_field :new_email, :autocomplete => "email" %> + <%= f.password_field :pass_crypt, :value => "", :autocomplete => "new-password" %> + <%= f.password_field :pass_crypt_confirmation, :value => "", :autocomplete => "new-password" %> + +
+ +
+ <%= f.select(:auth_provider, Auth.providers, :hide_label => true, :wrapper => { :class => "col-auto mb-0" }) %> + <%= f.text_field(:auth_uid, :hide_label => true, :wrapper => { :class => "col mb-0" }) %>
+ (" target="_new"><%= t ".openid.link text" %>)
-
-
- - <%= f.password_field :pass_crypt, :value => "", :autocomplete => :off %> -
- -
- - <%= f.password_field :pass_crypt_confirmation, :value => "", :autocomplete => :off %> -
-
- -
-
- - <%= f.select :auth_provider, Auth.providers %> - <%= f.text_field :auth_uid %> - (" target="_new"><%= t ".openid.link text" %>) -
-
- -
-
- - - <% if current_user.data_public? %> - <%= t ".public editing.enabled" %> - (" target="_new"><%= t ".public editing.enabled link text" %>) - <% else %> - <%= t ".public editing.disabled" %> - (<%= t ".public editing.disabled link text" %>) - <% end %> - -
- -
- - - <% if current_user.terms_agreed? %> - <%= t ".contributor terms.agreed" %> - (" target="_new"><%= t ".contributor terms.link text" %>) - <% if current_user.consider_pd? %> - <%= t ".contributor terms.agreed_with_pd" %> - <% end %> - <% else %> - <%= t ".contributor terms.not yet agreed" %> - <%= link_to t(".contributor terms.review link text"), :controller => "users", :action => "terms" %> +
+ + + <% if current_user.data_public? %> + <%= t ".public editing.enabled" %> + (" target="_new"><%= t ".public editing.enabled link text" %>) + <% else %> + <%= t ".public editing.disabled" %> + (<%= t ".public editing.disabled link text" %>) + <% end %> + +
+ +
+ + + <% if current_user.terms_agreed? %> + <%= t ".contributor terms.agreed" %> + (" target="_new"><%= t ".contributor terms.link text" %>) + <% if current_user.consider_pd? %> + <%= t ".contributor terms.agreed_with_pd" %> <% end %> - -
-
- - <%= f.select :preferred_editor, [[t("editor.default", :name => t("editor.#{Settings.default_editor}.name")), "default"]] + Editors::ALL_EDITORS.collect { |e| [t("editor.#{e}.description"), e] } %> -
-
- -
-
- - <%= richtext_area :user, :description, :object => current_user, :cols => 80, :rows => 20 %> -
- -
- - <%= f.text_field :languages %> -
- -
- + <% else %> + <%= t ".contributor terms.not yet agreed" %> + <%= link_to t(".contributor terms.review link text"), :controller => "users", :action => "terms" %> + <% end %> + +
+ + <%= f.select :preferred_editor, [[t("editor.default", :name => t("editor.#{Settings.default_editor}.name")), "default"]] + Editors::AVAILABLE_EDITORS.collect { |e| [t("editor.#{e}.description"), e] } %> + <%= f.richtext_field :description, :cols => 80, :rows => 20 %> + <%= f.text_field :languages %> + +
+ <%= f.label t(".image") %> +
+
<%= user_image current_user %> -
    +
+
<% if current_user.avatar.attached? %> -
  • - <%= radio_button_tag "avatar_action", "keep", !current_user.image_use_gravatar %> - -
  • + <%= f.radio_button "avatar_action", "keep", :name => "avatar_action", :label => t(".keep image"), :checked => !current_user.image_use_gravatar %> <% end %> <% if current_user.avatar.attached? || current_user.image_use_gravatar? %> -
  • - <%= radio_button_tag "avatar_action", "delete" %> - -
  • + <%= f.radio_button "avatar_action", "delete", :name => "avatar_action", :label => t(".delete image"), :checked => false %> <% end %> <% if current_user.avatar.attached? %> -
  • - <%= radio_button_tag "avatar_action", "new" %> - - <%= f.file_field :avatar %> -
  • + <%= f.form_group :help => t(".image size hint"), :class => "mb-0" do %> + <%= f.radio_button "avatar_action", "new", :name => "avatar_action", :label => t(".replace image"), :checked => false %> + <%= f.file_field :avatar, :hide_label => true, :wrapper => { :class => "mb-0" } %> + <% end %> <% else %> -
  • - <%= radio_button_tag "avatar_action", "new" %> - - <%= f.file_field :avatar %> -
  • + <%= f.form_group :help => t(".image size hint"), :class => "mb-0" do %> + <%= f.radio_button "avatar_action", "new", :name => "avatar_action", :label => t(".new image"), :checked => false %> + <%= f.file_field :avatar, :hide_label => true, :wrapper => { :class => "mb-0" } %> + <% end %> <% end %> -
  • - <%= radio_button_tag "avatar_action", "gravatar", current_user.image_use_gravatar %> - -
  • - + <%= f.form_group :help => link_to(t(".gravatar.what_is_gravatar"), t(".gravatar.link")) do %> + <%= f.radio_button "avatar_action", "gravatar", :name => "avatar_action", :label => t(".gravatar.gravatar"), :checked => current_user.image_use_gravatar %> + <% end %> +
    -
    -
    - +
    + <%= t ".home location" -%>
    class="nohome"<% end %>> -

    <%= t ".no home location" %>

    -
    - - <%= f.text_field :home_lat, :id => "home_lat" %> -
    -
    - - <%= f.text_field :home_lon, :id => "home_lon" %> -
    +

    <%= t ".no home location" %>

    +
    + <%= f.text_field :home_lat, :wrapper_class => "col-sm-4", :id => "home_lat" %> + <%= f.text_field :home_lon, :wrapper_class => "col-sm-4", :id => "home_lon" %>
    - -
    - checked="checked" <% end %> id="updatehome" /> - +
    + checked="checked" <% end %> id="updatehome" /> +
    <%= tag.div "", :id => "map", :class => "content_map set_location" %>
    - <%= submit_tag t(".save changes button") %> + <%= f.primary t(".save changes button") %> <% end %> <% unless current_user.data_public? %> diff --git a/app/views/users/login.html.erb b/app/views/users/login.html.erb deleted file mode 100644 index 365245bf0..000000000 --- a/app/views/users/login.html.erb +++ /dev/null @@ -1,91 +0,0 @@ -<% content_for :head do %> - <%= javascript_include_tag "login" %> -<% end %> - -<% content_for :heading do %> -

    <%= t ".heading" %>

    -<% end %> - -
    - <%= form_tag({ :action => "login" }, { :id => "login_form" }) do %> - <%= hidden_field_tag("referer", h(params[:referer])) %> - -

    <%= t ".no account" %> <%= link_to t(".register now"), :action => :new, :referer => params[:referer] %>

    - -
    - -
    -
    - - <%= text_field_tag "username", params[:username], :tabindex => 1 %> -
    -
    - - <%= password_field_tag "password", "", :tabindex => 2 %> -
    - - <%= link_to t(".lost password link"), :controller => "users", :action => "lost_password" %> - -
    - -
    - <%= check_box_tag "remember_me", "yes", params[:remember_me] == "yes", :tabindex => 3 %> - - <%= submit_tag t(".login_button"), :tabindex => 4 %> -
    - -
    - - <% end %> - - <%= form_tag(auth_path(:provider => "openid"), :id => "openid_login_form") do %> -
    - -
    - -

    <%= t ".with external" %>

    - -
      -
    • <%= link_to image_tag("openid.png", :alt => t(".auth_providers.openid.title")), "#", :id => "openid_open_url", :title => t(".auth_providers.openid.title") %>
    • - <% if Settings.key?(:google_auth_id) -%> -
    • <%= auth_button "google", "google" %>
    • - <% end -%> - <% if Settings.key?(:facebook_auth_id) -%> -
    • <%= auth_button "facebook", "facebook" %>
    • - <% end -%> - <% if Settings.key?(:windowslive_auth_id) -%> -
    • <%= auth_button "windowslive", "windowslive" %>
    • - <% end -%> - <% if Settings.key?(:github_auth_id) -%> -
    • <%= auth_button "github", "github" %>
    • - <% end -%> - <% if Settings.key?(:wikipedia_auth_id) -%> -
    • <%= auth_button "wikipedia", "wikipedia" %>
    • - <% end -%> -
    • <%= auth_button "yahoo", "openid", :openid_url => "yahoo.com" %>
    • -
    • <%= auth_button "wordpress", "openid", :openid_url => "wordpress.com" %>
    • -
    • <%= auth_button "aol", "openid", :openid_url => "aol.com" %>
    • -
    - -
    - - <%= hidden_field_tag("openid_referer", params[:referer]) if params[:referer] %> - <%= text_field_tag("openid_url", "", :tabindex => 3, :class => "openid_url") %> - (" target="_new"><%= t "users.account.openid.link text" %>) -
    - - <%= submit_tag t(".login_button"), :tabindex => 6, :id => "login_openid_submit" %> - -
    - -
    - - <% end %> - -
    diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 6f97a284a..264fc8e02 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -15,72 +15,31 @@
    - <%= form_for current_user, :url => { :action => "create" }, :html => { :class => "standard-form" } do |f| %> + <%= bootstrap_form_for current_user, :url => { :action => "create" } do |f| %> <%= hidden_field_tag("referer", h(@referer)) unless @referer.nil? %> -
    -
    - - <%= f.email_field(:email, :tabindex => 1) %> - <%= f.error_message_on(:email) %> -
    -
    - - <%= f.email_field(:email_confirmation, :tabindex => 2) %> - <%= f.error_message_on(:email_confirmation) %> -
    - <%= t(".not_displayed_publicly_html") %> -
    + <%= f.email_field :email, :tabindex => 1 %> + <%= f.email_field :email_confirmation, :tabindex => 2 %> -
    -
    - - <%= f.text_field(:display_name, :tabindex => 3) %> - <%= f.error_message_on(:display_name) %> -
    - <%= t ".display name description" %> -
    + <%= f.text_field :display_name, :help => t(".display name description"), :tabindex => 3 %> -
    -
    - - <%= f.select(:auth_provider, Auth.providers, :default => "", :tabindex => 4) %> - <%= f.text_field(:auth_uid, :tabindex => 5) %> - <%= f.error_message_on(:auth_uid) %> +
    + +
    + <%= f.select(:auth_provider, Auth.providers, :default => "", :hide_label => true, :wrapper => { :class => "col-auto mb-0" }, :tabindex => 4) %> + <%= f.text_field(:auth_uid, :hide_label => true, :wrapper => { :class => "col mb-0" }, :tabindex => 5) %>
    - <%= t ".auth no password" %> + <%= t ".auth no password" %>
    -
    -
    - - <%= f.password_field(:pass_crypt, :tabindex => 6) %> - <%= f.error_message_on(:pass_crypt) %> -
    -
    - - <%= f.password_field(:pass_crypt_confirmation, :tabindex => 7) %> - <%= f.error_message_on(:pass_crypt_confirmation) %> -
    -
    + <%= f.password_field :pass_crypt, :tabindex => 6 %> + <%= f.password_field :pass_crypt_confirmation, :tabindex => 7 %> -
    - <%= link_to t(".use external auth"), "#", :id => "auth_enable" %> +
    +

    <%= link_to t(".use external auth"), "#", :id => "auth_enable" %>

    - <%= submit_tag t(".continue"), :tabindex => 8 %> + <%= f.primary t(".continue"), :tabindex => 8 %> <% end %>
    diff --git a/app/views/users/terms.html.erb b/app/views/users/terms.html.erb index b3e42189b..99af8b841 100644 --- a/app/views/users/terms.html.erb +++ b/app/views/users/terms.html.erb @@ -7,22 +7,21 @@
    <% end %> -<%= form_tag({ :action => "save" }, { :class => "standard-form fillL" }) do %> +<%= form_tag({ :action => "save" }) do %>

    <%= t ".read and accept with tou" %>

    <%= t ".heading_ct" %>

    -
    -

    <%= t ".contributor_terms_explain" %>

    - - +

    <%= t ".contributor_terms_explain" %>

    + +
    <% [%w[france FR], %w[italy IT], %w[rest_of_world GB]].each do |name, legale| %> -
    -
    -
    - +
    +
    + <%= check_box_tag "read_ct", "1", false, :class => "form-check-input" %> + +

    <%= t "layouts.tou" %>

    <%= t ".tou_explain_html", :tou_link => link_to(t("layouts.tou"), "https://wiki.osmfoundation.org/wiki/Terms_of_Use", :target => :new) %>

    -
    - - - <%= hidden_field_tag("referer", h(params[:referer])) unless params[:referer].nil? %> -
    - <%= submit_tag("Continue", :name => "continue", :id => "continue", :disabled => true) %> - <%= submit_tag("Cancel", :name => "decline", :id => "decline") %> +
    +
    + <%= check_box_tag "read_tou", "1", false, :class => "form-check-input" %> +
    +
    + + <%= hidden_field_tag("referer", h(params[:referer])) unless params[:referer].nil? %> -