## Application configuration
-Many settings are available in `config/settings.yml`. You can customize your installation of The Rails Port by overriding these values using `config/settings.local.yml`
+Many settings are available in `config/settings.yml`. You can customize your installation of `openstreetmap-website` by overriding these values using `config/settings.local.yml`
## Populating the database
If your installation stops working for some reason:
-* Sometimes gem dependencies change. To update go to your rails_port directory and run ''bundle install'' as root.
+* Sometimes gem dependencies change. To update go to your `openstreetmap-website` directory and run ''bundle install'' as root.
-* The OSM database schema is changed periodically and you need to keep up with these improvements. Go to your rails_port directory and run:
+* The OSM database schema is changed periodically and you need to keep up with these improvements. Go to your `openstreetmap-website` directory and run:
```
bundle exec rake db:migrate
## Testing on the osm dev server
-For example, after developing a patch for the rails_port, you might want to demonstrate it to others or ask for comments and testing. To do this one can [set up an instance of the rails_port on the dev server in ones user directory](https://wiki.openstreetmap.org/wiki/Using_the_dev_server#Rails_Applications).
+For example, after developing a patch for `openstreetmap-website`, you might want to demonstrate it to others or ask for comments and testing. To do this you can [set up an instance of openstreetmap-website on the dev server in your user directory](https://wiki.openstreetmap.org/wiki/Using_the_dev_server#Rails_Applications).
# Contributing
# Production Deployment
-If you want to deploy The Rails Port for production use, you'll need to make a few changes.
+If you want to deploy `openstreetmap-website` for production use, you'll need to make a few changes.
* It's not recommended to use `rails server` in production. Our recommended approach is to use [Phusion Passenger](https://www.phusionpassenger.com/). Instructions are available for [setting it up with most web servers](https://www.phusionpassenger.com/documentation_and_support#documentation).
* Passenger will, by design, use the Production environment and therefore the production database - make sure it contains the appropriate data and user accounts.
## Testing
Having a good suite of tests is very important to the stability and
-maintainability of any code base. The tests in the Rails port code are
+maintainability of any code base. The tests in the `openstreetmap-website` code are
by no means complete, but they are extensive, and must continue to be
so with any new functionality which is written. Tests are also useful
in giving others confidence in the code you've written, and can
# 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:
+These instructions are designed for setting up `openstreetmap-website` 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/)
source "https://rubygems.org"
# Require rails
-gem "rails", "7.0.4"
+gem "rails", "~> 7.0.0"
# Require json for multi_json
gem "json"
r2 (~> 0.2.7)
rack-cors
rack-uri_sanitizer
- rails (= 7.0.4)
+ rails (~> 7.0.0)
rails-controller-testing
rails-i18n (~> 7.0.0)
rinku (>= 2.0.6)
# Installation
-These instructions are designed for setting up The Rails Port for development and testing.
+These instructions are designed for setting up `openstreetmap-website` 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
## Storage setup
-The Rails port needs to be configured with an object storage facility - for
+`openstreetmap-website` needs to be configured with an object storage facility - for
development and testing purposes you can use the example configuration:
```
## Database setup
-The Rails Port uses three databases - one for development, one for testing, and one for production. The database-specific configuration
+`openstreetmap-website` uses three databases - one for development, one for testing, and one for production. The database-specific configuration
options are stored in `config/database.yml`, which we need to create from the example template.
```
-# "The Rails Port"
+# openstreetmap-website
[![Lint](https://github.com/openstreetmap/openstreetmap-website/workflows/Lint/badge.svg?branch=master&event=push)](https://github.com/openstreetmap/openstreetmap-website/actions?query=workflow%3ALint%20branch%3Amaster%20event%3Apush)
[![Tests](https://github.com/openstreetmap/openstreetmap-website/workflows/Tests/badge.svg?branch=master&event=push)](https://github.com/openstreetmap/openstreetmap-website/actions?query=workflow%3ATests%20branch%3Amaster%20event%3Apush)
[![Coverage Status](https://coveralls.io/repos/openstreetmap/openstreetmap-website/badge.svg?branch=master)](https://coveralls.io/r/openstreetmap/openstreetmap-website?branch=master)
-This is The Rails Port, the [Ruby on Rails](http://rubyonrails.org/)
+This is `openstreetmap-website`, the [Ruby on Rails](http://rubyonrails.org/)
application that powers the [OpenStreetMap](https://www.openstreetmap.org) website and API.
-The software is also known as "openstreetmap-website".
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 version of the [iD](https://wiki.openstreetmap.org/wiki/ID) editors.
+* The XML- and JSON-based editing [API](https://wiki.openstreetmap.org/wiki/API_v0.6).
+* The integrated version of the [iD](https://wiki.openstreetmap.org/wiki/ID) editor.
* The Browse pages - a web front-end to the OpenStreetMap data.
* The GPX uploads, browsing and API.
-A fully-functional Rails Port installation depends on other services, including map tile
+A fully-functional `openstreetmap-website` installation depends on other services, including map tile
servers and geocoding services, that are provided by other software. The default installation
uses publicly-available services to help with development and testing.
# Installation
-The Rails Port is a Ruby on Rails application that uses PostgreSQL as its database, and has a large
+`openstreetmap-website` is a Ruby on Rails application that uses PostgreSQL as its database, and has a large
number of dependencies for installation. For full details please see [INSTALL.md](INSTALL.md).
# Development
OPEN_NOTE_MARKER: <%= image_path("open_note_marker.png").to_json %>,
CLOSED_NOTE_MARKER: <%= image_path("closed_note_marker.png").to_json %>,
- SEARCHING: <%= image_path("searching.gif").to_json %>,
-
apiUrl: function (object) {
var apiType = object.type === "note" ? "notes" : object.type;
var url = "/api/" + OSM.API_VERSION + "/" + apiType + "/" + object.id;
$("input[name=legale]").change(function () {
var url = $(this).data("url");
- $("#contributorTerms").html("<img src='" + OSM.SEARCHING + "' />");
+ $("#contributorTerms").html("<div class='spinner-border' role='status'><span class='visually-hidden'>" + I18n.t("browse.start_rjs.loading") + "</span></div>");
$("#contributorTerms").load(url);
});
}
}
-#sidebar {
- #sidebar_loader,
- .search_more {
- width: 100%;
- margin: $lineheight auto;
- }
-
- .loader {
- text-align: center;
- margin: auto;
- width: 40px;
- display: block;
- }
-}
-
/* Temporary label size override until we remove site-wide font customisation */
form {
.search_more .loader {
display: none;
- width: 100%;
}
}
.directions_form {
background-color: $lightgrey;
-
- .loader_copy {
- display: none;
-
- img {
- vertical-align: middle;
- }
- }
}
/* Rules for user images */
<div id="query-nearby" class="query-results">
<h3><%= t(".nearby") %></h3>
- <%= image_tag "searching.gif", :class => "loader" %>
+ <div class="text-center loader">
+ <div class="spinner-border" role="status">
+ <span class="visually-hidden"><%= t("browse.start_rjs.loading") %></span>
+ </div>
+ </div>
<div class="mx-n3">
<ul class="query-results-list list-group list-group-flush"></ul>
</div>
<div id="query-isin" class="query-results">
<h3><%= t(".enclosing") %></h3>
- <%= image_tag "searching.gif", :class => "loader" %>
+ <div class="text-center loader">
+ <div class="spinner-border" role="status">
+ <span class="visually-hidden"><%= t("browse.start_rjs.loading") %></span>
+ </div>
+ </div>
<div class="mx-n3">
<ul class="query-results-list list-group list-group-flush"></ul>
</div>
<%= render "sidebar_header", :title => @heading %>
<div class="changesets mx-n3">
- <%= image_tag "searching.gif", :class => "loader" %>
+ <div class="text-center loader">
+ <div class="spinner-border" role="status">
+ <span class="visually-hidden"><%= t("browse.start_rjs.loading") %></span>
+ </div>
+ </div>
</div>
<% if @changesets.size == 20 -%>
<div class="changeset_more mt-3 text-center">
<%= link_to t(".load_more"), url_for(@params.merge(:max_id => @changesets.last.id - 1)), :class => "btn btn-primary" %>
- <div class="loader"><%= image_tag "searching.gif" %></div>
+ <div class="text-center loader">
+ <div class="spinner-border" role="status">
+ <span class="visually-hidden"><%= t("browse.start_rjs.loading") %></span>
+ </div>
+ </div>
</div>
<% end -%>
<% elsif params[:bbox] %>
<% end %>
</ul>
<% if @more_params %>
- <div class="search_more text-center">
+ <div class="search_more text-center my-3">
<%= link_to t(".more_results"), url_for(@more_params), :class => "btn btn-primary" %>
- <div class="loader"><%= image_tag "searching.gif" %></div>
+ <div class="text-center loader">
+ <div class="spinner-border" role="status">
+ <span class="visually-hidden"><%= t("browse.start_rjs.loading") %></span>
+ </div>
+ </div>
</div>
<% end %>
<% end %>
<% @sources.each do |source| %>
<h4><%= t(".title.#{source}_html") %></h4>
<div class="search_results_entry mx-n3" data-href="<%= url_for @params.merge(:action => "search_#{source}") %>">
- <%= image_tag "searching.gif", :class => "loader" %>
+ <div class="text-center loader">
+ <div class="spinner-border" role="status">
+ <span class="visually-hidden"><%= t("browse.start_rjs.loading") %></span>
+ </div>
+ </div>
</div>
<% end %>
</div>
</div>
- <div class="loader_copy"><div class="loader"><%= image_tag "searching.gif" %></div></div>
+ <div class="loader_copy d-none">
+ <div class="text-center loader">
+ <div class="spinner-border" role="status">
+ <span class="visually-hidden"><%= t("browse.start_rjs.loading") %></span>
+ </div>
+ </div>
+ </div>
</form>
</div>
<div id="browse_status"></div>
- <div id="sidebar_loader">
- <img alt="<%= t("browse.start_rjs.loading") %>" class="loader" src="<%= image_path("searching.gif") %>">
+ <div id="sidebar_loader" class="my-3 text-center loader">
+ <div class="spinner-border" role="status">
+ <span class="visually-hidden"><%= t("browse.start_rjs.loading") %></span>
+ </div>
</div>
<div id="sidebar_content">
module OpenStreetMap
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
- config.load_defaults 6.1
+ config.load_defaults 7.0
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
+++ /dev/null
-# Be sure to restart your server when you modify this file.
-#
-# This file eases your Rails 7.0 framework defaults upgrade.
-#
-# Uncomment each configuration one by one to switch to the new default.
-# Once your application is ready to run with all new defaults, you can remove
-# this file and set the `config.load_defaults` to `7.0`.
-#
-# Read the Guide for Upgrading Ruby on Rails for more info on each option.
-# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
-
-# `button_to` view helper will render `<button>` element, regardless of whether
-# or not the content is passed as the first argument or as a block.
-Rails.application.config.action_view.button_to_generates_button_tag = true
-
-# `stylesheet_link_tag` view helper will not render the media attribute by default.
-Rails.application.config.action_view.apply_stylesheet_media_default = false
-
-# Change the digest class for the key generators to `OpenSSL::Digest::SHA256`.
-# Changing this default means invalidate all encrypted messages generated by
-# your application and, all the encrypted cookies. Only change this after you
-# rotated all the messages using the key rotator.
-#
-# See upgrading guide for more information on how to build a rotator.
-# https://guides.rubyonrails.org/v7.0/upgrading_ruby_on_rails.html
-Rails.application.config.active_support.key_generator_hash_digest_class = OpenSSL::Digest::SHA256
-
-# Change the digest class for ActiveSupport::Digest.
-# Changing this default means that for example Etags change and
-# various cache keys leading to cache invalidation.
-Rails.application.config.active_support.hash_digest_class = OpenSSL::Digest::SHA256
-
-# Don't override ActiveSupport::TimeWithZone.name and use the default Ruby
-# implementation.
-Rails.application.config.active_support.remove_deprecated_time_with_zone_name = true
-
-# Change the format of the cache entry.
-# Changing this default means that all new cache entries added to the cache
-# will have a different format that is not supported by Rails 6.1 applications.
-# Only change this value after your application is fully deployed to Rails 7.0
-# and you have no plans to rollback.
-Rails.application.config.active_support.cache_format_version = 7.0
-
-# Calls `Rails.application.executor.wrap` around test cases.
-# This makes test cases behave closer to an actual request or job.
-# Several features that are normally disabled in test, such as Active Record query cache
-# and asynchronous queries will then be enabled.
-Rails.application.config.active_support.executor_around_test_case = true
-
-# Define the isolation level of most of Rails internal state.
-# If you use a fiber based server or job processor, you should set it to `:fiber`.
-# Otherwise the default of `:thread` if preferable.
-Rails.application.config.active_support.isolation_level = :thread
-
-# Set both the `:open_timeout` and `:read_timeout` values for `:smtp` delivery method.
-Rails.application.config.action_mailer.smtp_timeout = 5
-
-# The ActiveStorage video previewer will now use scene change detection to generate
-# better preview images (rather than the previous default of using the first frame
-# of the video).
-Rails.application.config.active_storage.video_preview_arguments =
- "-vf 'select=eq(n\\,0)+eq(key\\,1)+gt(scene\\,0.015),loop=loop=-1:size=2,trim=start_frame=1' -frames:v 1 -f image2"
-
-# Automatically infer `inverse_of` for associations with a scope.
-Rails.application.config.active_record.automatic_scope_inversing = true
-
-# Raise when running tests if fixtures contained foreign key violations
-Rails.application.config.active_record.verify_foreign_keys_for_fixtures = true
-
-# Disable partial inserts.
-# This default means that all columns will be referenced in INSERT queries
-# regardless of whether they have a default or not.
-Rails.application.config.active_record.partial_inserts = false
-
-# Protect from open redirect attacks in `redirect_back_or_to` and `redirect_to`.
-Rails.application.config.action_controller.raise_on_open_redirects = true
-
-# Change the variant processor for Active Storage.
-# Changing this default means updating all places in your code that
-# generate variants to use image processing macros and ruby-vips
-# operations. See the upgrading guide for detail on the changes required.
-# The `:mini_magick` option is not deprecated; it's fine to keep using it.
-Rails.application.config.active_storage.variant_processor = :vips
-
-# If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
-# was `:marshal`. Convert all cookies to JSON, using the `:hybrid` formatter.
-#
-# If you're confident all your cookies are JSON formatted, you can switch to the `:json` formatter.
-#
-# Continue to use `:marshal` for backward-compatibility with old cookies.
-#
-# If you have configured the serializer elsewhere, you can remove this.
-#
-# See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.
-# Rails.application.config.action_dispatch.cookies_serializer = :hybrid
-
-# Enable parameter wrapping for JSON.
-# Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
-# To disable parameter wrapping entirely, set this config to `false`.
-Rails.application.config.action_controller.wrap_parameters_by_default = true
-
-# Specifies whether generated namespaced UUIDs follow the RFC 4122 standard for namespace IDs provided as a
-# `String` to `Digest::UUID.uuid_v3` or `Digest::UUID.uuid_v5` method calls.
-#
-# See https://guides.rubyonrails.org/configuring.html#config-active-support-use-rfc4122-namespaced-uuids for
-# more information.
-Rails.application.config.active_support.use_rfc4122_namespaced_uuids = true
-
-# Change the default headers to disable browsers' flawed legacy XSS protection.
-Rails.application.config.action_dispatch.default_headers = {
- "X-Frame-Options" => "SAMEORIGIN",
- "X-XSS-Protection" => "0",
- "X-Content-Type-Options" => "nosniff",
- "X-Download-Options" => "noopen",
- "X-Permitted-Cross-Domain-Policies" => "none",
- "Referrer-Policy" => "strict-origin-when-cross-origin"
-}
* To bind this into PGSQL, try something like:
*
* CREATE FUNCTION tile_for_point(int4, int4) RETURNS int8
- * AS '/path/to/rails-port/db/functions/libpgosm', 'tile_for_point'
+ * AS '/path/to/openstreetmap-website/db/functions/libpgosm', 'tile_for_point'
* LANGUAGE C STRICT;
*
* (without all the *s)