From: Anton Khorev Date: Sat, 6 Jul 2024 11:18:50 +0000 (+0300) Subject: Merge branch 'pull/4793' X-Git-Tag: live~408 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/e3c919275818d46a515c183cf373d7a53bc6942a?hp=12ac6f8f27dfe63d9674fba54862db13a9e6d89a Merge branch 'pull/4793' --- diff --git a/.rubocop.yml b/.rubocop.yml index 1e18afd83..c0f0c1fa0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -45,6 +45,10 @@ Naming/FileName: Naming/MethodParameterName: Enabled: false +# This conflicts with Strong Migrations, which can't check `change_table` +Rails/BulkChangeTable: + Enabled: false + Rails/CreateTableWithTimestamps: Enabled: false diff --git a/Gemfile b/Gemfile index 75387b5d5..fcf2ceb4d 100644 --- a/Gemfile +++ b/Gemfile @@ -65,13 +65,14 @@ gem "rack-cors" gem "rails-i18n", "~> 7.0.0" gem "rails_param" gem "rinku", ">= 2.0.6", :require => "rails_rinku" -gem "strong_migrations" +gem "strong_migrations", "< 2.0.0" gem "validates_email_format_of", ">= 1.5.1" # Native OSM extensions gem "quad_tile", "~> 1.0.1" # Sanitise URIs +gem "addressable", "~> 2.8" gem "rack-uri_sanitizer" # Omniauth for authentication @@ -116,9 +117,6 @@ gem "connection_pool" gem "dalli" gem "kgio" -# Load secure_headers for Content-Security-Policy support -gem "secure_headers" - # Load canonical-rails to generate canonical URLs gem "canonical-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 14beee830..774d795bc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,35 +3,35 @@ GEM specs: aasm (5.5.0) concurrent-ruby (~> 1.0) - actioncable (7.1.3.2) - actionpack (= 7.1.3.2) - activesupport (= 7.1.3.2) + actioncable (7.1.3.4) + actionpack (= 7.1.3.4) + activesupport (= 7.1.3.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3.2) - actionpack (= 7.1.3.2) - activejob (= 7.1.3.2) - activerecord (= 7.1.3.2) - activestorage (= 7.1.3.2) - activesupport (= 7.1.3.2) + actionmailbox (7.1.3.4) + actionpack (= 7.1.3.4) + activejob (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.3.2) - actionpack (= 7.1.3.2) - actionview (= 7.1.3.2) - activejob (= 7.1.3.2) - activesupport (= 7.1.3.2) + actionmailer (7.1.3.4) + actionpack (= 7.1.3.4) + actionview (= 7.1.3.4) + activejob (= 7.1.3.4) + activesupport (= 7.1.3.4) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.3.2) - actionview (= 7.1.3.2) - activesupport (= 7.1.3.2) + actionpack (7.1.3.4) + actionview (= 7.1.3.4) + activesupport (= 7.1.3.4) nokogiri (>= 1.8.5) racc rack (>= 2.2.4) @@ -41,39 +41,39 @@ GEM rails-html-sanitizer (~> 1.6) actionpack-page_caching (1.2.4) actionpack (>= 4.0.0) - actiontext (7.1.3.2) - actionpack (= 7.1.3.2) - activerecord (= 7.1.3.2) - activestorage (= 7.1.3.2) - activesupport (= 7.1.3.2) + actiontext (7.1.3.4) + actionpack (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3.2) - activesupport (= 7.1.3.2) + actionview (7.1.3.4) + activesupport (= 7.1.3.4) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) active_record_union (1.3.0) activerecord (>= 4.0) - activejob (7.1.3.2) - activesupport (= 7.1.3.2) + activejob (7.1.3.4) + activesupport (= 7.1.3.4) globalid (>= 0.3.6) - activemodel (7.1.3.2) - activesupport (= 7.1.3.2) - activerecord (7.1.3.2) - activemodel (= 7.1.3.2) - activesupport (= 7.1.3.2) + activemodel (7.1.3.4) + activesupport (= 7.1.3.4) + activerecord (7.1.3.4) + activemodel (= 7.1.3.4) + activesupport (= 7.1.3.4) timeout (>= 0.4.0) - activerecord-import (1.6.0) + activerecord-import (1.7.0) activerecord (>= 4.2) - activestorage (7.1.3.2) - actionpack (= 7.1.3.2) - activejob (= 7.1.3.2) - activerecord (= 7.1.3.2) - activesupport (= 7.1.3.2) + activestorage (7.1.3.4) + actionpack (= 7.1.3.4) + activejob (= 7.1.3.4) + activerecord (= 7.1.3.4) + activesupport (= 7.1.3.4) marcel (~> 1.0) - activesupport (7.1.3.2) + activesupport (7.1.3.4) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -83,8 +83,8 @@ GEM minitest (>= 5.1) mutex_m tzinfo (~> 2.0) - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) annotate (3.2.0) activerecord (>= 3.2, < 8.0) rake (>= 10.4, < 14.0) @@ -95,19 +95,19 @@ GEM autoprefixer-rails (10.4.16.0) execjs (~> 2) aws-eventstream (1.3.0) - aws-partitions (1.928.0) - aws-sdk-core (3.196.0) + aws-partitions (1.950.0) + aws-sdk-core (3.201.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.8) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.81.0) - aws-sdk-core (~> 3, >= 3.193.0) - aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.150.0) - aws-sdk-core (~> 3, >= 3.194.0) + aws-sdk-kms (1.88.0) + aws-sdk-core (~> 3, >= 3.201.0) + aws-sigv4 (~> 1.5) + aws-sdk-s3 (1.156.0) + aws-sdk-core (~> 3, >= 3.201.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.8) + aws-sigv4 (~> 1.5) aws-sigv4 (1.8.0) aws-eventstream (~> 1, >= 1.0.2) base64 (0.2.0) @@ -137,10 +137,10 @@ GEM racc brotli (0.5.0) browser (5.3.1) - builder (3.2.4) + builder (3.3.0) bzip2-ffi (1.1.1) ffi (~> 1.0) - cancancan (3.5.0) + cancancan (3.6.1) canonical-rails (0.2.15) actionview (>= 4.1, <= 7.2) capybara (3.40.0) @@ -152,8 +152,8 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - concurrent-ruby (1.2.3) - config (5.4.0) + concurrent-ruby (1.3.3) + config (5.5.1) deep_merge (~> 1.2, >= 1.2.1) connection_pool (2.4.1) crack (1.0.0) @@ -178,7 +178,7 @@ GEM activerecord (>= 3.0, < 8.0) delayed_job (>= 3.0, < 5) docile (1.4.0) - doorkeeper (5.7.0) + doorkeeper (5.7.1) railties (>= 5) doorkeeper-i18n (5.2.7) doorkeeper (>= 5.2) @@ -192,13 +192,13 @@ GEM dry-core (1.0.1) concurrent-ruby (~> 1.0) zeitwerk (~> 2.6) - dry-inflector (1.0.0) + dry-inflector (1.1.0) dry-initializer (3.1.1) dry-logic (1.5.0) concurrent-ruby (~> 1.0) dry-core (~> 1.0, < 2) zeitwerk (~> 2.6) - dry-schema (1.13.3) + dry-schema (1.13.4) concurrent-ruby (~> 1.0) dry-configurable (~> 1.0, >= 1.0.1) dry-core (~> 1.0, < 2) @@ -226,7 +226,7 @@ GEM rainbow rubocop smart_properties - erubi (1.12.0) + erubi (1.13.0) execjs (2.9.1) exifr (1.4.0) factory_bot (6.4.6) @@ -234,18 +234,18 @@ GEM factory_bot_rails (6.4.3) factory_bot (~> 6.4) railties (>= 5.0.0) - faraday (2.9.0) + faraday (2.9.2) faraday-net_http (>= 2.0, < 3.2) faraday-net_http (3.1.0) net-http - ffi (1.16.3) + ffi (1.17.0) ffi-compiler (1.3.2) ffi (>= 1.15.5) rake ffi-libarchive (1.1.14) ffi (~> 1.0) file_exists (0.2.0) - frozen_record (0.27.1) + frozen_record (0.27.2) activemodel fspath (3.1.2) gd2-ffij (0.4.0) @@ -288,7 +288,7 @@ GEM image_size (3.4.0) in_threads (1.6.0) io-console (0.7.2) - irb (1.13.1) + irb (1.13.2) rdoc (>= 4.0.0) reline (>= 0.4.2) jbuilder (2.12.0) @@ -300,7 +300,7 @@ GEM railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (2.7.2) - jwt (2.8.1) + jwt (2.8.2) base64 kgio (2.11.4) kramdown (2.4.0) @@ -311,6 +311,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) + logger (1.6.0) logstasher (2.1.5) activesupport (>= 5.2) request_store @@ -325,12 +326,12 @@ GEM marcel (1.0.4) matrix (0.4.2) maxminddb (0.1.22) - mini_magick (4.12.0) + mini_magick (4.13.1) mini_mime (1.1.5) - mini_portile2 (2.8.6) + mini_portile2 (2.8.7) mini_racer (0.9.0) libv8-node (~> 18.19.0.0) - minitest (5.22.3) + minitest (5.24.1) minitest-focus (1.4.0) minitest (>= 4, < 6) msgpack (1.7.2) @@ -339,7 +340,7 @@ GEM mutex_m (0.2.0) net-http (0.4.1) uri - net-imap (0.4.11) + net-imap (0.4.14) date net-protocol net-pop (0.1.2) @@ -349,7 +350,7 @@ GEM net-smtp (0.5.0) net-protocol nio4r (2.7.3) - nokogiri (1.16.5) + nokogiri (1.16.6) mini_portile2 (~> 2.8.2) racc (~> 1.4) oauth (0.4.7) @@ -369,8 +370,9 @@ GEM hashie (>= 3.4.6) rack (>= 1.6.2, < 3) rack-protection - omniauth-facebook (9.0.0) - omniauth-oauth2 (~> 1.2) + omniauth-facebook (10.0.0) + bigdecimal + omniauth-oauth2 (>= 1.2, < 3) omniauth-github (2.0.1) omniauth (~> 2.0) omniauth-oauth2 (~> 1.8) @@ -382,7 +384,7 @@ GEM omniauth-mediawiki (0.0.4) jwt (~> 2.0) omniauth-oauth (~> 1.0) - omniauth-microsoft_graph (2.0.0) + omniauth-microsoft_graph (2.0.1) jwt (~> 2.0) omniauth (~> 2.0) omniauth-oauth2 (~> 1.8.0) @@ -399,8 +401,8 @@ GEM actionpack (>= 4.2) omniauth (~> 2.0) openstreetmap-deadlock_retry (1.3.1) - parallel (1.24.0) - parser (3.3.1.0) + parallel (1.25.1) + parser (3.3.3.0) ast (~> 2.4.1) racc pg (1.5.6) @@ -408,11 +410,11 @@ GEM progress (3.6.0) psych (5.1.2) stringio - public_suffix (5.0.5) + public_suffix (6.0.0) puma (5.6.8) nio4r (~> 2.0) quad_tile (1.0.1) - racc (1.7.3) + racc (1.8.0) rack (2.2.9) rack-cors (2.0.2) rack (>= 2.0.0) @@ -430,20 +432,20 @@ GEM rackup (1.0.0) rack (< 3) webrick - rails (7.1.3.2) - actioncable (= 7.1.3.2) - actionmailbox (= 7.1.3.2) - actionmailer (= 7.1.3.2) - actionpack (= 7.1.3.2) - actiontext (= 7.1.3.2) - actionview (= 7.1.3.2) - activejob (= 7.1.3.2) - activemodel (= 7.1.3.2) - activerecord (= 7.1.3.2) - activestorage (= 7.1.3.2) - activesupport (= 7.1.3.2) + rails (7.1.3.4) + actioncable (= 7.1.3.4) + actionmailbox (= 7.1.3.4) + actionmailer (= 7.1.3.4) + actionpack (= 7.1.3.4) + actiontext (= 7.1.3.4) + actionview (= 7.1.3.4) + activejob (= 7.1.3.4) + activemodel (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) bundler (>= 1.15.0) - railties (= 7.1.3.2) + railties (= 7.1.3.4) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -461,9 +463,9 @@ GEM rails_param (1.3.1) actionpack (>= 3.2.0) activesupport (>= 3.2.0) - railties (7.1.3.2) - actionpack (= 7.1.3.2) - activesupport (= 7.1.3.2) + railties (7.1.3.4) + actionpack (= 7.1.3.4) + activesupport (= 7.1.3.4) irb rackup (>= 1.0.0) rake (>= 12.2) @@ -472,22 +474,23 @@ GEM rainbow (3.1.1) rake (13.2.1) rb-fsevent (0.11.2) - rb-inotify (0.10.1) + rb-inotify (0.11.1) ffi (~> 1.0) - rdoc (6.6.3.1) + rdoc (6.7.0) psych (>= 4.0.0) - regexp_parser (2.9.1) - reline (0.5.7) + regexp_parser (2.9.2) + reline (0.5.9) io-console (~> 0.5) request_store (1.7.0) rack (>= 1.4) - rexml (3.2.6) + rexml (3.3.1) + strscan rinku (2.0.6) rotp (6.3.0) - rouge (4.2.1) + rouge (4.3.0) rtlcss (0.2.1) mini_racer (>= 0.6.3) - rubocop (1.63.5) + rubocop (1.64.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -500,17 +503,17 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.31.3) parser (>= 3.3.1.0) - rubocop-capybara (2.20.0) - rubocop (~> 1.41) - rubocop-factory_bot (2.25.1) + rubocop-capybara (2.21.0) rubocop (~> 1.41) + rubocop-factory_bot (2.26.1) + rubocop (~> 1.61) rubocop-minitest (0.35.0) rubocop (>= 1.61, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-performance (1.21.0) + rubocop-performance (1.21.1) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails (2.24.1) + rubocop-rails (2.25.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) @@ -522,15 +525,15 @@ GEM ruby-vips (2.2.1) ffi (~> 1.12) rubyzip (2.3.2) - sanitize (6.1.0) + sanitize (6.1.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) sass-embedded (1.64.2) google-protobuf (~> 3.23) rake (>= 13.0.0) - secure_headers (6.5.0) - selenium-webdriver (4.20.1) + selenium-webdriver (4.22.0) base64 (~> 0.2) + logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -541,8 +544,7 @@ GEM simplecov-html (0.12.3) simplecov-lcov (0.8.0) simplecov_json_formatter (0.1.4) - simpleidn (0.2.2) - unf (~> 0.1.4) + simpleidn (0.2.3) smart_properties (1.17.0) snaky_hash (2.0.1) hashie @@ -553,19 +555,20 @@ GEM sprockets-exporters_pack (0.1.2) brotli (>= 0.2.0) sprockets (>= 4.0.0.beta3) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) + sprockets-rails (3.5.1) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) - stringio (3.1.0) + stringio (3.1.1) strong_migrations (1.8.0) activerecord (>= 5.2) + strscan (3.1.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - terser (1.2.2) + terser (1.2.3) execjs (>= 0.3.0, < 3) thor (1.3.1) - tilt (2.3.0) + tilt (2.4.0) timeout (0.4.1) turbo-rails (2.0.5) actionpack (>= 6.0.0) @@ -573,9 +576,6 @@ GEM railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.9.1) unicode-display_width (2.5.0) uri (0.13.0) validates_email_format_of (1.8.2) @@ -583,7 +583,7 @@ GEM simpleidn vendorer (0.2.0) version_gem (1.1.4) - webmock (3.23.0) + webmock (3.23.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -594,7 +594,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.14) + zeitwerk (2.6.16) PLATFORMS ruby @@ -604,6 +604,7 @@ DEPENDENCIES actionpack-page_caching (>= 1.2.0) active_record_union activerecord-import + addressable (~> 2.8) annotate argon2 autoprefixer-rails @@ -688,12 +689,11 @@ DEPENDENCIES rubocop-rake sanitize sass-embedded (~> 1.64.0) - secure_headers selenium-webdriver simplecov simplecov-lcov sprockets-exporters_pack - strong_migrations + strong_migrations (< 2.0.0) terser turbo-rails unicode-display_width diff --git a/README.md b/README.md index eba23a360..e7e9bd259 100644 --- a/README.md +++ b/README.md @@ -45,3 +45,4 @@ More details on contributing to the code are in the [CONTRIBUTING.md](CONTRIBUTI * Tom Hughes [@tomhughes](https://github.com/tomhughes/) * Andy Allan [@gravitystorm](https://github.com/gravitystorm/) +* Anton Khorev [@AntonKhorev](https://github.com/AntonKhorev/) diff --git a/Vendorfile b/Vendorfile index 4c6a80839..0fe6e09b4 100644 --- a/Vendorfile +++ b/Vendorfile @@ -41,8 +41,4 @@ folder 'vendor/assets' do file 'iD.js', 'dist/iD.js' end end - - folder 'polyfill' do - file 'es6.js', 'https://polyfill.io/v3/polyfill.js?features=es6&flags=gated,always' - end end diff --git a/app/abilities/ability.rb b/app/abilities/ability.rb index 3aba63c33..c0b2f3982 100644 --- a/app/abilities/ability.rb +++ b/app/abilities/ability.rb @@ -18,7 +18,8 @@ class Ability can [:index, :feed, :show], Changeset can :index, ChangesetComment can [:confirm, :confirm_resend, :confirm_email], :confirmation - can [:index, :rss, :show, :comments], DiaryEntry + can [:index, :rss, :show], DiaryEntry + can :index, DiaryComment can [:index], Note can [:new, :create, :edit, :update], :password can [:index, :show], Redaction @@ -53,7 +54,7 @@ class Ability can [:index, :create, :destroy], UserMute if user.moderator? - can [:hide, :unhide, :hidecomment, :unhidecomment], DiaryEntry + can [:hide, :unhide], [DiaryEntry, DiaryComment] can [:index, :show, :resolve, :ignore, :reopen], Issue can :create, IssueComment can [:new, :create, :edit, :update, :destroy], Redaction @@ -61,7 +62,7 @@ class Ability end if user.administrator? - can [:hide, :unhide, :hidecomment, :unhidecomment], DiaryEntry + can [:hide, :unhide], [DiaryEntry, DiaryComment] can [:index, :show, :resolve, :ignore, :reopen], Issue can :create, IssueComment can [:set_status, :destroy, :index], User diff --git a/app/assets/images/about/sprite.png b/app/assets/images/about/sprite.png deleted file mode 100644 index fa0ce2986..000000000 Binary files a/app/assets/images/about/sprite.png and /dev/null differ diff --git a/app/assets/images/about/sprite.svg b/app/assets/images/about/sprite.svg deleted file mode 100644 index 01a80ae16..000000000 --- a/app/assets/images/about/sprite.svg +++ /dev/null @@ -1,388 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/assets/images/about/sprite@2x.png b/app/assets/images/about/sprite@2x.png deleted file mode 100644 index 7560c8773..000000000 Binary files a/app/assets/images/about/sprite@2x.png and /dev/null differ diff --git a/app/assets/images/banners/StateoftheMapEurope_2023.png b/app/assets/images/banners/StateoftheMapEurope_2023.png deleted file mode 100644 index 33e9db907..000000000 Binary files a/app/assets/images/banners/StateoftheMapEurope_2023.png and /dev/null differ diff --git a/app/assets/images/banners/StateoftheMapEurope_2024.png b/app/assets/images/banners/StateoftheMapEurope_2024.png new file mode 100644 index 000000000..d0d1cee62 Binary files /dev/null and b/app/assets/images/banners/StateoftheMapEurope_2024.png differ diff --git a/app/assets/images/closed_note_marker.svg b/app/assets/images/closed_note_marker.svg index d16b5707e..84e1048a4 100644 --- a/app/assets/images/closed_note_marker.svg +++ b/app/assets/images/closed_note_marker.svg @@ -9,32 +9,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/assets/images/directions.png b/app/assets/images/directions.png deleted file mode 100644 index 197244f4a..000000000 Binary files a/app/assets/images/directions.png and /dev/null differ diff --git a/app/assets/images/new.png b/app/assets/images/new.png deleted file mode 100644 index 4a9fa8b36..000000000 Binary files a/app/assets/images/new.png and /dev/null differ diff --git a/app/assets/images/new.svg b/app/assets/images/new.svg deleted file mode 100644 index ef65650f7..000000000 --- a/app/assets/images/new.svg +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/app/assets/images/new_note_marker.svg b/app/assets/images/new_note_marker.svg index efa538b72..c84444b5b 100644 --- a/app/assets/images/new_note_marker.svg +++ b/app/assets/images/new_note_marker.svg @@ -1,12 +1,4 @@ - - - - - - - - diff --git a/app/assets/images/open_note_marker.svg b/app/assets/images/open_note_marker.svg index 8dc07b71a..a1b4381c6 100644 --- a/app/assets/images/open_note_marker.svg +++ b/app/assets/images/open_note_marker.svg @@ -9,32 +9,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/assets/images/openid.png b/app/assets/images/openid.png deleted file mode 100644 index dc7e01fc0..000000000 Binary files a/app/assets/images/openid.png and /dev/null differ diff --git a/app/assets/images/openid.svg b/app/assets/images/openid.svg new file mode 100644 index 000000000..d4de5897b --- /dev/null +++ b/app/assets/images/openid.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/app/assets/images/openid_small.png b/app/assets/images/openid_small.png deleted file mode 100644 index 41adc9fa6..000000000 Binary files a/app/assets/images/openid_small.png and /dev/null differ diff --git a/app/assets/images/osm_logo.png b/app/assets/images/osm_logo.png deleted file mode 100644 index 22f116632..000000000 Binary files a/app/assets/images/osm_logo.png and /dev/null differ diff --git a/app/assets/images/osm_logo.svg b/app/assets/images/osm_logo.svg index 2919c1441..4189d70e7 100644 --- a/app/assets/images/osm_logo.svg +++ b/app/assets/images/osm_logo.svg @@ -1,3336 +1,323 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - + + - - - - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - image/svg+xml - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - + + + + + + + + + + + - - - - - + + + + + + + + + - - - - - - - - - - - + + + + - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - 010110010011010110010011 - 010110010011010110010011 + d="M191.064 54.751l-2.756-.001-2.987.717-.001 2.57 2.969-.733v9.367l-3.191.001v2.515l9.155-.002v-2.513l-3.191.001V54.751zm-12.891-.196c-.271-.044-.558-.065-.858-.065-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.188 3.116-1.188 5.616 0 2.494.396 4.366 1.188 5.617.793 1.244 1.985 1.867 3.577 1.867 1.598 0 2.795-.622 3.588-1.866s1.19-3.117 1.19-5.618c0-2.507-.398-4.383-1.191-5.627a3.82 3.82 0 0 0-2.729-1.799zm-11.921 0c-.271-.044-.558-.065-.858-.065-1.592 0-2.783.625-3.575 1.876-.793 1.244-1.19 3.115-1.19 5.616 0 2.494.396 4.366 1.188 5.617.793 1.244 1.986 1.867 3.578 1.867 1.598 0 2.793-.622 3.586-1.866s1.19-3.115 1.19-5.616c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.555-1.612-2.731-1.802zm11.304 2.371c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.051-.454 3.857s-.787 1.208-1.45 1.208c-.657 0-1.137-.402-1.44-1.208s-.456-2.091-.456-3.857c0-1.772.152-3.061.455-3.867s.783-1.21 1.441-1.21a1.49 1.49 0 0 1 .24.02zm-22.254-2.176l-2.756.001-2.988.714v2.572l2.968-.735v9.369h-3.191l.002 2.513h9.155V66.67l-3.191.001V54.75zm10.333 2.175c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.051-.454 3.857s-.787 1.208-1.45 1.208c-.657 0-1.137-.402-1.44-1.208s-.456-2.091-.456-3.857c0-1.772.152-3.061.455-3.867s.783-1.21 1.441-1.21a1.49 1.49 0 0 1 .24.02zm-22.254-2.174h-2.756l-2.986.715-.001 2.572 2.968-.735v9.369l-3.189.001v2.513h9.155v-2.513l-3.191-.001V54.751zm34.18 6.044a1.35 1.35 0 0 0-.246-.023 1.16 1.16 0 0 0-.851.349 1.17 1.17 0 0 0-.348.861c0 .342.116.627.348.859.232.226.517.339.852.339.342 0 .627-.116.859-.348s.349-.516.349-.851a1.17 1.17 0 0 0-.348-.861c-.174-.174-.38-.282-.615-.326zm-47.07-6.24a5.39 5.39 0 0 0-.857-.067c-1.592 0-2.785.627-3.578 1.877-.793 1.244-1.188 3.116-1.188 5.616 0 2.494.396 4.366 1.188 5.617.793 1.244 1.985 1.867 3.577 1.867 1.598 0 2.795-.622 3.588-1.866s1.188-3.117 1.188-5.618c0-2.507-.396-4.383-1.189-5.627a3.82 3.82 0 0 0-2.729-1.799zm35.149 6.239c-.079-.015-.16-.021-.246-.021-.335 0-.619.115-.851.347s-.346.519-.346.861.116.627.348.859c.232.226.515.339.85.339a1.17 1.17 0 0 0 .861-.348c.232-.232.347-.516.347-.851a1.17 1.17 0 0 0-.348-.861c-.174-.174-.38-.282-.615-.326zm-46.1-6.045h-2.754l-2.989.716v2.572l2.968-.735v9.369l-3.191-.001v2.515h9.155v-2.515h-3.191V54.75zm10.335 2.176c.541.088.945.483 1.21 1.188.303.806.454 2.096.454 3.869 0 1.766-.151 3.051-.454 3.857s-.787 1.208-1.45 1.208c-.657 0-1.139-.403-1.442-1.208s-.454-2.091-.454-3.857c0-1.772.153-3.063.456-3.869s.783-1.208 1.441-1.208a1.49 1.49 0 0 1 .24.02zm-23.225-2.372c-.271-.044-.556-.065-.856-.065-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.19 3.115-1.19 5.616 0 2.494.398 4.367 1.19 5.617.793 1.244 1.985 1.867 3.577 1.867 1.598 0 2.793-.622 3.586-1.866s1.19-3.115 1.19-5.616c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.555-1.612-2.731-1.802zm-.616 2.371c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.051-.454 3.857s-.787 1.208-1.45 1.208c-.657 0-1.137-.402-1.44-1.208s-.454-2.091-.454-3.857c0-1.772.15-3.061.453-3.867s.783-1.21 1.441-1.21a1.49 1.49 0 0 1 .24.02zm23.847 3.871c-.079-.015-.16-.023-.246-.023a1.16 1.16 0 0 0-.851.349c-.232.232-.348.517-.348.859a1.17 1.17 0 0 0 .348.861c.232.226.517.339.852.339.342 0 .627-.116.859-.348s.349-.516.349-.851a1.17 1.17 0 0 0-.348-.861c-.174-.174-.38-.282-.615-.326zm-23.842-.001c-.079-.015-.16-.021-.246-.021-.335 0-.617.115-.849.347a1.17 1.17 0 0 0-.348.861c0 .342.116.627.348.859.232.226.515.339.85.339a1.17 1.17 0 0 0 .861-.348c.232-.232.347-.516.347-.851a1.17 1.17 0 0 0-.348-.861c-.174-.174-.38-.282-.615-.326zM191.064 79.5h-2.754l-2.989.716.001 2.572 2.968-.735v9.369l-3.191-.001v2.515h9.155V91.42l-3.189.001-.001-11.921zm-12.891-.196c-.271-.044-.556-.065-.856-.065-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.19 3.115-1.19 5.616 0 2.494.397 4.369 1.19 5.619.793 1.244 1.985 1.865 3.577 1.865 1.598 0 2.793-.622 3.586-1.866s1.19-3.115 1.19-5.616c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.555-1.612-2.731-1.802zm-10.949.195l-2.756.001-2.986.715-.001 2.572 2.968-.735v9.369l-3.189.001v2.513h9.155v-2.515l-3.191.001V79.499zm10.333 2.175c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.051-.454 3.857s-.787 1.208-1.45 1.208c-.657 0-1.137-.402-1.44-1.208s-.454-2.091-.454-3.857c0-1.772.15-3.061.453-3.867s.783-1.21 1.441-1.21a1.49 1.49 0 0 1 .24.02zm-23.224-2.369a5.39 5.39 0 0 0-.857-.067c-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.188 3.117-1.188 5.618 0 2.494.396 4.366 1.188 5.617.793 1.244 1.985 1.865 3.577 1.865 1.598 0 2.795-.622 3.588-1.866s1.188-3.116 1.188-5.616c0-2.507-.396-4.383-1.189-5.627a3.82 3.82 0 0 0-2.729-1.799zm-10.951.195h-2.756l-2.987.717.001 2.57 2.968-.733v9.367h-3.191v2.515l9.155-.002v-2.513h-3.191V79.5zm10.335 2.174c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.053-.454 3.859s-.787 1.208-1.45 1.208c-.657 0-1.139-.403-1.442-1.208s-.453-2.093-.453-3.859c0-1.772.152-3.061.455-3.867s.781-1.208 1.439-1.208a1.52 1.52 0 0 1 .242.018zm23.845 3.87c-.079-.015-.16-.021-.246-.021-.335 0-.617.115-.849.347a1.17 1.17 0 0 0-.348.861 1.17 1.17 0 0 0 .348.861c.232.226.516.337.851.337a1.17 1.17 0 0 0 .861-.348c.232-.232.347-.516.347-.851 0-.342-.116-.627-.348-.859a1.15 1.15 0 0 0-.615-.328zm-46.1-6.045h-2.754l-2.989.716.001 2.572 2.968-.735v9.369l-3.191-.001v2.515l9.157.001-.002-2.515-3.189.001-.001-11.921zm-12.891-.196c-.271-.044-.556-.065-.856-.065-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.19 3.115-1.19 5.616 0 2.494.397 4.369 1.19 5.619.793 1.244 1.985 1.865 3.577 1.865 1.598 0 2.793-.622 3.586-1.866s1.19-3.115 1.19-5.616c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.555-1.612-2.731-1.802zm35.151 6.242a1.35 1.35 0 0 0-.246-.023c-.335 0-.619.115-.851.347a1.17 1.17 0 0 0-.348.861 1.17 1.17 0 0 0 .348.861c.232.226.515.339.85.339a1.17 1.17 0 0 0 .861-.349c.232-.232.348-.514.348-.849a1.17 1.17 0 0 0-.348-.861c-.174-.174-.38-.282-.615-.326zm-47.072-6.242c-.271-.044-.556-.065-.856-.065-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.19 3.117-1.19 5.618 0 2.494.398 4.367 1.19 5.617.793 1.244 1.985 1.865 3.577 1.865 1.598 0 2.795-.622 3.588-1.866s1.188-3.116 1.188-5.616c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.555-1.612-2.731-1.802zm11.304 2.371c.541.088.944.485 1.209 1.19.303.806.456 2.095.456 3.867 0 1.766-.153 3.051-.456 3.857s-.787 1.208-1.45 1.208c-.657 0-1.137-.402-1.44-1.208s-.454-2.091-.454-3.857c0-1.772.15-3.061.453-3.867s.783-1.21 1.441-1.21a1.49 1.49 0 0 1 .24.02zm-11.919 0c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.153 3.051-.456 3.857s-.785 1.21-1.449 1.21c-.657 0-1.139-.405-1.441-1.21s-.454-2.091-.454-3.857c0-1.772.15-3.061.453-3.867s.783-1.208 1.441-1.208a1.52 1.52 0 0 1 .242.018zm11.926 3.87c-.079-.015-.162-.021-.248-.021-.335 0-.617.115-.849.347a1.17 1.17 0 0 0-.348.861 1.17 1.17 0 0 0 .348.861c.232.226.516.337.851.337a1.17 1.17 0 0 0 .861-.348c.232-.232.347-.516.347-.851 0-.342-.116-.627-.348-.859-.174-.174-.377-.284-.613-.327zm-11.921 0c-.079-.015-.16-.021-.246-.021-.335 0-.619.115-.851.347a1.17 1.17 0 0 0-.348.861 1.17 1.17 0 0 0 .348.861c.232.226.516.337.851.337a1.17 1.17 0 0 0 .861-.348c.232-.232.349-.516.349-.851 0-.342-.118-.627-.35-.859-.174-.174-.377-.284-.613-.327zm85.024 18.705l-2.756.001-2.986.715-.001 2.572 2.968-.735v9.369l-3.189.001v2.513h9.155v-2.515l-3.191.001v-11.921zm-11.921 0l-2.756.001-2.986.715-.001 2.572 2.97-.735v9.369l-3.191.001v2.513h9.155v-2.513l-3.191-.001v-11.921zm-12.891-.194a5.39 5.39 0 0 0-.857-.067c-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.188 3.117-1.188 5.618 0 2.494.396 4.366 1.188 5.617.793 1.244 1.985 1.865 3.577 1.865 1.598 0 2.795-.62 3.587-1.864s1.188-3.117 1.188-5.618c0-2.507-.396-4.383-1.189-5.627a3.82 3.82 0 0 0-2.729-1.799zm-11.921 0c-.271-.044-.558-.065-.858-.065-1.592 0-2.783.625-3.575 1.876-.793 1.244-1.19 3.115-1.19 5.616 0 2.494.396 4.366 1.188 5.617.793 1.244 1.986 1.867 3.578 1.867 1.598 0 2.793-.622 3.586-1.866s1.19-3.117 1.19-5.618c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.555-1.61-2.731-1.8zm11.305 2.369c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.053-.454 3.859s-.787 1.208-1.45 1.208c-.657 0-1.137-.402-1.44-1.208s-.455-2.093-.455-3.859c0-1.772.152-3.061.455-3.867s.783-1.208 1.441-1.208c.083 0 .163.005.24.018zm-22.254-2.174l-2.756-.001-2.989.716.001 2.572 2.968-.735v9.369l-3.191-.001.002 2.515h9.155v-2.515h-3.191V104.25zm10.333 2.175c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.051-.454 3.857s-.787 1.208-1.45 1.208c-.657 0-1.137-.402-1.44-1.208s-.456-2.091-.456-3.857c0-1.772.152-3.061.455-3.867s.783-1.21 1.441-1.21a1.49 1.49 0 0 1 .24.02zm-23.225-2.372c-.271-.044-.556-.065-.856-.065-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.19 3.115-1.19 5.616 0 2.494.397 4.369 1.19 5.619.793 1.244 1.985 1.865 3.577 1.865 1.598 0 2.795-.622 3.588-1.866s1.188-3.116 1.188-5.616c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.555-1.612-2.731-1.802zm35.151 6.242a1.35 1.35 0 0 0-.246-.023 1.16 1.16 0 0 0-.851.349c-.232.232-.348.517-.348.859a1.17 1.17 0 0 0 .348.861c.232.226.517.339.852.339.342 0 .627-.116.859-.348s.349-.516.349-.851a1.17 1.17 0 0 0-.348-.861c-.174-.174-.38-.282-.615-.326zm-47.07-6.242c-.271-.044-.558-.065-.858-.065-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.188 3.117-1.188 5.618 0 2.494.396 4.366 1.188 5.617.793 1.244 1.985 1.865 3.577 1.865 1.598 0 2.795-.622 3.588-1.866s1.188-3.116 1.188-5.616c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.553-1.612-2.729-1.801zm11.303 2.371c.541.088.946.485 1.211 1.19.303.806.454 2.094.454 3.867 0 1.766-.153 3.051-.456 3.857s-.785 1.208-1.449 1.208c-.657 0-1.139-.403-1.442-1.208s-.454-2.091-.454-3.857c0-1.772.15-3.061.453-3.867s.783-1.208 1.441-1.208c.083 0 .163.005.24.018zm23.847 3.871a1.35 1.35 0 0 0-.246-.023 1.16 1.16 0 0 0-.851.349 1.17 1.17 0 0 0-.348.861c0 .342.118.627.35.859.232.226.515.339.85.339a1.17 1.17 0 0 0 .861-.348c.232-.232.347-.516.347-.851a1.17 1.17 0 0 0-.348-.861c-.174-.174-.38-.282-.615-.326zm-46.1-6.045h-2.756l-2.986.715v2.572l2.968-.735v9.369h-3.191v2.513h9.155v-2.513l-3.191-.001V104.25zm10.335 2.174c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.053-.454 3.859s-.787 1.208-1.45 1.208c-.657 0-1.139-.405-1.441-1.21s-.454-2.091-.454-3.857c0-1.772.152-3.061.455-3.867s.783-1.208 1.441-1.208c.083 0 .163.005.24.018zm11.926 3.87c-.079-.014-.16-.021-.246-.021-.335 0-.619.115-.851.347a1.17 1.17 0 0 0-.348.861 1.17 1.17 0 0 0 .348.861c.232.226.516.337.851.337a1.17 1.17 0 0 0 .861-.348c.232-.232.349-.516.349-.851 0-.342-.118-.627-.35-.859-.174-.174-.377-.284-.613-.327zm-11.921 0c-.079-.014-.16-.021-.246-.021-.335 0-.619.115-.851.347a1.17 1.17 0 0 0-.348.861 1.17 1.17 0 0 0 .348.861c.232.226.517.339.852.339.342 0 .627-.118.859-.35s.349-.516.349-.851c0-.342-.116-.627-.348-.859a1.15 1.15 0 0 0-.615-.328z" + opacity=".461" fill="url(#g)"/> + d="M190.635 53.464l-2.756-.001-2.987.717v2.572l2.968-.735v9.369l-3.191-.001v2.515h9.155v-2.515l-3.191.001V53.464zm-12.891-.196c-.271-.044-.556-.065-.856-.065-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.19 3.117-1.19 5.618 0 2.494.396 4.366 1.188 5.617.793 1.244 1.987 1.865 3.579 1.865 1.598 0 2.793-.622 3.586-1.866s1.19-3.115 1.19-5.616c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.555-1.612-2.731-1.802zm-11.921.001c-.271-.044-.556-.067-.855-.067-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.19 3.117-1.19 5.618 0 2.494.398 4.367 1.19 5.617.793 1.244 1.985 1.865 3.577 1.865 1.598 0 2.793-.622 3.586-1.866s1.19-3.115 1.19-5.616c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.555-1.61-2.731-1.8zm11.305 2.369c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.051-.454 3.857s-.787 1.21-1.451 1.21c-.657 0-1.137-.404-1.44-1.21s-.456-2.091-.456-3.857c0-1.772.152-3.061.455-3.867s.783-1.208 1.441-1.208c.083 0 .163.005.24.018zm-22.254-2.174l-2.756-.001-2.987.717-.001 2.57 2.969-.733v9.367l-3.191.001v2.515l9.155-.002v-2.513h-3.191V53.465zm10.333 2.174c.541.088.944.485 1.209 1.19.303.806.456 2.095.456 3.867 0 1.766-.153 3.053-.456 3.859s-.787 1.208-1.45 1.208c-.657 0-1.137-.402-1.44-1.208s-.453-2.093-.453-3.859c0-1.772.15-3.061.453-3.867s.783-1.208 1.441-1.208c.083 0 .163.005.24.018zm-22.254-2.174h-2.756l-2.987.717.001 2.572 2.968-.735v9.369l-3.191-.001v2.515h9.155v-2.515h-3.191V53.464zm34.18 6.044c-.079-.015-.16-.021-.246-.021-.335 0-.619.115-.851.347s-.346.519-.346.861a1.17 1.17 0 0 0 .348.861c.232.226.516.337.851.337a1.17 1.17 0 0 0 .861-.348c.232-.232.347-.516.347-.851 0-.342-.116-.627-.348-.859a1.15 1.15 0 0 0-.615-.328zm-47.07-6.24c-.271-.044-.558-.065-.858-.065-1.592 0-2.783.625-3.575 1.876-.793 1.244-1.19 3.115-1.19 5.616 0 2.494.395 4.368 1.188 5.619.793 1.244 1.987 1.865 3.579 1.865 1.598 0 2.793-.622 3.586-1.866s1.19-3.115 1.19-5.616c0-2.507-.398-4.383-1.191-5.627-.644-1.011-1.553-1.612-2.729-1.801zm35.151 6.242a1.37 1.37 0 0 0-.247-.023c-.335 0-.617.115-.849.347a1.17 1.17 0 0 0-.348.861 1.17 1.17 0 0 0 .348.861c.232.226.515.339.85.339a1.17 1.17 0 0 0 .861-.349 1.15 1.15 0 0 0 .346-.849 1.17 1.17 0 0 0-.348-.861 1.14 1.14 0 0 0-.613-.325zm-46.1-6.046l-2.756.001-2.988.714v2.572l2.968-.735v9.369h-3.191l.002 2.513h9.155v-2.515h-3.191V53.464zm10.333 2.175c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.051-.454 3.857s-.787 1.208-1.45 1.208c-.657 0-1.137-.402-1.44-1.208s-.456-2.091-.456-3.857c0-1.772.152-3.061.455-3.867s.783-1.21 1.441-1.21a1.49 1.49 0 0 1 .24.02zm-23.226-2.37c-.271-.044-.556-.067-.855-.067-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.19 3.117-1.19 5.618 0 2.494.398 4.367 1.19 5.617.793 1.244 1.985 1.865 3.577 1.865 1.598 0 2.795-.622 3.588-1.866s1.188-3.116 1.188-5.616c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.555-1.61-2.731-1.8zm-.616 2.369c.541.088.946.485 1.211 1.19.303.806.454 2.094.454 3.867 0 1.766-.153 3.053-.456 3.859s-.785 1.208-1.449 1.208c-.657 0-1.139-.403-1.442-1.208s-.453-2.093-.453-3.859c0-1.772.15-3.061.453-3.867s.783-1.208 1.441-1.208c.083 0 .163.005.24.018zm23.847 3.871c-.079-.015-.16-.021-.246-.021-.335 0-.619.115-.851.347a1.17 1.17 0 0 0-.348.861 1.17 1.17 0 0 0 .349.861c.232.226.516.337.851.337.342 0 .627-.116.859-.348s.349-.516.349-.851a1.17 1.17 0 0 0-.348-.861c-.174-.174-.38-.282-.615-.326zm-23.84.001c-.079-.015-.16-.023-.246-.023-.335 0-.619.115-.851.347a1.17 1.17 0 0 0-.348.861 1.17 1.17 0 0 0 .348.861c.232.226.515.339.85.339a1.17 1.17 0 0 0 .861-.349c.232-.232.348-.514.348-.849a1.17 1.17 0 0 0-.349-.861 1.14 1.14 0 0 0-.613-.325zm85.025 18.703l-2.756.001-2.988.714.001 2.572 2.968-.735v9.369l-3.191.001.002 2.513h9.155v-2.513l-3.191-.001V78.213zm-12.893-.194c-.271-.044-.556-.067-.855-.067-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.19 3.117-1.19 5.618 0 2.494.398 4.367 1.19 5.617.793 1.244 1.985 1.865 3.577 1.865 1.598 0 2.795-.62 3.587-1.864s1.188-3.117 1.188-5.618c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.555-1.61-2.731-1.8zm-10.949.195h-2.756l-2.987.717.001 2.57 2.968-.733v9.367h-3.191v2.515l9.155-.002v-2.513l-3.191.001V78.214zm10.333 2.174c.541.088.946.485 1.211 1.19.303.806.454 2.094.454 3.867 0 1.766-.153 3.053-.456 3.859s-.785 1.208-1.449 1.208c-.657 0-1.139-.403-1.442-1.208s-.453-2.093-.453-3.859c0-1.772.15-3.061.453-3.867s.783-1.208 1.44-1.208c.083 0 .163.005.24.018zm-23.224-2.369c-.271-.044-.558-.065-.858-.065-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.188 3.116-1.188 5.616 0 2.494.396 4.366 1.188 5.617.793 1.244 1.986 1.867 3.578 1.867 1.598 0 2.793-.622 3.586-1.866s1.19-3.117 1.19-5.618c0-2.507-.398-4.383-1.191-5.627a3.82 3.82 0 0 0-2.729-1.799zm-10.951.195h-2.754l-2.989.716v2.572l2.968-.735v9.369h-3.191v2.513h9.157l-.002-2.515h-3.189l-.001-11.921zm10.335 2.176c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.051-.454 3.857s-.787 1.208-1.45 1.208c-.657 0-1.137-.402-1.44-1.208s-.456-2.091-.456-3.857c0-1.772.152-3.061.455-3.867s.783-1.21 1.441-1.21a1.49 1.49 0 0 1 .24.02zm23.847 3.871c-.079-.015-.16-.023-.246-.023-.335 0-.619.115-.851.347a1.17 1.17 0 0 0-.348.861 1.17 1.17 0 0 0 .348.861c.232.226.515.339.85.339a1.17 1.17 0 0 0 .861-.348c.232-.232.349-.516.349-.851a1.17 1.17 0 0 0-.349-.861 1.14 1.14 0 0 0-.613-.325zm-46.1-6.046l-2.756.001-2.986.715-.001 2.572 2.968-.735v9.369l-3.189.001v2.513h9.155v-2.513l-3.191-.001V78.213zm-12.893-.194c-.271-.044-.556-.067-.855-.067-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.188 3.117-1.188 5.618 0 2.494.396 4.366 1.188 5.617.793 1.244 1.985 1.865 3.577 1.865 1.598 0 2.795-.62 3.587-1.864s1.188-3.117 1.188-5.618c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.555-1.61-2.731-1.8zm35.151 6.24a1.35 1.35 0 0 0-.246-.023 1.16 1.16 0 0 0-.851.349 1.17 1.17 0 0 0-.348.861c0 .342.118.627.35.859.232.226.515.339.85.339.342 0 .627-.116.859-.348s.349-.516.349-.851a1.17 1.17 0 0 0-.348-.861c-.174-.174-.38-.282-.615-.326zm-47.07-6.24c-.271-.044-.558-.065-.858-.065-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.188 3.116-1.188 5.616 0 2.494.396 4.366 1.188 5.617.793 1.244 1.985 1.867 3.577 1.867 1.598 0 2.795-.622 3.588-1.866s1.19-3.117 1.19-5.618c0-2.507-.398-4.383-1.191-5.627a3.82 3.82 0 0 0-2.729-1.799zm11.305 2.369c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.053-.454 3.859s-.787 1.208-1.45 1.208c-.657 0-1.139-.403-1.442-1.208s-.453-2.093-.453-3.859c0-1.772.15-3.061.453-3.867s.783-1.208 1.441-1.208a1.52 1.52 0 0 1 .242.018zm-11.921.001c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.051-.454 3.857s-.787 1.208-1.45 1.208c-.657 0-1.137-.402-1.44-1.208s-.456-2.091-.456-3.857c0-1.772.153-3.063.456-3.869s.783-1.208 1.441-1.208a1.49 1.49 0 0 1 .24.02zm11.926 3.87c-.079-.015-.16-.023-.246-.023-.335 0-.619.115-.851.347a1.17 1.17 0 0 0-.348.861 1.17 1.17 0 0 0 .348.861c.232.226.515.339.85.339a1.17 1.17 0 0 0 .861-.348c.232-.232.349-.516.349-.851a1.17 1.17 0 0 0-.348-.861c-.174-.174-.38-.282-.615-.326zm-11.921 0c-.079-.015-.16-.023-.246-.023a1.16 1.16 0 0 0-.851.349c-.232.232-.348.517-.348.859a1.17 1.17 0 0 0 .348.861c.232.226.517.339.852.339.342 0 .627-.116.859-.348s.349-.516.349-.851a1.17 1.17 0 0 0-.348-.861c-.174-.174-.38-.282-.615-.326zm85.024 18.705h-2.756l-2.986.715-.001 2.572 2.969-.733v9.367h-3.191v2.513h9.155v-2.513l-3.191-.001v-11.919zm-11.921 0l-2.756-.001-2.987.716.001 2.57 2.968-.733v9.367l-3.191.001v2.515l9.155-.002v-2.513h-3.191v-11.921zm-12.891-.196c-.271-.044-.558-.065-.858-.065-1.592 0-2.783.625-3.575 1.876-.793 1.244-1.19 3.115-1.19 5.616 0 2.494.396 4.366 1.188 5.617.793 1.244 1.986 1.867 3.578 1.867 1.598 0 2.793-.622 3.586-1.866s1.19-3.115 1.19-5.616c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.555-1.612-2.731-1.802zm-11.921 0c-.271-.044-.556-.065-.856-.065-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.19 3.117-1.19 5.618 0 2.494.398 4.367 1.19 5.617.793 1.244 1.985 1.865 3.577 1.865 1.598 0 2.793-.622 3.586-1.866s1.19-3.115 1.19-5.616c0-2.507-.396-4.383-1.189-5.627-.644-1.011-1.555-1.612-2.731-1.802zm11.304 2.371c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.051-.454 3.857s-.787 1.208-1.45 1.208c-.657 0-1.137-.402-1.44-1.208s-.456-2.091-.456-3.857c0-1.772.152-3.061.455-3.867s.783-1.21 1.441-1.21a1.49 1.49 0 0 1 .24.02zm-22.254-2.176l-2.756.001-2.986.715-.001 2.572 2.97-.735v9.369l-3.191.001v2.513h9.155v-2.513l-3.191-.001v-11.921zm10.333 2.175c.541.088.944.485 1.209 1.19.303.806.456 2.095.456 3.867 0 1.766-.153 3.051-.456 3.857s-.787 1.21-1.451 1.21c-.657 0-1.137-.404-1.44-1.21s-.454-2.091-.454-3.857c0-1.772.15-3.061.453-3.867s.783-1.208 1.441-1.208c.083 0 .163.005.24.018zm-23.224-2.369a5.39 5.39 0 0 0-.857-.067c-1.592 0-2.785.625-3.577 1.875-.793 1.244-1.188 3.117-1.188 5.618 0 2.494.396 4.366 1.188 5.617.793 1.244 1.985 1.867 3.577 1.867 1.598 0 2.795-.622 3.588-1.866s1.188-3.117 1.188-5.618c0-2.507-.396-4.383-1.189-5.627a3.82 3.82 0 0 0-2.729-1.799zm35.149 6.239c-.079-.014-.16-.021-.246-.021-.335 0-.619.115-.851.347s-.346.519-.346.861.116.627.348.859c.232.226.515.339.85.339a1.17 1.17 0 0 0 .861-.348c.232-.232.347-.516.347-.851a1.17 1.17 0 0 0-.348-.861c-.174-.174-.38-.282-.615-.326zm-47.07-6.24c-.271-.044-.558-.065-.858-.065-1.592 0-2.783.625-3.575 1.876-.793 1.244-1.19 3.115-1.19 5.616 0 2.494.396 4.366 1.188 5.617.793 1.244 1.986 1.867 3.578 1.867 1.598 0 2.793-.622 3.586-1.866s1.19-3.117 1.19-5.618c0-2.507-.398-4.383-1.191-5.627a3.82 3.82 0 0 0-2.729-1.799zm11.305 2.369c.541.088.944.485 1.209 1.19.303.806.454 2.096.454 3.869 0 1.766-.151 3.051-.454 3.857s-.787 1.208-1.45 1.208c-.657 0-1.139-.403-1.442-1.208s-.453-2.093-.453-3.859c0-1.772.152-3.061.455-3.867s.783-1.208 1.441-1.208c.083 0 .163.005.24.018zm23.847 3.871c-.079-.014-.162-.021-.248-.021-.335 0-.617.115-.849.347a1.17 1.17 0 0 0-.348.861 1.17 1.17 0 0 0 .348.861c.232.226.516.337.851.337a1.17 1.17 0 0 0 .861-.348c.232-.232.347-.516.347-.851 0-.342-.116-.627-.348-.859-.174-.174-.377-.284-.613-.327zm-46.1-6.045l-2.756-.001-2.989.716.001 2.572 2.968-.735v9.369l-3.191-.001v2.515h9.157v-2.515h-3.191v-11.921zm10.333 2.175c.541.088.944.485 1.209 1.19.303.806.454 2.094.454 3.867 0 1.766-.151 3.051-.454 3.857s-.787 1.208-1.45 1.208c-.657 0-1.137-.402-1.44-1.208s-.456-2.091-.456-3.857c0-1.772.152-3.061.455-3.867s.783-1.21 1.441-1.21a1.49 1.49 0 0 1 .24.02zm11.926 3.87a1.35 1.35 0 0 0-.246-.023 1.16 1.16 0 0 0-.851.349c-.232.232-.348.517-.348.859a1.17 1.17 0 0 0 .348.861c.232.226.517.339.852.339.342 0 .627-.116.859-.348s.349-.516.349-.851a1.17 1.17 0 0 0-.348-.861c-.174-.174-.38-.282-.615-.326zm-11.921 0a1.35 1.35 0 0 0-.246-.023 1.16 1.16 0 0 0-.851.349 1.17 1.17 0 0 0-.348.861c0 .342.118.627.35.859.232.226.515.339.85.339.342 0 .627-.116.859-.348s.349-.516.349-.851a1.17 1.17 0 0 0-.348-.861c-.174-.174-.38-.282-.615-.326z" + fill="url(#f)"/> + diff --git a/app/assets/images/osm_logo_512.png b/app/assets/images/osm_logo_512.png deleted file mode 100644 index c54f416ab..000000000 Binary files a/app/assets/images/osm_logo_512.png and /dev/null differ diff --git a/app/assets/images/routing-sprite.svg b/app/assets/images/routing-sprite.svg index e03a1bb84..97701d5a8 100644 --- a/app/assets/images/routing-sprite.svg +++ b/app/assets/images/routing-sprite.svg @@ -1,37 +1,55 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/images/welcome-sprite.svg b/app/assets/images/welcome-sprite.svg deleted file mode 100644 index 5381a2542..000000000 --- a/app/assets/images/welcome-sprite.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 20976d15a..054742126 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -106,6 +106,7 @@ $(document).ready(function () { $("body").removeClass("compact-nav"); $("header").removeClass("text-nowrap"); + $("header nav.secondary > ul").removeClass("flex-nowrap"); updateHeader(); diff --git a/app/assets/javascripts/embed.js.erb b/app/assets/javascripts/embed.js.erb index 4ebb89da9..9a0ec07d3 100644 --- a/app/assets/javascripts/embed.js.erb +++ b/app/assets/javascripts/embed.js.erb @@ -5,13 +5,13 @@ //= require i18n //= require i18n/embed -window.onload = function () { - if (navigator.languages) { - I18n.locale = navigator.languages[0]; - } else if (navigator.language) { - I18n.locale = navigator.language; - } +if (navigator.languages) { + I18n.locale = navigator.languages[0]; +} else if (navigator.language) { + I18n.locale = navigator.language; +} +window.onload = function () { var query = (window.location.search || '?').slice(1), args = {}; diff --git a/app/assets/javascripts/index/browse.js b/app/assets/javascripts/index/browse.js index 69d625eca..7a761b500 100644 --- a/app/assets/javascripts/index/browse.js +++ b/app/assets/javascripts/index/browse.js @@ -58,7 +58,7 @@ OSM.initializeBrowse = function (map) { .click(cancel))), $("

") .text(I18n.t("browse.start_rjs.feature_warning", { num_features: count, max_features: limit })), - $("") + $("") .val(I18n.t("browse.start_rjs.load_data")) .click(add))); } diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 42854f2e2..ae01cb566 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -3,7 +3,6 @@ //= require qs/dist/qs OSM.Directions = function (map) { - var awaitingGeocode; // true if the user has requested a route, but we're waiting on a geocode result var awaitingRoute; // true if we've asked the engine for a route and are waiting to hear back var chosenEngine; @@ -21,9 +20,18 @@ OSM.Directions = function (map) { weight: 12 }); + var endpointDragCallback = function (dragging) { + if (map.hasLayer(polyline)) { + getRoute(false, !dragging); + } + }; + var endpointGeocodeCallback = function () { + getRoute(true, true); + }; + var endpoints = [ - Endpoint($("input[name='route_from']"), OSM.MARKER_GREEN), - Endpoint($("input[name='route_to']"), OSM.MARKER_RED) + Endpoint($("input[name='route_from']"), OSM.MARKER_GREEN, endpointDragCallback, endpointGeocodeCallback), + Endpoint($("input[name='route_to']"), OSM.MARKER_RED, endpointDragCallback, endpointGeocodeCallback) ]; var expiry = new Date(); @@ -43,7 +51,7 @@ OSM.Directions = function (map) { select.append(""); }); - function Endpoint(input, iconUrl) { + function Endpoint(input, iconUrl, dragCallback, geocodeCallback) { var endpoint = {}; endpoint.marker = L.marker([0, 0], { @@ -64,18 +72,14 @@ OSM.Directions = function (map) { if (dragging && !chosenEngine.draggable) return; if (dragging && awaitingRoute) return; endpoint.setLatLng(e.target.getLatLng()); - if (map.hasLayer(polyline)) { - getRoute(false, !dragging); - } + dragCallback(dragging); }); input.on("keydown", function () { - input.removeClass("error"); + input.removeClass("is-invalid"); }); input.on("change", function (e) { - awaitingGeocode = true; - // make text the same in both text boxes var value = e.target.value; endpoint.setValue(value); @@ -84,7 +88,7 @@ OSM.Directions = function (map) { endpoint.setValue = function (value, latlng) { endpoint.value = value; delete endpoint.latlng; - input.removeClass("error"); + input.removeClass("is-invalid"); input.val(value); if (latlng) { @@ -109,7 +113,7 @@ OSM.Directions = function (map) { endpoint.awaitingGeocode = false; endpoint.hasGeocode = true; if (json.length === 0) { - input.addClass("error"); + input.addClass("is-invalid"); alert(I18n.t("javascripts.directions.errors.no_place", { place: endpoint.value })); return; } @@ -118,10 +122,7 @@ OSM.Directions = function (map) { input.val(json[0].display_name); - if (awaitingGeocode) { - awaitingGeocode = false; - getRoute(true, true); - } + geocodeCallback(); }); }; @@ -209,11 +210,9 @@ OSM.Directions = function (map) { var endpoint = endpoints[ep_i]; if (!endpoint.hasGeocode && !endpoint.awaitingGeocode) { endpoint.getGeocode(); - awaitingGeocode = true; } } if (endpoints[0].awaitingGeocode || endpoints[1].awaitingGeocode) { - awaitingGeocode = true; return; } @@ -307,7 +306,7 @@ OSM.Directions = function (map) { var row = $(""); row.append("

"); row.append("" + instruction); - row.append("" + dist); + row.append("" + dist); row.on("click", function () { popup @@ -357,7 +356,7 @@ OSM.Directions = function (map) { getRoute(true, true); }); - $(".routing_marker").on("dragstart", function (e) { + $(".routing_marker_column img").on("dragstart", function (e) { var dt = e.originalEvent.dataTransfer; dt.effectAllowed = "move"; var dragData = { type: $(this).data("type") }; diff --git a/app/assets/javascripts/index/directions/fossgis_valhalla.js b/app/assets/javascripts/index/directions/fossgis_valhalla.js index d44dbd12b..619f8f1e3 100644 --- a/app/assets/javascripts/index/directions/fossgis_valhalla.js +++ b/app/assets/javascripts/index/directions/fossgis_valhalla.js @@ -27,7 +27,7 @@ function FOSSGISValhallaEngine(id, costing) { 5, // kStayLeft = 24; 20, // kMerge = 25; 10, // kRoundaboutEnter = 26; - 11, // kRoundaboutExit = 27; + 10, // kRoundaboutExit = 27; 17, // kFerryEnter = 28; 0, // kFerryExit = 29; null, // kTransit = 30; diff --git a/app/assets/javascripts/index/directions/graphhopper.js b/app/assets/javascripts/index/directions/graphhopper.js index 11d600316..e72f6d75f 100644 --- a/app/assets/javascripts/index/directions/graphhopper.js +++ b/app/assets/javascripts/index/directions/graphhopper.js @@ -9,7 +9,12 @@ function GraphHopperEngine(id, vehicleType) { "3": 3, // sharp right "4": 14, // finish reached "5": 14, // via reached - "6": 10 // roundabout + "6": 10, // roundabout + "-7": 19, // keep left + "7": 18, // keep right + "-98": 4, // unknown direction u-turn + "-8": 4, // left u-turn + "8": 4 // right u-turn }; return { diff --git a/app/assets/javascripts/index/note.js b/app/assets/javascripts/index/note.js index 15fedb1d1..3839d2715 100644 --- a/app/assets/javascripts/index/note.js +++ b/app/assets/javascripts/index/note.js @@ -36,12 +36,12 @@ OSM.Note = function (map) { }; function initialize(path, id, callback) { - content.find("input[type=submit]").on("click", function (e) { + content.find("button[type=submit]").on("click", function (e) { e.preventDefault(); var data = $(e.target).data(); var form = e.target.form; - $(form).find("input[type=submit]").prop("disabled", true); + $(form).find("button[type=submit]").prop("disabled", true); $.ajax({ url: data.url, @@ -83,12 +83,12 @@ OSM.Note = function (map) { } function updateButtons(form) { - $(form).find("input[type=submit]").prop("disabled", false); + $(form).find("button[type=submit]").prop("disabled", false); if ($(form.text).val() === "") { - $(form.close).val($(form.close).data("defaultActionText")); + $(form.close).text($(form.close).data("defaultActionText")); $(form.comment).prop("disabled", true); } else { - $(form.close).val($(form.close).data("commentActionText")); + $(form.close).text($(form.close).data("commentActionText")); $(form.comment).prop("disabled", false); } } diff --git a/app/assets/javascripts/index/search.js b/app/assets/javascripts/index/search.js index d41fc7d53..94bb52a1b 100644 --- a/app/assets/javascripts/index/search.js +++ b/app/assets/javascripts/index/search.js @@ -9,9 +9,9 @@ OSM.Search = function (map) { } }); - $(".search_form a.button.switch_link").on("click", function (e) { + $(".search_form a.btn.switch_link").on("click", function (e) { e.preventDefault(); - var query = $(e.target).parent().parent().find("input[name=query]").val(); + var query = $(this).closest("form").find("input[name=query]").val(); if (query) { OSM.router.route("/directions?from=" + encodeURIComponent(query) + OSM.formatHash(map)); } else { diff --git a/app/assets/javascripts/leaflet.layers.js b/app/assets/javascripts/leaflet.layers.js index 1a34b05c2..55d492b29 100644 --- a/app/assets/javascripts/leaflet.layers.js +++ b/app/assets/javascripts/leaflet.layers.js @@ -84,7 +84,7 @@ L.OSM.layers = function (options) { $("

") .text(I18n.t("javascripts.map.layers.overlays")) - .attr("class", "text-muted") + .attr("class", "text-body-secondary small mb-2") .appendTo(overlaySection); var overlays = $("

    ") diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index 69db10ad7..b92d70796 100644 --- a/app/assets/javascripts/leaflet.share.js +++ b/app/assets/javascripts/leaflet.share.js @@ -8,6 +8,7 @@ L.OSM.share = function (options) { control.onAddPane = function (map, button, $ui) { // Link / Embed + $("#content").addClass("overlay-right-sidebar"); var $linkSection = $("
    ") .attr("class", "share-link p-3 border-bottom border-secondary-subtle") @@ -98,7 +99,7 @@ L.OSM.share = function (options) { .on("click", select)) .append( $("

    ") - .attr("class", "text-muted") + .attr("class", "text-body-secondary") .text(I18n.t("javascripts.share.paste_html"))); // Geo URI @@ -128,7 +129,7 @@ L.OSM.share = function (options) { $("

    ") .attr("id", "export-warning") - .attr("class", "text-muted") + .attr("class", "text-body-secondary") .text(I18n.t("javascripts.share.only_standard_layer")) .appendTo($imageSection); @@ -223,7 +224,7 @@ L.OSM.share = function (options) { }; $("

    ") - .attr("class", "text-muted") + .attr("class", "text-body-secondary") .html(I18n.t("javascripts.share.image_dimensions", args)) .appendTo($form); diff --git a/app/assets/javascripts/leaflet.sidebar.js b/app/assets/javascripts/leaflet.sidebar.js index 7e72278e3..9573c839d 100644 --- a/app/assets/javascripts/leaflet.sidebar.js +++ b/app/assets/javascripts/leaflet.sidebar.js @@ -31,9 +31,11 @@ L.OSM.sidebar = function (selector) { map.panBy([-paneWidth, 0], { animate: false }); } $(sidebar).hide(); + $("#content").addClass("overlay-right-sidebar"); current = currentButton = $(); } else { $(sidebar).show(); + $("#content").removeClass("overlay-right-sidebar"); current = pane; currentButton = button || $(); if ($("html").attr("dir") === "rtl") { diff --git a/app/assets/javascripts/richtext.js b/app/assets/javascripts/richtext.js index ea2efcfad..3036f169b 100644 --- a/app/assets/javascripts/richtext.js +++ b/app/assets/javascripts/richtext.js @@ -41,7 +41,6 @@ $(document).ready(function () { $(".richtext_dopreview").click(function (event) { var editor = $(this).parents(".richtext_container").find("textarea"); var preview = $(this).parents(".richtext_container").find(".richtext_preview"); - var width = editor.outerWidth() - preview.outerWidth() + preview.width(); var minHeight = editor.outerHeight() - preview.outerHeight() + preview.height(); if (preview.contents().length === 0) { @@ -56,7 +55,6 @@ $(document).ready(function () { } editor.hide(); - preview.width(width); preview.css("min-height", minHeight + "px"); preview.show(); diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 9684f5d43..11f0a5fd3 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -16,8 +16,6 @@ time[title] { text-decoration: underline dotted; } -#container { position: relative; } - /* Rules for icons */ .icon { @@ -50,7 +48,7 @@ time[title] { /* Utility for de-emphasizing content */ -.text-muted a { +.text-body-secondary a { color: $blue; } @@ -98,23 +96,13 @@ header { position: relative; font-size: 14px; - h1, nav, nav > ul, nav > ul > li { - display: inline-block; - } - > * { - height: 100%; padding: $lineheight * 0.5; } - img.logo { - margin-top: -2px; - } - h1 { + height: $headerHeight; font-size: 18px; - line-height: 1.2; - padding-top: 15px; } .btn { @@ -124,6 +112,10 @@ header { nav.primary { margin-right: auto; } + + .username { + max-width: 12em; + } } nav.primary { @@ -160,7 +152,7 @@ nav.primary { nav.secondary { .nav-link { - padding: 0.2rem; + padding: 0.3rem; } } @@ -197,7 +189,7 @@ body.small-nav { min-height: $headerHeight; &.closed nav { - display: none; + display: none !important; } .search_forms { @@ -222,6 +214,8 @@ body.small-nav { } nav.secondary { + flex-direction: column; + .user-menu, .login-menu { width: 100%; } @@ -401,7 +395,7 @@ body.small-nav { overflow-y: scroll; } - .overlay-sidebar { + .overlay-sidebar.overlay-right-sidebar { #sidebar { position: absolute; width: 350px; @@ -409,7 +403,7 @@ body.small-nav { overflow: hidden; } - #map, #map-ui { + #map { height: 100%; } } @@ -429,10 +423,6 @@ body.small-nav { } .overlay-layers { - p { - font-size: 13px; - margin-bottom: 8px; - } li.disabled { color: $darkgrey; } } } @@ -499,16 +489,6 @@ body.small-nav { .donate-attr { color: darken($green, 10%) !important; } -/* Rules for the sidebar */ - -#browse_status { - input { - display: block; - margin-left: auto; - margin-right: auto; - } -} - /* Temporary label size override until we remove site-wide font customisation */ form { @@ -588,10 +568,12 @@ tr.turn { cursor: pointer; } -.routing_marker { width: 15px; cursor: move; } +.routing_marker_column { + width: 15px; -.browse_status { - display: none; + img { + cursor: move; + } } /* Rules for the history sidebar */ @@ -642,26 +624,11 @@ tr.turn { } } - .note-description { - overflow: hidden; - margin: 0 0 10px 10px; - } - .query-results { display: none; } } -/* Bootstrap buttons don't have any vertical margin, so - they touch when adjacent buttons wrap onto a new line - e.g. wide form buttons on a narrow sidebar */ - -.btn-wrapper { - > .btn { - margin-bottom: $spacer * 0.25; - } -} - /* Force LTR/RTL alignment for placeholder text */ .form-control::placeholder { @@ -891,53 +858,7 @@ div.secondary-actions { } } -/* Rules for the "Welcome" page */ -.site-welcome, .site-fixthemap { - .sprite { - background-image: image-url("welcome-sprite.svg"); - background-size: 500px 250px; - display: block; - } - - .sprite.small { - width: 50px; - height: 50px; - } - - .sprite.x { - /*rtl:ignore*/ background-position: -50px 0; - } - - .sprite.term { - margin-right: 10px; - vertical-align: middle; - display: inline-block; - } - - .sprite.node { - /*rtl:ignore*/ background-position: -100px 0; - } - - .sprite.way { - /*rtl:ignore*/ background-position: -150px 0; - } - - .sprite.tag { - /*rtl:ignore*/ background-position: -200px 0; - } - - .sprite.editor { - /*rtl:ignore*/ background-position: -250px 0; - } - - .sprite.question { - /*rtl:ignore*/ background-position: -300px 0; - } - - .sprite.rules { - /*rtl:ignore*/ background-position: -350px 0; - } -} +/* Rules for the "About" page */ .site-about #content { .content-inner { @@ -972,37 +893,6 @@ div.secondary-actions { margin-left: -1em; } } - - .icon { - width: 30px; - height: 30px; - background: 40px 40px image-url('about/sprite.png') no-repeat; - - &.local { - /*rtl:ignore*/ - background-position: 0px 0px; - } - &.community { - /*rtl:ignore*/ - background-position: 0px -40px; - } - &.open { - /*rtl:ignore*/ - background-position: 0px -80px; - } - &.partners { - /*rtl:ignore*/ - background-position: 0px -120px; - } - &.infringement { - /*rtl:ignore*/ - background-position: 0px -160px; - } - &.legal { - /*rtl:ignore*/ - background-position: -45px -160px; - } - } } .auth-container { diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 6b47ca666..d45dce66a 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -11,15 +11,13 @@ class AccountsController < ApplicationController before_action :check_database_readable before_action :check_database_writable, :only => [:update] - before_action :allow_thirdparty_images, :only => [:edit, :update] + + allow_thirdparty_images :only => [:edit, :update] + allow_social_login :only => [:edit, :update] def edit @tokens = current_user.oauth_tokens.authorized - append_content_security_policy_directives( - :form_action => %w[accounts.google.com *.facebook.com login.microsoftonline.com github.com meta.wikimedia.org] - ) - if errors = session.delete(:user_errors) errors.each do |attribute, error| current_user.errors.add(attribute, error) @@ -31,10 +29,6 @@ class AccountsController < ApplicationController def update @tokens = current_user.oauth_tokens.authorized - append_content_security_policy_directives( - :form_action => %w[accounts.google.com *.facebook.com login.microsoftonline.com github.com meta.wikimedia.org] - ) - user_params = params.require(:user).permit(:display_name, :new_email, :pass_crypt, :pass_crypt_confirmation, :auth_provider) if params[:user][:auth_provider].blank? || diff --git a/app/controllers/api/capabilities_controller.rb b/app/controllers/api/capabilities_controller.rb index 80222c40b..cbdcace0c 100644 --- a/app/controllers/api/capabilities_controller.rb +++ b/app/controllers/api/capabilities_controller.rb @@ -1,5 +1,7 @@ module Api class CapabilitiesController < ApiController + skip_before_action :check_api_readable + authorize_resource :class => false before_action :set_request_formats diff --git a/app/controllers/api/changeset_comments_controller.rb b/app/controllers/api/changeset_comments_controller.rb index 756e56dcc..4a96ec3bb 100644 --- a/app/controllers/api/changeset_comments_controller.rb +++ b/app/controllers/api/changeset_comments_controller.rb @@ -1,7 +1,6 @@ module Api class ChangesetCommentsController < ApiController before_action :check_api_writable - before_action :check_api_readable, :except => [:create] before_action :authorize authorize_resource @@ -105,7 +104,7 @@ module Api ## # Check if the current user has exceed the rate limit for comments def rate_limit_exceeded? - recent_comments = current_user.changeset_comments.where("created_at >= ?", Time.now.utc - 1.hour).count + recent_comments = current_user.changeset_comments.where(:created_at => Time.now.utc - 1.hour..).count recent_comments >= current_user.max_changeset_comments_per_hour end diff --git a/app/controllers/api/changesets_controller.rb b/app/controllers/api/changesets_controller.rb index 616d3fdec..3d59eeb17 100644 --- a/app/controllers/api/changesets_controller.rb +++ b/app/controllers/api/changesets_controller.rb @@ -3,7 +3,6 @@ module Api class ChangesetsController < ApiController before_action :check_api_writable, :only => [:create, :update, :upload, :subscribe, :unsubscribe] - before_action :check_api_readable, :except => [:index, :create, :update, :upload, :download, :subscribe, :unsubscribe] before_action :setup_user_auth, :only => [:show] before_action :authorize, :only => [:create, :update, :upload, :close, :subscribe, :unsubscribe] @@ -331,7 +330,7 @@ module Api changesets.where("closed_at >= ? and created_at <= ?", from, to) else # if there is no comma, assume its a lower limit on time - changesets.where("closed_at >= ?", Time.parse(time).utc) + changesets.where(:closed_at => Time.parse(time).utc..) end # stupid Time seems to throw both of these for bad parsing, so # we have to catch both and ensure the correct code path is taken. diff --git a/app/controllers/api/map_controller.rb b/app/controllers/api/map_controller.rb index 5a05f6de2..6d4a9feb6 100644 --- a/app/controllers/api/map_controller.rb +++ b/app/controllers/api/map_controller.rb @@ -1,7 +1,5 @@ module Api class MapController < ApiController - before_action :check_api_readable - authorize_resource :class => false around_action :api_call_handle_error, :api_call_timeout diff --git a/app/controllers/api/nodes_controller.rb b/app/controllers/api/nodes_controller.rb index dc7d04dc5..5aad78dbf 100644 --- a/app/controllers/api/nodes_controller.rb +++ b/app/controllers/api/nodes_controller.rb @@ -3,7 +3,6 @@ module Api class NodesController < ApiController before_action :check_api_writable, :only => [:create, :update, :delete] - before_action :check_api_readable, :except => [:create, :update, :delete] before_action :authorize, :only => [:create, :update, :delete] authorize_resource diff --git a/app/controllers/api/notes_controller.rb b/app/controllers/api/notes_controller.rb index 8a0a82c40..d53059a94 100644 --- a/app/controllers/api/notes_controller.rb +++ b/app/controllers/api/notes_controller.rb @@ -1,6 +1,5 @@ module Api class NotesController < ApiController - before_action :check_api_readable before_action :check_api_writable, :only => [:create, :comment, :close, :reopen, :destroy] before_action :setup_user_auth, :only => [:create, :show] before_action :authorize, :only => [:close, :reopen, :destroy, :comment] diff --git a/app/controllers/api/old_elements_controller.rb b/app/controllers/api/old_elements_controller.rb index 6a468a900..2343252db 100644 --- a/app/controllers/api/old_elements_controller.rb +++ b/app/controllers/api/old_elements_controller.rb @@ -3,7 +3,6 @@ # nodes, ways and relations are basically identical. module Api class OldElementsController < ApiController - before_action :check_api_readable before_action :check_api_writable, :only => [:redact] before_action :setup_user_auth, :only => [:history, :show] before_action :authorize, :only => [:redact] diff --git a/app/controllers/api/permissions_controller.rb b/app/controllers/api/permissions_controller.rb index 8c0c949dc..717bbfa6f 100644 --- a/app/controllers/api/permissions_controller.rb +++ b/app/controllers/api/permissions_controller.rb @@ -1,7 +1,5 @@ module Api class PermissionsController < ApiController - before_action :check_api_readable - authorize_resource :class => false before_action :setup_user_auth diff --git a/app/controllers/api/relations_controller.rb b/app/controllers/api/relations_controller.rb index e82ac6368..5fb99dbd1 100644 --- a/app/controllers/api/relations_controller.rb +++ b/app/controllers/api/relations_controller.rb @@ -1,7 +1,6 @@ module Api class RelationsController < ApiController before_action :check_api_writable, :only => [:create, :update, :delete] - before_action :check_api_readable, :except => [:create, :update, :delete] before_action :authorize, :only => [:create, :update, :delete] authorize_resource diff --git a/app/controllers/api/tracepoints_controller.rb b/app/controllers/api/tracepoints_controller.rb index f38351de9..d8d9da98b 100644 --- a/app/controllers/api/tracepoints_controller.rb +++ b/app/controllers/api/tracepoints_controller.rb @@ -1,7 +1,5 @@ module Api class TracepointsController < ApiController - before_action :check_api_readable - authorize_resource around_action :api_call_handle_error, :api_call_timeout diff --git a/app/controllers/api/traces_controller.rb b/app/controllers/api/traces_controller.rb index 956bcde6e..738642fff 100644 --- a/app/controllers/api/traces_controller.rb +++ b/app/controllers/api/traces_controller.rb @@ -1,14 +1,11 @@ module Api class TracesController < ApiController - before_action :check_database_readable, :except => [:show, :data] - before_action :check_database_writable, :only => [:create, :update, :destroy] + before_action :check_api_writable, :only => [:create, :update, :destroy] before_action :set_locale before_action :authorize authorize_resource - before_action :check_api_readable, :only => [:show, :data] - before_action :check_api_writable, :only => [:create, :update, :destroy] before_action :offline_error, :only => [:create, :destroy, :data] around_action :api_call_handle_error diff --git a/app/controllers/api/user_blocks_controller.rb b/app/controllers/api/user_blocks_controller.rb index 19fd4b400..6c285e14a 100644 --- a/app/controllers/api/user_blocks_controller.rb +++ b/app/controllers/api/user_blocks_controller.rb @@ -1,7 +1,5 @@ module Api class UserBlocksController < ApiController - before_action :check_api_readable - authorize_resource around_action :api_call_handle_error, :api_call_timeout diff --git a/app/controllers/api/user_preferences_controller.rb b/app/controllers/api/user_preferences_controller.rb index 02a23095a..cb852ce88 100644 --- a/app/controllers/api/user_preferences_controller.rb +++ b/app/controllers/api/user_preferences_controller.rb @@ -1,6 +1,7 @@ # Update and read user preferences, which are arbitrary key/val pairs module Api class UserPreferencesController < ApiController + before_action :check_api_writable, :only => [:update_all, :update, :destroy] before_action :authorize authorize_resource @@ -66,7 +67,7 @@ module Api pref.k = params[:preference_key] end - pref.v = request.raw_post.chomp + pref.v = request.raw_post.chomp.force_encoding("UTF-8") pref.save! render :plain => "" diff --git a/app/controllers/api/users_controller.rb b/app/controllers/api/users_controller.rb index 6fa47095a..5ff275ee9 100644 --- a/app/controllers/api/users_controller.rb +++ b/app/controllers/api/users_controller.rb @@ -1,6 +1,5 @@ module Api class UsersController < ApiController - before_action :check_api_readable before_action :disable_terms_redirect, :only => [:details] before_action :setup_user_auth, :only => [:show, :index] before_action :authorize, :only => [:details, :gpx_files] diff --git a/app/controllers/api/versions_controller.rb b/app/controllers/api/versions_controller.rb index d5c9c5f87..d311a18d2 100644 --- a/app/controllers/api/versions_controller.rb +++ b/app/controllers/api/versions_controller.rb @@ -1,5 +1,6 @@ module Api class VersionsController < ApiController + skip_before_action :check_api_readable authorize_resource :class => false before_action :set_request_formats diff --git a/app/controllers/api/ways_controller.rb b/app/controllers/api/ways_controller.rb index f8254d802..4099e1676 100644 --- a/app/controllers/api/ways_controller.rb +++ b/app/controllers/api/ways_controller.rb @@ -1,7 +1,6 @@ module Api class WaysController < ApiController before_action :check_api_writable, :only => [:create, :update, :delete] - before_action :check_api_readable, :except => [:create, :update, :delete] before_action :authorize, :only => [:create, :update, :delete] authorize_resource diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index edafac7cc..ff7f694c5 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -1,6 +1,8 @@ class ApiController < ApplicationController skip_before_action :verify_authenticity_token + before_action :check_api_readable + private ## diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f5accc3c4..05fa76658 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -13,13 +13,30 @@ class ApplicationController < ActionController::Base rescue_from RailsParam::InvalidParameterError, :with => :invalid_parameter before_action :fetch_body - around_action :better_errors_allow_inline, :if => proc { Rails.env.development? } attr_accessor :current_user, :oauth_token helper_method :current_user helper_method :oauth_token + def self.allow_thirdparty_images(**options) + content_security_policy(options) do |policy| + policy.img_src("*") + end + end + + def self.allow_social_login(**options) + content_security_policy(options) do |policy| + policy.form_action(*policy.form_action, "accounts.google.com", "*.facebook.com", "login.microsoftonline.com", "github.com", "meta.wikimedia.org") + end + end + + def self.allow_all_form_action(**options) + content_security_policy(options) do |policy| + policy.form_action(nil) + end + end + private def authorize_web @@ -233,13 +250,15 @@ class ApplicationController < ActionController::Base end def map_layout - append_content_security_policy_directives( - :child_src => %w[http://127.0.0.1:8111 https://127.0.0.1:8112], - :frame_src => %w[http://127.0.0.1:8111 https://127.0.0.1:8112], - :connect_src => [Settings.nominatim_url, Settings.overpass_url, Settings.fossgis_osrm_url, Settings.graphhopper_url, Settings.fossgis_valhalla_url], - :form_action => %w[render.openstreetmap.org], - :style_src => %w['unsafe-inline'] - ) + policy = request.content_security_policy.clone + + policy.child_src(*policy.child_src, "http://127.0.0.1:8111", "https://127.0.0.1:8112") + policy.frame_src(*policy.frame_src, "http://127.0.0.1:8111", "https://127.0.0.1:8112") + policy.connect_src(*policy.connect_src, Settings.nominatim_url, Settings.overpass_url, Settings.fossgis_osrm_url, Settings.graphhopper_url, Settings.fossgis_valhalla_url) + policy.form_action(*policy.form_action, "render.openstreetmap.org") + policy.style_src(*policy.style_src, :unsafe_inline) + + request.content_security_policy = policy case Settings.status when "database_offline", "api_offline" @@ -251,10 +270,6 @@ class ApplicationController < ActionController::Base request.xhr? ? "xhr" : "map" end - def allow_thirdparty_images - append_content_security_policy_directives(:img_src => %w[*]) - end - def preferred_editor if params[:editor] params[:editor] @@ -277,17 +292,6 @@ class ApplicationController < ActionController::Base end end - def better_errors_allow_inline - yield - rescue StandardError - append_content_security_policy_directives( - :script_src => %w['unsafe-inline'], - :style_src => %w['unsafe-inline'] - ) - - raise - end - def current_ability Ability.new(current_user) end diff --git a/app/controllers/changesets_controller.rb b/app/controllers/changesets_controller.rb index 19ec9c91e..a5ddaf364 100644 --- a/app/controllers/changesets_controller.rb +++ b/app/controllers/changesets_controller.rb @@ -60,7 +60,7 @@ class ChangesetsController < ApplicationController changesets = changesets.where(:user => current_user.nearby) end - changesets = changesets.where("changesets.id <= ?", @params[:max_id]) if @params[:max_id] + changesets = changesets.where(:changesets => { :id => ..@params[:max_id] }) if @params[:max_id] @changesets = changesets.order("changesets.id DESC").limit(20).preload(:user, :changeset_tags, :comments) @@ -88,7 +88,7 @@ class ChangesetsController < ApplicationController if @changeset.user.active? && @changeset.user.data_public? changesets = conditions_nonempty(@changeset.user.changesets) @next_by_user = changesets.where("id > ?", @changeset.id).reorder(:id => :asc).first - @prev_by_user = changesets.where("id < ?", @changeset.id).reorder(:id => :desc).first + @prev_by_user = changesets.where(:id => ...@changeset.id).reorder(:id => :desc).first end render :layout => map_layout rescue ActiveRecord::RecordNotFound diff --git a/app/controllers/concerns/session_methods.rb b/app/controllers/concerns/session_methods.rb index 5dcddb82d..45cf0d943 100644 --- a/app/controllers/concerns/session_methods.rb +++ b/app/controllers/concerns/session_methods.rb @@ -39,7 +39,7 @@ module SessionMethods session[:fingerprint] = user.fingerprint session_expires_after 28.days if session[:remember_me] - target = referer || session[:referer] || url_for(:controller => :site, :action => :index) + target = referer || url_for(:controller => :site, :action => :index) # The user is logged in, so decide where to send them: # @@ -56,31 +56,28 @@ module SessionMethods end session.delete(:remember_me) - session.delete(:referer) end ## # process a failed login - def failed_login(message, username = nil) + def failed_login(message, username, referer = nil) flash[:error] = message - redirect_to :controller => "sessions", :action => "new", :referer => session[:referer], + redirect_to :controller => "sessions", :action => "new", :referer => referer, :username => username, :remember_me => session[:remember_me] session.delete(:remember_me) - session.delete(:referer) end ## # - def unconfirmed_login(user) + def unconfirmed_login(user, referer = nil) session[:pending_user] = user.id redirect_to :controller => "confirmations", :action => "confirm", - :display_name => user.display_name, :referer => session[:referer] + :display_name => user.display_name, :referer => referer session.delete(:remember_me) - session.delete(:referer) end ## diff --git a/app/controllers/diary_comments_controller.rb b/app/controllers/diary_comments_controller.rb new file mode 100644 index 000000000..8abf2071b --- /dev/null +++ b/app/controllers/diary_comments_controller.rb @@ -0,0 +1,40 @@ +class DiaryCommentsController < ApplicationController + include UserMethods + include PaginationMethods + + layout "site" + + before_action :authorize_web + before_action :set_locale + before_action :check_database_readable + + authorize_resource + + before_action :lookup_user, :only => :index + before_action :check_database_writable, :only => [:hide, :unhide] + + allow_thirdparty_images :only => :index + + def index + @title = t ".title", :user => @user.display_name + + comments = DiaryComment.where(:user => @user) + comments = comments.visible unless can? :unhide, DiaryComment + + @params = params.permit(:display_name, :before, :after) + + @comments, @newer_comments_id, @older_comments_id = get_page_items(comments, :includes => [:user]) + end + + def hide + comment = DiaryComment.find(params[:comment]) + comment.update(:visible => false) + redirect_to diary_entry_path(comment.diary_entry.user, comment.diary_entry) + end + + def unhide + comment = DiaryComment.find(params[:comment]) + comment.update(:visible => true) + redirect_to diary_entry_path(comment.diary_entry.user, comment.diary_entry) + end +end diff --git a/app/controllers/diary_entries_controller.rb b/app/controllers/diary_entries_controller.rb index 8da0842eb..bf6e8d0b1 100644 --- a/app/controllers/diary_entries_controller.rb +++ b/app/controllers/diary_entries_controller.rb @@ -10,9 +10,10 @@ class DiaryEntriesController < ApplicationController authorize_resource - before_action :lookup_user, :only => [:show, :comments] - before_action :check_database_writable, :only => [:new, :create, :edit, :update, :comment, :hide, :hidecomment, :subscribe, :unsubscribe] - before_action :allow_thirdparty_images, :only => [:new, :create, :edit, :update, :index, :show, :comments] + before_action :lookup_user, :only => :show + before_action :check_database_writable, :only => [:new, :create, :edit, :update, :comment, :hide, :unhide, :subscribe, :unsubscribe] + + allow_thirdparty_images :only => [:new, :create, :edit, :update, :index, :show] def index if params[:display_name] @@ -67,7 +68,8 @@ class DiaryEntriesController < ApplicationController @entry = entries.find_by(:id => params[:id]) if @entry @title = t ".title", :user => params[:display_name], :title => @entry.title - @comments = can?(:unhidecomment, DiaryEntry) ? @entry.comments : @entry.visible_comments + @og_image = @entry.body.image + @comments = can?(:unhide, DiaryComment) ? @entry.comments : @entry.visible_comments else @title = t "diary_entries.no_such_entry.title", :id => params[:id] render :action => "no_such_entry", :status => :not_found @@ -227,29 +229,6 @@ class DiaryEntriesController < ApplicationController redirect_to :action => "index", :display_name => entry.user.display_name end - def hidecomment - comment = DiaryComment.find(params[:comment]) - comment.update(:visible => false) - redirect_to diary_entry_path(comment.diary_entry.user, comment.diary_entry) - end - - def unhidecomment - comment = DiaryComment.find(params[:comment]) - comment.update(:visible => true) - redirect_to diary_entry_path(comment.diary_entry.user, comment.diary_entry) - end - - def comments - @title = t ".title", :user => @user.display_name - - comments = DiaryComment.where(:user => @user) - comments = comments.visible unless can? :unhidecomment, DiaryEntry - - @params = params.permit(:display_name, :before, :after) - - @comments, @newer_comments_id, @older_comments_id = get_page_items(comments, :includes => [:user]) - end - private ## diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb index 94851de96..cddc97b68 100644 --- a/app/controllers/export_controller.rb +++ b/app/controllers/export_controller.rb @@ -4,6 +4,10 @@ class ExportController < ApplicationController before_action :update_totp, :only => [:finish] authorize_resource :class => false + content_security_policy(:only => :embed) do |policy| + policy.frame_ancestors("*") + end + caches_page :embed # When the user clicks 'Export' we redirect to a URL which generates the export download @@ -25,9 +29,5 @@ class ExportController < ApplicationController end end - def embed - append_content_security_policy_directives( - :frame_ancestors => %w[*] - ) - end + def embed; end end diff --git a/app/controllers/friendships_controller.rb b/app/controllers/friendships_controller.rb index 7b14f2e82..ab54cbfd1 100644 --- a/app/controllers/friendships_controller.rb +++ b/app/controllers/friendships_controller.rb @@ -19,7 +19,7 @@ class FriendshipsController < ApplicationController friendship.befriendee = @friend if current_user.friends_with?(@friend) flash[:warning] = t ".already_a_friend", :name => @friend.display_name - elsif current_user.friendships.where("created_at >= ?", Time.now.utc - 1.hour).count >= current_user.max_friends_per_hour + elsif current_user.friendships.where(:created_at => Time.now.utc - 1.hour..).count >= current_user.max_friends_per_hour flash.now[:error] = t ".limit_exceeded" elsif friendship.save flash[:notice] = t ".success", :name => @friend.display_name diff --git a/app/controllers/geocoder_controller.rb b/app/controllers/geocoder_controller.rb index 912247c9c..ee3c3479c 100644 --- a/app/controllers/geocoder_controller.rb +++ b/app/controllers/geocoder_controller.rb @@ -13,10 +13,10 @@ class GeocoderController < ApplicationController @sources = [] if @params[:lat] && @params[:lon] - @sources.push "latlon" - @sources.push "osm_nominatim_reverse" + @sources.push(:name => "latlon", :url => root_path) + @sources.push(:name => "osm_nominatim_reverse", :url => nominatim_reverse_url(:format => "html")) elsif @params[:query] - @sources.push "osm_nominatim" + @sources.push(:name => "osm_nominatim", :url => nominatim_url(:format => "html")) end if @sources.empty? @@ -71,21 +71,8 @@ class GeocoderController < ApplicationController end def search_osm_nominatim - # get query parameters - query = params[:query] - minlon = params[:minlon] - minlat = params[:minlat] - maxlon = params[:maxlon] - maxlat = params[:maxlat] - - # get view box - viewbox = "&viewbox=#{minlon},#{maxlat},#{maxlon},#{minlat}" if minlon && minlat && maxlon && maxlat - - # get objects to excude - exclude = "&exclude_place_ids=#{params[:exclude]}" if params[:exclude] - # ask nominatim - response = fetch_xml("#{Settings.nominatim_url}search?format=xml&extratags=1&q=#{escape_query(query)}#{viewbox}#{exclude}&accept-language=#{http_accept_language.user_preferred_languages.join(',')}") + response = fetch_xml(nominatim_url(:format => "xml")) # extract the results from the response results = response.elements["searchresults"] @@ -138,15 +125,13 @@ class GeocoderController < ApplicationController def search_osm_nominatim_reverse # get query parameters - lat = params[:lat] - lon = params[:lon] zoom = params[:zoom] # create result array @results = [] # ask nominatim - response = fetch_xml("#{Settings.nominatim_url}reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{http_accept_language.user_preferred_languages.join(',')}") + response = fetch_xml(nominatim_reverse_url(:format => "xml")) # parse the response response.elements.each("reversegeocode/result") do |result| @@ -171,6 +156,34 @@ class GeocoderController < ApplicationController private + def nominatim_url(format: nil) + # get query parameters + query = params[:query] + minlon = params[:minlon] + minlat = params[:minlat] + maxlon = params[:maxlon] + maxlat = params[:maxlat] + + # get view box + viewbox = "&viewbox=#{minlon},#{maxlat},#{maxlon},#{minlat}" if minlon && minlat && maxlon && maxlat + + # get objects to excude + exclude = "&exclude_place_ids=#{params[:exclude]}" if params[:exclude] + + # build url + "#{Settings.nominatim_url}search?format=#{format}&extratags=1&q=#{escape_query(query)}#{viewbox}#{exclude}&accept-language=#{http_accept_language.user_preferred_languages.join(',')}" + end + + def nominatim_reverse_url(format: nil) + # get query parameters + lat = params[:lat] + lon = params[:lon] + zoom = params[:zoom] + + # build url + "#{Settings.nominatim_url}reverse?format=#{format}&lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{http_accept_language.user_preferred_languages.join(',')}" + end + def fetch_text(url) response = OSM.http_client.get(URI.parse(url)) @@ -205,7 +218,7 @@ class GeocoderController < ApplicationController query.match(/^(\d{1,3})°?\s*(\d{1,2})['′]?(?:\s*(\d{1,3}(\.\d*)?)?["″]?)?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,2})['′]?(?:\s*(\d{1,3}(\.\d*)?)?["″]?)?\s*([EW])$/).try(:captures) # degrees, minutes, decimal seconds [NSEW] params.merge!(dms_to_decdeg(latlon)).delete(:query) - elsif latlon = query.match(/^([+-]?\d+(\.\d*)?)(?:\s+|\s*,\s*)([+-]?\d+(\.\d*)?)$/) + elsif latlon = query.match(%r{^([+-]?\d+(\.\d*)?)(?:\s+|\s*[,/]\s*)([+-]?\d+(\.\d*)?)$}) params.merge!(:lat => latlon[1].to_f, :lon => latlon[3].to_f).delete(:query) params[:latlon_digits] = true unless params[:whereami] diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 111a31f96..e4d6c70d9 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -11,7 +11,8 @@ class MessagesController < ApplicationController before_action :lookup_user, :only => [:new, :create] before_action :check_database_readable before_action :check_database_writable, :only => [:new, :create, :reply, :mark, :destroy] - before_action :allow_thirdparty_images, :only => [:new, :create, :show] + + allow_thirdparty_images :only => [:new, :create, :show] # Show a message def show @@ -42,7 +43,7 @@ class MessagesController < ApplicationController @message.sender = current_user @message.sent_on = Time.now.utc - if current_user.sent_messages.where("sent_on >= ?", Time.now.utc - 1.hour).count >= current_user.max_messages_per_hour + if current_user.sent_messages.where(:sent_on => Time.now.utc - 1.hour..).count >= current_user.max_messages_per_hour flash.now[:error] = t ".limit_exceeded" render :action => "new" elsif @message.save @@ -116,7 +117,7 @@ class MessagesController < ApplicationController # Set the message as being read or unread. def mark - @message = Message.where(:recipient => current_user).or(Message.where(:sender => current_user)).find(params[:message_id]) + @message = current_user.messages.find(params[:message_id]) if params[:mark] == "unread" message_read = false notice = t ".as_unread" diff --git a/app/controllers/oauth2_authorizations_controller.rb b/app/controllers/oauth2_authorizations_controller.rb index dca95de4e..415ab2775 100644 --- a/app/controllers/oauth2_authorizations_controller.rb +++ b/app/controllers/oauth2_authorizations_controller.rb @@ -3,13 +3,8 @@ class Oauth2AuthorizationsController < Doorkeeper::AuthorizationsController prepend_before_action :authorize_web before_action :set_locale - before_action :allow_all_form_action, :only => [:new] - authorize_resource :class => false - - private + allow_all_form_action :only => :new - def allow_all_form_action - override_content_security_policy_directives(:form_action => []) if Settings.csp_enforce || Settings.key?(:csp_report_url) - end + authorize_resource :class => false end diff --git a/app/controllers/oauth_controller.rb b/app/controllers/oauth_controller.rb index 49af05b0d..62a68b533 100644 --- a/app/controllers/oauth_controller.rb +++ b/app/controllers/oauth_controller.rb @@ -9,6 +9,8 @@ class OauthController < ApplicationController layout "site" + allow_all_form_action :only => :oauth1_authorize + def revoke @token = current_user.oauth_tokens.find_by :token => params[:token] if @token @@ -41,8 +43,6 @@ class OauthController < ApplicationController end def oauth1_authorize - override_content_security_policy_directives(:form_action => []) if Settings.csp_enforce || Settings.key?(:csp_report_url) - if @token.invalidated? @message = t "oauth.authorize_failure.invalid" render :action => "authorize_failure" diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index fdf2df6a7..a3e6f42f0 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -11,18 +11,20 @@ class SessionsController < ApplicationController authorize_resource :class => false - def new - override_content_security_policy_directives(:form_action => []) if Settings.csp_enforce || Settings.key?(:csp_report_url) + allow_all_form_action :only => :new - session[:referer] = safe_referer(params[:referer]) if params[:referer] + def new + referer = safe_referer(params[:referer]) if params[:referer] - parse_oauth_referer session[:referer] + parse_oauth_referer referer end def create session[:remember_me] ||= params[:remember_me] - session[:referer] = safe_referer(params[:referer]) if params[:referer] - password_authentication(params[:username].strip, params[:password]) + + referer = safe_referer(params[:referer]) if params[:referer] + + password_authentication(params[:username].strip, params[:password], referer) end def destroy @@ -43,15 +45,15 @@ class SessionsController < ApplicationController ## # handle password authentication - def password_authentication(username, password) + def password_authentication(username, password, referer = nil) if (user = User.authenticate(:username => username, :password => password)) - successful_login(user) + successful_login(user, referer) elsif (user = User.authenticate(:username => username, :password => password, :pending => true)) - unconfirmed_login(user) + unconfirmed_login(user, referer) elsif User.authenticate(:username => username, :password => password, :suspended => true) - failed_login({ :partial => "sessions/suspended_flash" }, username) + failed_login({ :partial => "sessions/suspended_flash" }, username, referer) else - failed_login t("sessions.new.auth failure"), username + failed_login(t("sessions.new.auth failure"), username, referer) end end end diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb index 3d830c63f..5d63e79fd 100644 --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@ -12,6 +12,17 @@ class SiteController < ApplicationController authorize_resource :class => false + content_security_policy(:only => :edit) do |policy| + policy.frame_src(*policy.frame_src, :blob) + end + + content_security_policy(:only => :id) do |policy| + policy.connect_src("*") + policy.img_src(*policy.img_src, "*", :blob) + policy.script_src(*policy.script_src, :unsafe_eval) + policy.style_src(*policy.style_src, :unsafe_inline) + end + def index session[:location] ||= OSM.ip_location(request.env["REMOTE_ADDR"]) unless Settings.status == "database_readonly" || Settings.status == "database_offline" end @@ -71,12 +82,6 @@ class SiteController < ApplicationController require_user end - if %w[id].include?(editor) - append_content_security_policy_directives( - :frame_src => %w[blob:] - ) - end - begin if params[:node] bbox = Node.visible.find(params[:node]).bbox.to_unscaled @@ -105,6 +110,7 @@ class SiteController < ApplicationController end def copyright + @title = t ".title" @locale = params[:copyright_locale] || I18n.locale end @@ -136,13 +142,6 @@ class SiteController < ApplicationController end def id - append_content_security_policy_directives( - :connect_src => %w[*], - :img_src => %w[* blob:], - :script_src => %w[dev.virtualearth.net 'unsafe-eval'], - :style_src => %w['unsafe-inline'] - ) - render :layout => false end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2cdec642d..b7c156bd9 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -17,7 +17,9 @@ class UsersController < ApplicationController before_action :check_database_writable, :only => [:new, :go_public] before_action :require_cookies, :only => [:new] before_action :lookup_user_by_name, :only => [:set_status, :destroy] - before_action :allow_thirdparty_images, :only => [:show] + + allow_thirdparty_images :only => :show + allow_social_login :only => :new ## # display a list of users matching specified criteria @@ -54,18 +56,10 @@ class UsersController < ApplicationController def new @title = t ".title" - @referer = if params[:referer] - safe_referer(params[:referer]) - else - session[:referer] - end + @referer = safe_referer(params[:referer]) parse_oauth_referer @referer - append_content_security_policy_directives( - :form_action => %w[accounts.google.com *.facebook.com login.microsoftonline.com github.com meta.wikimedia.org] - ) - if current_user # The user is logged in already, so don't show them the signup # page, instead send them to the home page @@ -94,10 +88,6 @@ class UsersController < ApplicationController self.current_user = User.new(user_params) if check_signup_allowed(current_user.email) - session[:referer] = safe_referer(params[:referer]) if params[:referer] - - Rails.logger.info "create: #{session[:referer]}" - if current_user.auth_uid.present? # We are creating an account with external authentication and # no password was specified so create a random one @@ -108,14 +98,9 @@ class UsersController < ApplicationController if current_user.invalid? # Something is wrong with a new user, so rerender the form render :action => "new" - elsif current_user.auth_provider.present? - # Verify external authenticator before moving on - session[:new_user] = current_user.slice("email", "display_name", "pass_crypt", "pass_crypt_confirmation") - redirect_to auth_url(current_user.auth_provider, current_user.auth_uid), :status => :temporary_redirect else # Save the user record - session[:new_user] = current_user.slice("email", "display_name", "pass_crypt", "pass_crypt_confirmation") - save_new_user params[:email_hmac] + save_new_user params[:email_hmac], params[:referer] end end end @@ -200,6 +185,7 @@ class UsersController < ApplicationController ## # omniauth success callback def auth_success + referer = request.env["omniauth.params"]["referer"] auth_info = request.env["omniauth.auth"] provider = auth_info[:provider] @@ -228,12 +214,6 @@ class UsersController < ApplicationController session[:user_errors] = current_user.errors.as_json redirect_to edit_account_path - elsif session[:new_user] - session[:new_user]["auth_provider"] = provider - session[:new_user]["auth_uid"] = uid - - email_hmac = UsersController.message_hmac(email) if email_verified && email - save_new_user email_hmac else user = User.find_by(:auth_provider => provider, :auth_uid => uid) @@ -246,18 +226,18 @@ class UsersController < ApplicationController if user case user.status when "pending" - unconfirmed_login(user) + unconfirmed_login(user, referer) when "active", "confirmed" - successful_login(user, request.env["omniauth.params"]["referer"]) + successful_login(user, referer) when "suspended" - failed_login({ :partial => "sessions/suspended_flash" }) + failed_login({ :partial => "sessions/suspended_flash" }, user.display_name, referer) else - failed_login t("sessions.new.auth failure") + failed_login(t("sessions.new.auth failure"), user.display_name, referer) end else email_hmac = UsersController.message_hmac(email) if email_verified && email redirect_to :action => "new", :nickname => name, :email => email, :email_hmac => email_hmac, - :auth_provider => provider, :auth_uid => uid + :auth_provider => provider, :auth_uid => uid, :referer => referer end end end @@ -281,9 +261,7 @@ class UsersController < ApplicationController private - def save_new_user(email_hmac) - new_user = session.delete(:new_user) - self.current_user = User.new(new_user) + def save_new_user(email_hmac, referer = nil) if check_signup_allowed(current_user.email) current_user.data_public = true current_user.description = "" if current_user.description.nil? @@ -306,11 +284,10 @@ class UsersController < ApplicationController flash[:matomo_goal] = Settings.matomo["goals"]["signup"] if defined?(Settings.matomo) - referer = welcome_path(welcome_options) + referer = welcome_path(welcome_options(referer)) if current_user.status == "active" - session[:referer] = referer - successful_login(current_user) + successful_login(current_user, referer) else session[:pending_user] = current_user.id UserMailer.signup_confirm(current_user, current_user.generate_token_for(:new_user), referer).deliver_later @@ -322,8 +299,8 @@ class UsersController < ApplicationController end end - def welcome_options - uri = URI(session[:referer]) if session[:referer].present? + def welcome_options(referer = nil) + uri = URI(referer) if referer.present? return { "oauth_return_url" => uri&.to_s } if uri&.path == oauth_authorization_path diff --git a/app/helpers/browse_tags_helper.rb b/app/helpers/browse_tags_helper.rb index 6d3bf5e91..bb79d9eaf 100644 --- a/app/helpers/browse_tags_helper.rb +++ b/app/helpers/browse_tags_helper.rb @@ -69,39 +69,31 @@ module BrowseTagsHelper case key when "wikipedia", /^(#{SECONDARY_WIKI_PREFIXES}):wikipedia/o - # This regex should match Wikipedia language codes, everything - # from de to zh-classical - lang = if value =~ /^([a-z-]{2,12}):(.+)$/i - # Value is : so split it up - # Note that value is always left as-is, see: https://trac.openstreetmap.org/ticket/4315 - Regexp.last_match(1) - else - # Value is <title> so default to English Wikipedia - "en" - end + lang = "en" when /^wikipedia:(\S+)$/ - # Language is in the key, so assume value is the title lang = Regexp.last_match(1) else - # Not a wikipedia key! return nil end - if value =~ /^([^#]*)#(.*)/ - # Contains a reference to a section of the wikipedia article - # Must break it up to correctly build the url - value = Regexp.last_match(1) - section = "##{Regexp.last_match(2)}" - encoded_section = "##{CGI.escape(Regexp.last_match(2).gsub(/ +/, '_'))}" + # This regex should match Wikipedia language codes, everything + # from de to zh-classical + if value =~ /^([a-z-]{2,12}):(.+)$/i + lang = Regexp.last_match(1) + title_section = Regexp.last_match(2) else - section = "" - encoded_section = "" + title_section = value end - { - :url => "https://#{lang}.wikipedia.org/wiki/#{value}?uselang=#{I18n.locale}#{encoded_section}", - :title => value + section - } + title, section = title_section.split("#", 2) + url = "https://#{lang}.wikipedia.org/wiki/#{wiki_encode(title)}?uselang=#{I18n.locale}" + url += "##{wiki_encode(section)}" if section + + { :url => url, :title => value } + end + + def wiki_encode(s) + u s.tr(" ", "_") end def wikidata_links(key, value) @@ -124,9 +116,11 @@ module BrowseTagsHelper end def wikimedia_commons_link(key, value) - if key == "wikimedia_commons" && value =~ /^(?:file|category):/i + if key == "wikimedia_commons" && value =~ /^(file|category):([^#]+)/i + namespace = Regexp.last_match(1) + title = Regexp.last_match(2) return { - :url => "//commons.wikimedia.org/wiki/#{value}?uselang=#{I18n.locale}", + :url => "//commons.wikimedia.org/wiki/#{namespace}:#{u title}?uselang=#{I18n.locale}", :title => value } end diff --git a/app/helpers/open_graph_helper.rb b/app/helpers/open_graph_helper.rb index a91457645..a41831ca6 100644 --- a/app/helpers/open_graph_helper.rb +++ b/app/helpers/open_graph_helper.rb @@ -1,11 +1,12 @@ module OpenGraphHelper - def opengraph_tags(title = nil) + require "addressable/uri" + + def opengraph_tags(title = nil, og_image = nil) tags = { "og:site_name" => t("layouts.project_name.title"), - "og:title" => [title, t("layouts.project_name.title")].compact.join(" | "), + "og:title" => title || t("layouts.project_name.title"), "og:type" => "website", - "og:image" => image_url("osm_logo_256.png", :protocol => "http"), - "og:image:secure_url" => image_url("osm_logo_256.png", :protocol => "https"), + "og:image" => og_image_url(og_image), "og:url" => url_for(:only_path => false), "og:description" => t("layouts.intro_text") } @@ -14,4 +15,15 @@ module OpenGraphHelper tag.meta(:property => property, :content => content) end, "\n") end + + private + + def og_image_url(og_image) + begin + return Addressable::URI.join(root_url, og_image).normalize if og_image + rescue Addressable::URI::InvalidURIError + # return default image + end + image_url("osm_logo_256.png") + end end diff --git a/app/helpers/user_helper.rb b/app/helpers/user_helper.rb index 536f2620e..d767cb887 100644 --- a/app/helpers/user_helper.rb +++ b/app/helpers/user_helper.rb @@ -53,7 +53,7 @@ module UserHelper # External authentication support def openid_logo - image_tag "openid_small.png", :alt => t("application.auth_providers.openid_logo_alt"), :class => "align-text-bottom" + image_tag "openid.svg", :size => "36", :alt => t("application.auth_providers.openid_logo_alt"), :class => "align-text-bottom" end def auth_button(name, provider, options = {}) @@ -61,10 +61,10 @@ module UserHelper image_tag("#{name}.svg", :alt => t("application.auth_providers.#{name}.alt"), :class => "rounded-1", - :size => "24"), + :size => "36"), auth_path(options.merge(:provider => provider)), :method => :post, - :class => "auth_button p-2 d-block", + :class => "auth_button btn btn-light mx-1 p-2 d-block", :title => t("application.auth_providers.#{name}.title") ) end @@ -74,10 +74,10 @@ module UserHelper image_tag("#{name}.svg", :alt => t("application.auth_providers.#{name}.alt"), :class => "rounded-1 me-3", - :size => "24") + t("application.auth_providers.#{name}.title"), + :size => "36") + t("application.auth_providers.#{name}.title"), auth_path(options.merge(:provider => provider)), :method => :post, - :class => "auth_button fs-6 border rounded text-muted text-decoration-none py-2 px-4 d-flex justify-content-center align-items-center", + :class => "auth_button btn btn-outline-secondary fs-6 border rounded py-2 px-4 d-flex justify-content-center align-items-center", :title => t("application.auth_providers.#{name}.title") ) end diff --git a/app/models/changeset.rb b/app/models/changeset.rb index abb494de6..e6bde19a5 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -130,6 +130,8 @@ class Changeset < ApplicationRecord def update_bbox!(bbox_update) bbox.expand!(bbox_update) + raise OSM::APISizeLimitExceeded if bbox.linear_size > size_limit + # update active record. rails 2.1's dirty handling should take care of # whether this object needs saving or not. self.min_lon, self.min_lat, self.max_lon, self.max_lat = @bbox.to_a.collect(&:round) if bbox.complete? @@ -225,4 +227,10 @@ class Changeset < ApplicationRecord def subscribed?(user) subscribers.exists?(user.id) end + + def size_limit + @size_limit ||= ActiveRecord::Base.connection.select_value( + "SELECT api_size_limit($1)", "api_size_limit", [user_id] + ) + end end diff --git a/app/models/diary_comment.rb b/app/models/diary_comment.rb index 55d2c3c84..a88c69f12 100644 --- a/app/models/diary_comment.rb +++ b/app/models/diary_comment.rb @@ -23,7 +23,7 @@ # class DiaryComment < ApplicationRecord - belongs_to :user + belongs_to :user, :counter_cache => true belongs_to :diary_entry scope :visible, -> { where(:visible => true) } diff --git a/app/models/diary_entry.rb b/app/models/diary_entry.rb index e83dfb9ee..089c7e6c6 100644 --- a/app/models/diary_entry.rb +++ b/app/models/diary_entry.rb @@ -50,7 +50,7 @@ class DiaryEntry < ApplicationRecord after_save :spam_check def body - RichText.new(self[:body_format], self[:body]) + @body ||= RichText.new(self[:body_format], self[:body]) end private diff --git a/app/models/issue.rb b/app/models/issue.rb index 54947be30..a3f82ee40 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -50,11 +50,11 @@ class Issue < ApplicationRecord scope :visible_to, ->(user) { where(:assigned_role => user.roles.map(&:role)) } def read_reports - resolved_at.present? ? reports.where("updated_at < ?", resolved_at) : nil + resolved_at.present? ? reports.where(:updated_at => ...resolved_at) : nil end def unread_reports - resolved_at.present? ? reports.where("updated_at >= ?", resolved_at) : reports + resolved_at.present? ? reports.where(:updated_at => resolved_at..) : reports end include AASM diff --git a/app/models/note_comment.rb b/app/models/note_comment.rb index b870e5558..d318c5e95 100644 --- a/app/models/note_comment.rb +++ b/app/models/note_comment.rb @@ -26,7 +26,7 @@ class NoteComment < ApplicationRecord belongs_to :note, :touch => true - belongs_to :author, :class_name => "User", :optional => true + belongs_to :author, :class_name => "User", :optional => true, :counter_cache => true validates :id, :uniqueness => true, :presence => { :on => :update }, :numericality => { :on => :update, :only_integer => true } diff --git a/app/models/trace.rb b/app/models/trace.rb index d1f917571..20723b98d 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -81,7 +81,7 @@ class Trace < ApplicationRecord :content_type => content_type(attachable.path), :identify => false) else - super(attachable) + super end end diff --git a/app/models/user.rb b/app/models/user.rb index 192f52ac4..4241a9e56 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,35 +2,37 @@ # # Table name: users # -# email :string not null -# id :bigint(8) not null, primary key -# pass_crypt :string not null -# creation_time :datetime not null -# display_name :string default(""), not null -# data_public :boolean default(FALSE), not null -# description :text default(""), not null -# home_lat :float -# home_lon :float -# home_zoom :integer default(3) -# pass_salt :string -# email_valid :boolean default(FALSE), not null -# new_email :string -# creation_ip :string -# languages :string -# status :enum default("pending"), not null -# terms_agreed :datetime -# consider_pd :boolean default(FALSE), not null -# auth_uid :string -# preferred_editor :string -# terms_seen :boolean default(FALSE), not null -# description_format :enum default("markdown"), not null -# changesets_count :integer default(0), not null -# traces_count :integer default(0), not null -# diary_entries_count :integer default(0), not null -# image_use_gravatar :boolean default(FALSE), not null -# auth_provider :string -# home_tile :bigint(8) -# tou_agreed :datetime +# email :string not null +# id :bigint(8) not null, primary key +# pass_crypt :string not null +# creation_time :datetime not null +# display_name :string default(""), not null +# data_public :boolean default(FALSE), not null +# description :text default(""), not null +# home_lat :float +# home_lon :float +# home_zoom :integer default(3) +# pass_salt :string +# email_valid :boolean default(FALSE), not null +# new_email :string +# creation_ip :string +# languages :string +# status :enum default("pending"), not null +# terms_agreed :datetime +# consider_pd :boolean default(FALSE), not null +# auth_uid :string +# preferred_editor :string +# terms_seen :boolean default(FALSE), not null +# description_format :enum default("markdown"), not null +# changesets_count :integer default(0), not null +# traces_count :integer default(0), not null +# diary_entries_count :integer default(0), not null +# image_use_gravatar :boolean default(FALSE), not null +# auth_provider :string +# home_tile :bigint(8) +# tou_agreed :datetime +# diary_comments_count :integer default(0) +# note_comments_count :integer default(0) # # Indexes # @@ -411,7 +413,7 @@ class User < ApplicationRecord def max_messages_per_hour account_age_in_seconds = Time.now.utc - created_at account_age_in_hours = account_age_in_seconds / 3600 - recent_messages = messages.where("sent_on >= ?", Time.now.utc - 3600).count + recent_messages = messages.where(:sent_on => Time.now.utc - 3600..).count max_messages = account_age_in_hours.ceil + recent_messages - (active_reports * 10) max_messages.clamp(0, Settings.max_messages_per_hour) end @@ -419,7 +421,7 @@ class User < ApplicationRecord def max_friends_per_hour account_age_in_seconds = Time.now.utc - created_at account_age_in_hours = account_age_in_seconds / 3600 - recent_friends = Friendship.where(:befriendee => self).where("created_at >= ?", Time.now.utc - 3600).count + recent_friends = Friendship.where(:befriendee => self).where(:created_at => Time.now.utc - 3600..).count max_friends = account_age_in_hours.ceil + recent_friends - (active_reports * 10) max_friends.clamp(0, Settings.max_friends_per_hour) end diff --git a/app/views/accounts/edit.html.erb b/app/views/accounts/edit.html.erb index e783367dd..f15bc195c 100644 --- a/app/views/accounts/edit.html.erb +++ b/app/views/accounts/edit.html.erb @@ -22,12 +22,12 @@ <%= 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" }) %> </div> - <small class="form-text text-muted">(<a href="<%= t ".openid.link" %>" target="_new"><%= t ".openid.link text" %></a>)</small> + <small class="form-text text-body-secondary">(<a href="<%= t ".openid.link" %>" target="_new"><%= t ".openid.link text" %></a>)</small> </fieldset> <div class="mb-3"> <label class="form-label"><%= t ".public editing.heading" %></label> - <span class="form-text text-muted"> + <span class="form-text text-body-secondary"> <% if current_user.data_public? %> <%= t ".public editing.enabled" %> (<a href="<%= t ".public editing.enabled link" %>" target="_new"><%= t ".public editing.enabled link text" %></a>) @@ -40,7 +40,7 @@ <div class="mb-3"> <label class="form-label"><%= t ".contributor terms.heading" %></label> - <span class="form-text text-muted"> + <span class="form-text text-body-secondary"> <% if current_user.terms_agreed? %> <%= t ".contributor terms.agreed" %> (<a href="<%= t ".contributor terms.link" %>" target="_new"><%= t ".contributor terms.link text" %></a>) @@ -54,11 +54,11 @@ </span> </div> - <div class="row justify-content-between"> - <div class="col-auto btn-wrapper"> + <div class="row justify-content-between g-1"> + <div class="col-auto"> <%= f.primary t(".save changes button") %> </div> - <div class="col-auto btn-wrapper"> + <div class="col-auto"> <%= link_to t(".delete_account"), account_deletion_path, :class => "btn btn-outline-danger" %> </div> </div> diff --git a/app/views/application/_auth_providers.html.erb b/app/views/application/_auth_providers.html.erb index a79e7b5ce..be921ee9c 100644 --- a/app/views/application/_auth_providers.html.erb +++ b/app/views/application/_auth_providers.html.erb @@ -1,29 +1,42 @@ <div> - <div class="list-inline justify-content-center d-flex align-items-center flex-wrap mb-3 gap-3" id="login_auth_buttons"> + <div class="list-inline justify-content-center d-flex align-items-center flex-wrap w-100 mb-3" id="login_auth_buttons"> + <% prefered_auth_button_available = false %> <% %w[google facebook microsoft github wikipedia].each do |provider| %> <% if Settings.key?("#{provider}_auth_id".to_sym) -%> <% if @preferred_auth_provider == provider %> - <div class="mx-2"><%= auth_button_preferred provider, provider %></div> + <% prefered_auth_button_available = true %> <% end %> <% end -%> <% end -%> - <div class="justify-content-center d-flex gap-1"> - <div> - <%= link_to image_tag("openid.png", - :alt => t("application.auth_providers.openid.title"), - :size => "24"), - "#", - :id => "openid_open_url", - :title => t("application.auth_providers.openid.title"), - :class => "p-2 d-block" %> + <% if prefered_auth_button_available %> + <div class="list-inline justify-content-center d-flex align-items-center flex-wrap w-50"> + <% %w[google facebook microsoft github wikipedia].each do |provider| %> + <% if Settings.key?("#{provider}_auth_id".to_sym) -%> + <% if @preferred_auth_provider == provider %> + <%= auth_button_preferred provider, provider %> + <% end %> + <% end -%> + <% end -%> </div> + <div class="list-inline justify-content-center d-flex align-items-center flex-wrap w-50"> + <% else %> + <div class="list-inline justify-content-center d-flex align-items-center flex-wrap w-100"> + <% end %> + + <%= link_to image_tag("openid.svg", + :alt => t("application.auth_providers.openid.title"), + :size => "36"), + "#", + :id => "openid_open_url", + :title => t("application.auth_providers.openid.title"), + :class => "btn btn-light mx-1 p-2 d-block" %> <% %w[google facebook microsoft github wikipedia].each do |provider| %> <% unless @preferred_auth_provider == provider %> <% if Settings.key?("#{provider}_auth_id".to_sym) -%> - <div><%= auth_button provider, provider %></div> + <%= auth_button provider, provider %> <% end -%> <% end %> <% end -%> @@ -36,7 +49,7 @@ <label for="openid_url" class="form-label"><%= t ".openid_html", :logo => openid_logo %></label> <%= hidden_field_tag("referer", params[:referer], :autocomplete => "off") %> <%= text_field_tag("openid_url", "", :tabindex => 20, :autocomplete => "on", :class => "openid_url form-control") %> - <span class="form-text text-muted">(<a href="<%= t "accounts.edit.openid.link" %>" target="_new"><%= t "accounts.edit.openid.link text" %></a>)</span> + <span class="form-text text-body-secondary">(<a href="<%= t "accounts.edit.openid.link" %>" target="_new"><%= t "accounts.edit.openid.link text" %></a>)</span> </div> <%= submit_tag t(".openid_login_button"), :tabindex => 21, :id => "openid_login_button", :class => "btn btn-primary" %> diff --git a/app/views/browse/_common_details.html.erb b/app/views/browse/_common_details.html.erb index 195332b09..bf6c270cf 100644 --- a/app/views/browse/_common_details.html.erb +++ b/app/views/browse/_common_details.html.erb @@ -7,7 +7,7 @@ #<%= link_to_unless_current common_details.version, :controller => "old_#{@type.pluralize}", :action => :show, :version => common_details.version %> </h4> -<p class="fst-italic"> +<p class="fs-6 overflow-x-auto"> <% if common_details.changeset.tags["comment"].present? %> <%= linkify(common_details.changeset.tags["comment"]) %> <% else %> diff --git a/app/views/browse/_node.html.erb b/app/views/browse/_node.html.erb index 4e2ae0343..0ffe7c68b 100644 --- a/app/views/browse/_node.html.erb +++ b/app/views/browse/_node.html.erb @@ -7,7 +7,7 @@ :id => node.redaction.id), node.redaction) %> </div> <% else %> - <%= tag.div :class => ["browse-section", "browse-node", { "text-muted" => node.redacted? }] do %> + <%= tag.div :class => ["browse-section", "browse-node", { "text-body-secondary" => node.redacted? }] do %> <%= render :partial => "browse/common_details", :object => node %> <% unless node.ways.empty? and node.containing_relation_members.empty? %> diff --git a/app/views/browse/_relation.html.erb b/app/views/browse/_relation.html.erb index a987fe4d8..5dcdffa47 100644 --- a/app/views/browse/_relation.html.erb +++ b/app/views/browse/_relation.html.erb @@ -7,7 +7,7 @@ :id => relation.redaction.id), relation.redaction) %> </div> <% else %> - <%= tag.div :class => ["browse-section", "browse-relation", { "text-muted" => relation.redacted? }] do %> + <%= tag.div :class => ["browse-section", "browse-relation", { "text-body-secondary" => relation.redacted? }] do %> <%= render :partial => "browse/common_details", :object => relation %> <% unless relation.containing_relation_members.empty? %> diff --git a/app/views/browse/_way.html.erb b/app/views/browse/_way.html.erb index d015438fe..d04eff140 100644 --- a/app/views/browse/_way.html.erb +++ b/app/views/browse/_way.html.erb @@ -7,7 +7,7 @@ :id => way.redaction.id), way.redaction) %> </div> <% else %> - <%= tag.div :class => ["browse-section", "browse-way", { "text-muted" => way.redacted? }] do %> + <%= tag.div :class => ["browse-section", "browse-way", { "text-body-secondary" => way.redacted? }] do %> <%= render :partial => "browse/common_details", :object => way %> <% unless way.containing_relation_members.empty? %> diff --git a/app/views/changesets/_changeset.html.erb b/app/views/changesets/_changeset.html.erb index 6362330a9..2a3f65859 100644 --- a/app/views/changesets/_changeset.html.erb +++ b/app/views/changesets/_changeset.html.erb @@ -11,7 +11,7 @@ end %> <%= tag.li :id => "changeset_#{changeset.id}", :data => { :changeset => changeset_data }, :class => "list-group-item list-group-item-action" do %> - <p class="fst-italic"> + <p class="fs-6 text-truncate text-wrap"> <a class="changeset_id link-body-emphasis stretched-link" href="<%= changeset_path(changeset) %>"> <span><%= changeset.tags["comment"].to_s.presence || t("browse.no_comment") %></span> </a> diff --git a/app/views/changesets/_heading.html.erb b/app/views/changesets/_heading.html.erb index a125a135a..acb6c9834 100644 --- a/app/views/changesets/_heading.html.erb +++ b/app/views/changesets/_heading.html.erb @@ -9,7 +9,7 @@ </div> </div> - <small class='text-muted'> + <small class='text-body-secondary'> <%= t(".created_by_html", :link_user => link_to(changeset.user.display_name, changeset.user), :created => l(changeset.created_at, :format => :blog)) %> </small> </div> diff --git a/app/views/changesets/show.html.erb b/app/views/changesets/show.html.erb index 3ba3968f7..915b0ef35 100644 --- a/app/views/changesets/show.html.erb +++ b/app/views/changesets/show.html.erb @@ -3,7 +3,7 @@ <%= render "sidebar_header", :title => t(".title", :id => @changeset.id) %> <div class="browse-section"> - <p class="fst-italic"> + <p class="fs-6 overflow-x-auto"> <%= linkify(@changeset.tags["comment"].to_s.presence || t("browse.no_comment")) %> </p> <p class="details"><%= changeset_details(@changeset) %></p> @@ -18,9 +18,17 @@ <% if current_user %> <div class="col-auto"> <% if @changeset.subscribers.exists?(current_user.id) %> - <button class="btn btn-sm btn-primary" name="unsubscribe" data-method="POST" data-url="<%= api_changeset_unsubscribe_url(@changeset) %>"><%= t("javascripts.changesets.show.unsubscribe") %></button> + <%= tag.button t(".unsubscribe"), + :class => "btn btn-sm btn-primary", + :name => "unsubscribe", + :data => { :method => "POST", + :url => api_changeset_unsubscribe_url(@changeset) } %> <% else %> - <button class="btn btn-sm btn-primary" name="subscribe" data-method="POST" data-url="<%= api_changeset_subscribe_url(@changeset) %>"><%= t("javascripts.changesets.show.subscribe") %></button> + <%= tag.button t(".subscribe"), + :class => "btn btn-sm btn-primary", + :name => "subscribe", + :data => { :method => "POST", + :url => api_changeset_subscribe_url(@changeset) } %> <% end %> </div> <% end %> @@ -31,13 +39,13 @@ <% @comments.each do |comment| %> <% next unless comment.visible || current_user&.moderator? %> <li id="c<%= comment.id %>"> - <small class='text-muted'> + <small class='text-body-secondary'> <%= t comment.visible ? ".comment_by_html" : ".hidden_comment_by_html", :time_ago => friendly_date_ago(comment.created_at), :user => link_to(comment.author.display_name, comment.author) %> <% if current_user&.moderator? %> — - <%= tag.button t("javascripts.changesets.show.#{comment.visible ? 'hide' : 'unhide'}_comment"), + <%= tag.button t(".#{comment.visible ? 'hide' : 'unhide'}_comment"), :class => "btn btn-sm small btn-link link-secondary p-0 align-baseline", :data => { :method => "POST", :url => comment.visible ? changeset_comment_hide_url(comment) : changeset_comment_unhide_url(comment) } %> @@ -66,7 +74,12 @@ <div id="comment-error" class="alert alert-danger p-2 mb-3" hidden> </div> <div> - <button name="comment" data-method="POST" data-url="<%= changeset_comment_url(@changeset) %>" disabled class="btn btn-sm btn-primary"><%= t("javascripts.changesets.show.comment") %></button> + <%= tag.button t(".comment"), + :class => "btn btn-primary", + :name => "comment", + :disabled => true, + :data => { :method => "POST", + :url => changeset_comment_url(@changeset) } %> </div> </form> <% else %> diff --git a/app/views/confirmations/confirm.html.erb b/app/views/confirmations/confirm.html.erb index 879fb8f33..4f98a8539 100644 --- a/app/views/confirmations/confirm.html.erb +++ b/app/views/confirmations/confirm.html.erb @@ -22,12 +22,12 @@ <% else %> <h1> <%= t ".introduction_1" %> - <span class="text-muted"> + <span class="text-body-secondary"> <%= t ".introduction_2" %> </span> </h1> - <p class='text-muted'> + <p class='text-body-secondary'> <%= t ".resend_html", :reconfirm_link => link_to(t(".click_here"), url_for(:action => "confirm_resend")) %> </p> diff --git a/app/views/dashboards/_contact.html.erb b/app/views/dashboards/_contact.html.erb index b28a28a26..759faab8f 100644 --- a/app/views/dashboards/_contact.html.erb +++ b/app/views/dashboards/_contact.html.erb @@ -9,7 +9,7 @@ <%= user_thumbnail contact %> </div> <div class="col"> - <p class='text-muted mb-0'> + <p class='text-body-secondary mb-0'> <%= link_to contact.display_name, contact %> <% if @user.home_location? and contact.home_location? %> <% distance = @user.distance(contact) %> @@ -32,7 +32,7 @@ </p> <nav class='secondary-actions'> - <ul class='clearfix text-muted'> + <ul class='clearfix text-body-secondary'> <li><%= link_to t("users.show.send message"), new_message_path(contact) %></li> <li> <% if current_user.friends_with?(contact) %> diff --git a/app/views/diary_entries/comments.html.erb b/app/views/diary_comments/index.html.erb similarity index 58% rename from app/views/diary_entries/comments.html.erb rename to app/views/diary_comments/index.html.erb index aa0fceb95..0dd03d9d0 100644 --- a/app/views/diary_entries/comments.html.erb +++ b/app/views/diary_comments/index.html.erb @@ -17,18 +17,18 @@ </thead> <% @comments.each do |comment| -%> <tr> - <td width="25%" class="<%= "text-muted" unless comment.visible? %>"><%= link_to comment.diary_entry.title, diary_entry_path(comment.diary_entry.user, comment.diary_entry) %></td> - <td width="25%" class="<%= "text-muted" unless comment.visible? %>"> + <td width="25%" class="<%= "text-body-secondary" unless comment.visible? %>"><%= link_to comment.diary_entry.title, diary_entry_path(comment.diary_entry.user, comment.diary_entry) %></td> + <td width="25%" class="<%= "text-body-secondary" unless comment.visible? %>"> <%= friendly_date_ago(comment.created_at) %> </td> - <td width="50%" class="richtext text-break<%= " text-muted" unless comment.visible? %>"><%= comment.body.to_html %></td> + <td width="50%" class="richtext text-break<%= " text-body-secondary" unless comment.visible? %>"><%= comment.body.to_html %></td> </tr> <% end -%> </table> <%= render "shared/pagination", - :newer_key => "diary_entries.comments.newer_comments", - :older_key => "diary_entries.comments.older_comments", + :newer_key => "diary_comments.index.newer_comments", + :older_key => "diary_comments.index.older_comments", :newer_id => @newer_comments_id, :older_id => @older_comments_id %> <% end -%> diff --git a/app/views/diary_entries/_diary_comment.html.erb b/app/views/diary_entries/_diary_comment.html.erb index 5ade361aa..dbf8a439e 100644 --- a/app/views/diary_entries/_diary_comment.html.erb +++ b/app/views/diary_entries/_diary_comment.html.erb @@ -1,16 +1,16 @@ -<div class="row diary-comment border-bottom py-3<%= " text-muted bg-danger bg-opacity-10" unless diary_comment.visible? %>"> +<div class="row diary-comment border-bottom py-3<%= " text-body-secondary bg-danger bg-opacity-10" unless diary_comment.visible? %>"> <div class="col-auto pe-0 text-center"> <%= user_thumbnail diary_comment.user %> </div> <div class="col"> - <p class="text-muted m-0" id="comment<%= diary_comment.id %>"><%= t(".comment_from_html", :link_user => (link_to diary_comment.user.display_name, diary_comment.user), :comment_created_at => link_to(l(diary_comment.created_at, :format => :friendly), :anchor => "comment#{diary_comment.id}")) %> + <p class="text-body-secondary m-0" id="comment<%= diary_comment.id %>"><%= t(".comment_from_html", :link_user => (link_to diary_comment.user.display_name, diary_comment.user), :comment_created_at => link_to(l(diary_comment.created_at, :format => :friendly), :anchor => "comment#{diary_comment.id}")) %> <% if current_user and diary_comment.user.id != current_user.id %> | <%= report_link(t(".report"), diary_comment) %> <% end %> </p> <div class="richtext text-break"><%= diary_comment.body.to_html %></div> - <% if can? :hidecomment, DiaryEntry %> + <% if can? :hide, DiaryComment %> <span> <% if diary_comment.visible? %> <%= link_to t(".hide_link"), hide_diary_comment_path(diary_comment.diary_entry.user, diary_comment.diary_entry, diary_comment), :method => :post, :data => { :confirm => t(".confirm") } %> diff --git a/app/views/diary_entries/_diary_entry.html.erb b/app/views/diary_entries/_diary_entry.html.erb index 9c7d7b2dc..d4ee530d7 100644 --- a/app/views/diary_entries/_diary_entry.html.erb +++ b/app/views/diary_entries/_diary_entry.html.erb @@ -1,4 +1,4 @@ -<article class='diary_post border-top border-secondary-subtle py-3<%= " text-muted px-3 bg-danger bg-opacity-10" unless diary_entry.visible %> user_<%= diary_entry.user.id %>'> +<article class='diary_post border-top border-secondary-subtle py-3<%= " text-body-secondary px-3 bg-danger bg-opacity-10" unless diary_entry.visible %> user_<%= diary_entry.user.id %>'> <%= render :partial => "diary_entry_heading", :object => diary_entry, :as => "diary_entry" %> <div class="richtext text-break" xml:lang="<%= diary_entry.language_code %>" lang="<%= diary_entry.language_code %>"> diff --git a/app/views/diary_entries/_diary_entry_heading.html.erb b/app/views/diary_entries/_diary_entry_heading.html.erb index 30f7bc03b..b6dca2ee4 100644 --- a/app/views/diary_entries/_diary_entry_heading.html.erb +++ b/app/views/diary_entries/_diary_entry_heading.html.erb @@ -12,7 +12,7 @@ </div> <% end %> - <small class='text-muted'> + <small class='text-body-secondary'> <%= t("diary_entries.diary_entry.posted_by_html", :link_user => (link_to diary_entry.user.display_name, diary_entry.user), :created => l(diary_entry.created_at, :format => :blog), :language_link => (link_to diary_entry.language.name, :controller => "diary_entries", :action => "index", :display_name => nil, :language => diary_entry.language_code)) %> <% if (l(diary_entry.updated_at, :format => :blog) != l(diary_entry.created_at, :format => :blog)) %> <%= t("diary_entries.diary_entry.updated_at_html", :updated => l(diary_entry.updated_at, :format => :blog)) %> diff --git a/app/views/diary_entries/index.html.erb b/app/views/diary_entries/index.html.erb index a0ab0264a..15be9e964 100644 --- a/app/views/diary_entries/index.html.erb +++ b/app/views/diary_entries/index.html.erb @@ -25,7 +25,14 @@ <% end %> <% if @user && @user == current_user || !@user && current_user %> - <li><%= link_to image_tag("new.png") + t(".new"), new_diary_entry_path, :class => "icon-link", :title => t(".new_title") %></li> + <li> + <%= link_to new_diary_entry_path, :class => "icon-link", :title => t(".new_title") do %> + <svg width="16" height="16"> + <path d="M2 0 a2 2 0 0 0 -2 2 v12 a2 2 0 0 0 2 2 h12 a2 2 0 0 0 2 -2 v-12 a2 2 0 0 0 -2 -2 z M4 7 h3 v-3 h2 v3 h3 v2 h-3 v3 h-2 v-3 h-3 z" fill="currentColor" /> + </svg> + <%= t(".new") %> + <% end %> + </li> <% end %> </ul> </nav> diff --git a/app/views/diary_entries/show.html.erb b/app/views/diary_entries/show.html.erb index 6c0895380..1830c9ced 100644 --- a/app/views/diary_entries/show.html.erb +++ b/app/views/diary_entries/show.html.erb @@ -19,9 +19,9 @@ <% if current_user %> <div class="col-auto"> <% if @entry.subscribers.exists?(current_user.id) %> - <%= link_to t("javascripts.changesets.show.unsubscribe"), diary_entry_unsubscribe_path(@entry.user, @entry), :method => :post, :class => "btn btn-sm btn-primary" %> + <%= link_to t(".unsubscribe"), diary_entry_unsubscribe_path(@entry.user, @entry), :method => :post, :class => "btn btn-sm btn-primary" %> <% else %> - <%= link_to t("javascripts.changesets.show.subscribe"), diary_entry_subscribe_path(@entry.user, @entry.id), :method => :post, :class => "btn btn-sm btn-primary" %> + <%= link_to t(".subscribe"), diary_entry_subscribe_path(@entry.user, @entry.id), :method => :post, :class => "btn btn-sm btn-primary" %> <% end %> </div> <% end %> diff --git a/app/views/geocoder/search.html.erb b/app/views/geocoder/search.html.erb index 86048b0ad..f87a4909d 100644 --- a/app/views/geocoder/search.html.erb +++ b/app/views/geocoder/search.html.erb @@ -4,10 +4,9 @@ <% @sources.each do |source| %> <h4> - <%= t(".title.results_from_html", :results_link => link_to(t(".title.#{source}"), - t(".title.#{source}_url"))) %> + <%= t(".title.results_from_html", :results_link => link_to(t(".title.#{source[:name]}"), source[:url].to_s)) %> </h4> - <div class="search_results_entry mx-n3" data-href="<%= url_for @params.merge(:action => "search_#{source}") %>"> + <div class="search_results_entry mx-n3" data-href="<%= url_for @params.merge(:action => "search_#{source[:name]}") %>"> <div class="text-center loader"> <div class="spinner-border" role="status"> <span class="visually-hidden"><%= t("browse.start_rjs.loading") %></span> diff --git a/app/views/issues/_comments.html.erb b/app/views/issues/_comments.html.erb index 9200b4cec..f828e5a43 100644 --- a/app/views/issues/_comments.html.erb +++ b/app/views/issues/_comments.html.erb @@ -5,7 +5,7 @@ <%= link_to user_thumbnail(comment.user), comment.user %> </div> <div class="col"> - <p class="text-muted"> + <p class="text-body-secondary"> <%= t ".comment_from_html", :user_link => link_to(comment.user.display_name, comment.user), :comment_created_at => tag.time(l(comment.created_at.to_datetime, :format => :friendly), :datetime => comment.created_at.xmlschema) %> diff --git a/app/views/issues/_reports.html.erb b/app/views/issues/_reports.html.erb index 2d1b78800..2d0f1650b 100644 --- a/app/views/issues/_reports.html.erb +++ b/app/views/issues/_reports.html.erb @@ -4,7 +4,7 @@ <%= link_to user_thumbnail(report.user), report.user %> </div> <div class="col"> - <p class="text-muted"> + <p class="text-body-secondary"> <%= t ".reported_by_html", :category => report.category, :user => link_to(report.user.display_name, report.user), :updated_at => tag.time(l(report.updated_at.to_datetime, :format => :friendly), diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index ad463c259..a58b8c5cb 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,7 +1,7 @@ <% content_for :heading do %> <h1><%= t ".title", :status => @issue.status.humanize, :issue_id => @issue.id %></h1> <p><%= @issue.reportable.model_name.human %> : <%= link_to reportable_title(@issue.reportable), reportable_url(@issue.reportable) %></p> -<p class="text-muted"> +<p class="text-body-secondary"> <small> <%= @issue.assigned_role %> <% if @issue.reports.count > 0 %> @@ -45,7 +45,7 @@ <h3><%= t ".reports_of_this_issue" %></h3> <% if @read_reports.present? %> - <div class="bg-body-tertiary text-muted"> + <div class="bg-body-tertiary text-body-secondary"> <h4><%= t ".read_reports" %></h4> <%= render "reports", :reports => @read_reports %> </div> diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index 724ca5526..3c691612a 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -12,6 +12,6 @@ <%= yield :head %> <%= yield :auto_discovery_link_tag %> <%= csrf_meta_tag %> - <meta name="csp-nonce" content="<%= content_security_policy_style_nonce %>" /> + <%= csp_meta_tag %> <title><%= "#{@title} | " if @title %><%= t "layouts.project_name.title" %> <% end %> diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 8942eb49c..cb48d834e 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,7 +1,7 @@

    -

    - - <%= image_tag "osm_logo.png", :srcset => image_path("osm_logo.svg"), :alt => t("layouts.logo.alt_text"), :width => 30, :height => 30, :class => "logo" %> +

    + + <%= image_tag "osm_logo.svg", :alt => t("layouts.logo.alt_text"), :size => 30 %> <%= t "layouts.project_name.h1" %>

    @@ -31,8 +31,8 @@ <%= link_to t("layouts.export"), export_path, :class => "btn btn-outline-primary geolink", :id => "export_tab" %>

    -
-

+

<% if trace.tags.empty? %> <%= t ".details_without_tags_html", :time_ago => friendly_date_ago(trace.timestamp), :user => link_to(trace.user.display_name, trace.user) %> @@ -40,7 +40,7 @@ :tags => safe_join(trace.tags.collect { |tag| link_to_tag tag.tag }, ", ") %> <% end %>

-

+

<%= trace.description %>

diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index a2a068360..b87244b9f 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -7,13 +7,13 @@ <% content_for :heading do %> <% if @client_app_name %> -

<%= t(".signup_to_authorize_html", :client_app_name => @client_app_name) %>

+

<%= t(".signup_to_authorize_html", :client_app_name => @client_app_name) %>

<% end %>
-