- 'lib/osm.rb'
- 'script/deliver-message'
-# Offense count: 7
-# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
-Lint/DuplicateBranch:
- Exclude:
- - 'app/controllers/api_controller.rb'
- - 'app/controllers/diary_entries_controller.rb'
- - 'app/controllers/geocoder_controller.rb'
- - 'app/helpers/browse_tags_helper.rb'
-
# Offense count: 665
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Minitest/MultipleAssertions:
Max: 52
-# Offense count: 3
+# Offense count: 1
Naming/AccessorMethodName:
Exclude:
- - 'app/controllers/application_controller.rb'
- 'app/helpers/title_helper.rb'
- - 'lib/osm.rb'
# Offense count: 8
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
# MethodDefinitionMacros: define_method, define_singleton_method
Naming/PredicateName:
Exclude:
- - 'app/models/changeset.rb'
- - 'app/models/old_node.rb'
- - 'app/models/old_relation.rb'
- - 'app/models/old_way.rb'
- 'app/models/user.rb'
- - 'lib/classic_pagination/pagination.rb'
# Offense count: 5
# Configuration parameters: Database, Include.
## OAuth Consumer Keys
-Three of the built-in applications communicate via the API, and therefore need OAuth consumer keys configured. These are:
+There are two built-in applications which communicate via the API, and therefore need OAuth consumer keys configured. These are:
* iD
* The website itself (for the Notes functionality)
-For example, to use the iD editor you need to register it as an OAuth application.
+To use the iD editor you need to register it as an OAuth 1 application.
Do the following:
* Log into your Rails Port instance - e.g. http://localhost:3000
* Click on your user name to go to your user page
* Click on "my settings" on the user page
-* Click on "oauth settings" on the My settings page
+* Click on "OAuth 1 settings" on the My settings page
* Click on 'Register your application'.
-* Unless you have set up alternatives, use Name: "Local iD" and URL: "http://localhost:3000"
-* Check the 'modify the map' box.
+* Unless you have set up alternatives, use Name: "Local iD" and Main Application URL: "http://localhost:3000"
+* Check boxes for the following Permissions
+ * 'read their user preferences'
+ * 'modify the map'
+ * 'read their private GPS traces'
+ * 'modify notes'
* Everything else can be left with the default blank values.
* Click the "Register" button
* On the next page, copy the "consumer key"
```
# Default editor
default_editor: "id"
-# OAuth consumer key for iD
+# OAuth 1 consumer key for iD
id_key: "8lFmZPsagHV4l3rkAHq0hWY5vV3Ctl3oEFY1aXth"
```
-Follow the same process for registering and configuring the website/Notes (`oauth_key`), or to save time, simply reuse the same consumer key for each.
+To allow [Notes](https://wiki.openstreetmap.org/wiki/Notes) and changeset discussions to work, follow a similar process, this time registering an OAuth 2 application for the web site:
+
+* Go to "[OAuth 2 applications](http://localhost:3000/oauth2/applications)" on the My settings page.
+* Click on "Register new application".
+* Use Name: "OpenStreetMap Web Site" and Redirect URIs: "http://localhost:3000"
+* Check boxes for the following Permissions
+ * 'Modify the map'
+ * 'Modify notes'
+* On the next page, copy the "Client Secret" and "Client ID"
+* Edit config/settings.local.yml in your rails tree
+* Add the "oauth_application" configuration with the "Client ID" as the value
+* Add the "oauth_key" configuration with the "Client Secret" as the value
+* Restart your rails server
+
+An example excerpt from settings.local.yml:
+
+```
+# OAuth 2 Client ID for the web site
+oauth_application: "SGm8QJ6tmoPXEaUPIZzLUmm1iujltYZVWCp9hvGsqXg"
+# OAuth 2 Client Secret for the web site
+oauth_key: "eRHPm4GtEnw9ovB1Iw7EcCLGtUb66bXbAAspv3aJxlI"
+```
## Troubleshooting
source "https://rubygems.org"
# Require rails
-gem "rails", "7.0.2.2"
+gem "rails", "7.0.2.3"
# Require json for multi_json
gem "json"
specs:
aasm (5.2.0)
concurrent-ruby (~> 1.0)
- actioncable (7.0.2.2)
- actionpack (= 7.0.2.2)
- activesupport (= 7.0.2.2)
+ actioncable (7.0.2.3)
+ actionpack (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
- actionmailbox (7.0.2.2)
- actionpack (= 7.0.2.2)
- activejob (= 7.0.2.2)
- activerecord (= 7.0.2.2)
- activestorage (= 7.0.2.2)
- activesupport (= 7.0.2.2)
+ actionmailbox (7.0.2.3)
+ actionpack (= 7.0.2.3)
+ activejob (= 7.0.2.3)
+ activerecord (= 7.0.2.3)
+ activestorage (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
- actionmailer (7.0.2.2)
- actionpack (= 7.0.2.2)
- actionview (= 7.0.2.2)
- activejob (= 7.0.2.2)
- activesupport (= 7.0.2.2)
+ actionmailer (7.0.2.3)
+ actionpack (= 7.0.2.3)
+ actionview (= 7.0.2.3)
+ activejob (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
- actionpack (7.0.2.2)
- actionview (= 7.0.2.2)
- activesupport (= 7.0.2.2)
+ actionpack (7.0.2.3)
+ actionview (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionpack-page_caching (1.2.4)
actionpack (>= 4.0.0)
- actiontext (7.0.2.2)
- actionpack (= 7.0.2.2)
- activerecord (= 7.0.2.2)
- activestorage (= 7.0.2.2)
- activesupport (= 7.0.2.2)
+ actiontext (7.0.2.3)
+ actionpack (= 7.0.2.3)
+ activerecord (= 7.0.2.3)
+ activestorage (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
- actionview (7.0.2.2)
- activesupport (= 7.0.2.2)
+ actionview (7.0.2.3)
+ activesupport (= 7.0.2.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_record_union (1.3.0)
activerecord (>= 4.0)
- activejob (7.0.2.2)
- activesupport (= 7.0.2.2)
+ activejob (7.0.2.3)
+ activesupport (= 7.0.2.3)
globalid (>= 0.3.6)
- activemodel (7.0.2.2)
- activesupport (= 7.0.2.2)
- activerecord (7.0.2.2)
- activemodel (= 7.0.2.2)
- activesupport (= 7.0.2.2)
+ activemodel (7.0.2.3)
+ activesupport (= 7.0.2.3)
+ activerecord (7.0.2.3)
+ activemodel (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
activerecord-import (1.3.0)
activerecord (>= 4.2)
- activestorage (7.0.2.2)
- actionpack (= 7.0.2.2)
- activejob (= 7.0.2.2)
- activerecord (= 7.0.2.2)
- activesupport (= 7.0.2.2)
+ activestorage (7.0.2.3)
+ actionpack (= 7.0.2.3)
+ activejob (= 7.0.2.3)
+ activerecord (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
- activesupport (7.0.2.2)
+ activesupport (7.0.2.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
autoprefixer-rails (10.4.2.0)
execjs (~> 2)
aws-eventstream (1.2.0)
- aws-partitions (1.560.0)
- aws-sdk-core (3.127.0)
+ aws-partitions (1.564.0)
+ aws-sdk-core (3.129.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1)
smart_properties
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
- bootsnap (1.10.3)
+ bootsnap (1.11.1)
msgpack (~> 1.2)
bootstrap (4.5.3)
autoprefixer-rails (>= 9.1.0)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
- jmespath (1.6.0)
+ jmespath (1.6.1)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rack-uri_sanitizer (0.0.2)
- rails (7.0.2.2)
- actioncable (= 7.0.2.2)
- actionmailbox (= 7.0.2.2)
- actionmailer (= 7.0.2.2)
- actionpack (= 7.0.2.2)
- actiontext (= 7.0.2.2)
- actionview (= 7.0.2.2)
- activejob (= 7.0.2.2)
- activemodel (= 7.0.2.2)
- activerecord (= 7.0.2.2)
- activestorage (= 7.0.2.2)
- activesupport (= 7.0.2.2)
+ rails (7.0.2.3)
+ actioncable (= 7.0.2.3)
+ actionmailbox (= 7.0.2.3)
+ actionmailer (= 7.0.2.3)
+ actionpack (= 7.0.2.3)
+ actiontext (= 7.0.2.3)
+ actionview (= 7.0.2.3)
+ activejob (= 7.0.2.3)
+ activemodel (= 7.0.2.3)
+ activerecord (= 7.0.2.3)
+ activestorage (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
bundler (>= 1.15.0)
- railties (= 7.0.2.2)
+ railties (= 7.0.2.3)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
- rails-i18n (7.0.2)
+ rails-i18n (7.0.3)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
- railties (7.0.2.2)
- actionpack (= 7.0.2.2)
- activesupport (= 7.0.2.2)
+ railties (7.0.2.3)
+ actionpack (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
method_source
rake (>= 12.2)
thor (~> 1.0)
parser (>= 3.1.1.0)
rubocop-minitest (0.17.2)
rubocop (>= 0.90, < 2.0)
- rubocop-performance (1.13.2)
+ rubocop-performance (1.13.3)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.13.2)
simplecov-lcov (0.8.0)
simplecov_json_formatter (0.1.4)
smart_properties (1.17.0)
- sprockets (4.0.2)
+ sprockets (4.0.3)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.4.2)
r2 (~> 0.2.7)
rack-cors
rack-uri_sanitizer
- rails (= 7.0.2.2)
+ rails (= 7.0.2.3)
rails-controller-testing
rails-i18n (~> 7.0.0)
rinku (>= 2.0.6)
# Find the changeset and check it is valid
changeset = Changeset.find(id)
- raise OSM::APIChangesetNotYetClosedError, changeset if changeset.is_open?
+ raise OSM::APIChangesetNotYetClosedError, changeset if changeset.open?
# Add a comment to the changeset
comment = changeset.comments.create(:changeset => changeset,
before_action :check_api_readable
before_action :setup_user_auth
+ before_action :set_request_formats
around_action :api_call_handle_error, :api_call_timeout
# External apps that use the api are able to query which permissions
else
[]
end
+
+ respond_to do |format|
+ format.xml
+ format.json
+ end
end
end
end
# as XML for backwards compatibility - all other formats are discarded
# which will result in a 406 Not Acceptable response being sent
formats = mimetypes.map do |mime|
- if mime.symbol == :xml then :xml
+ if mime.symbol == :xml || mime == "*/*" then :xml
elsif mime.symbol == :json then :json
- elsif mime == "*/*" then :xml
end
end
else
elsif Authenticator.new(self, [:token]).allow?
# self.current_user setup by OAuth
else
- username, passwd = get_auth_data # parse from headers
+ username, passwd = auth_data # parse from headers
# authenticate per-scheme
self.current_user = if username.nil?
nil # no authentication provided - perhaps first connect (client should retry after 401)
response.headers["Error"] = message
if request.headers["X-Error-Format"]&.casecmp("xml")&.zero?
- result = OSM::API.new.get_xml_doc
+ result = OSM::API.new.xml_doc
result.root.name = "osmError"
result.root << (XML::Node.new("status") << "#{Rack::Utils.status_code(status)} #{Rack::Utils::HTTP_STATUS_CODES[status]}")
result.root << (XML::Node.new("message") << message)
end
# extract authorisation credentials from headers, returns user = nil if none
- def get_auth_data
+ def auth_data
if request.env.key? "X-HTTP_AUTHORIZATION" # where mod_rewrite might have put it
authdata = request.env["X-HTTP_AUTHORIZATION"].to_s.split
elsif request.env.key? "REDIRECT_X_HTTP_AUTHORIZATION" # mod_fcgi
@title = t "diary_entries.edit.title"
@diary_entry = DiaryEntry.find(params[:id])
- if current_user != @diary_entry.user
- redirect_to diary_entry_path(@diary_entry.user, @diary_entry)
- elsif params[:diary_entry] && @diary_entry.update(entry_params)
+ if current_user != @diary_entry.user ||
+ (params[:diary_entry] && @diary_entry.update(entry_params))
redirect_to diary_entry_path(@diary_entry.user, @diary_entry)
else
set_map_location
friendship = Friendship.new
friendship.befriender = current_user
friendship.befriendee = @new_friend
- if current_user.is_friends_with?(@new_friend)
+ if current_user.friends_with?(@new_friend)
flash[:warning] = t "friendships.make_friend.already_a_friend", :name => @new_friend.display_name
elsif current_user.friendships.where("created_at >= ?", Time.now.utc - 1.hour).count >= current_user.max_friends_per_hour
flash.now[:error] = t "friendships.make_friend.limit_exceeded"
if @friend
if request.post?
- if current_user.is_friends_with?(@friend)
+ if current_user.friends_with?(@friend)
Friendship.where(:befriender => current_user, :befriendee => @friend).delete_all
flash[:notice] = t "friendships.remove_friend.success", :name => @friend.display_name
else
@sources.push "geonames_reverse" if Settings.key?(:geonames_username)
elsif @params[:query]
case @params[:query]
- when /^\d{5}(-\d{4})?$/
- @sources.push "osm_nominatim"
- when /^(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])\s*[0-9][ABD-HJLNP-UW-Z]{2})$/i
+ when /^\d{5}(-\d{4})?$/,
+ /^(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])\s*[0-9][ABD-HJLNP-UW-Z]{2})$/i
@sources.push "osm_nominatim"
when /^[A-Z]\d[A-Z]\s*\d[A-Z]\d$/i
@sources.push "ca_postcode"
if query = params[:query]
query.strip!
- if latlon = query.match(/^([NS])\s*(\d{1,3}(\.\d*)?)\W*([EW])\s*(\d{1,3}(\.\d*)?)$/).try(:captures) # [NSEW] decimal degrees
- params.merge!(nsew_to_decdeg(latlon)).delete(:query)
- elsif latlon = query.match(/^(\d{1,3}(\.\d*)?)\s*([NS])\W*(\d{1,3}(\.\d*)?)\s*([EW])$/).try(:captures) # decimal degrees [NSEW]
+ if latlon = query.match(/^([NS])\s*(\d{1,3}(\.\d*)?)\W*([EW])\s*(\d{1,3}(\.\d*)?)$/).try(:captures) || # [NSEW] decimal degrees
+ query.match(/^(\d{1,3}(\.\d*)?)\s*([NS])\W*(\d{1,3}(\.\d*)?)\s*([EW])$/).try(:captures) # decimal degrees [NSEW]
params.merge!(nsew_to_decdeg(latlon)).delete(:query)
- elsif latlon = query.match(/^([NS])\s*(\d{1,3})°?(?:\s*(\d{1,3}(\.\d*)?)?['′]?)?\W*([EW])\s*(\d{1,3})°?(?:\s*(\d{1,3}(\.\d*)?)?['′]?)?$/).try(:captures) # [NSEW] degrees, decimal minutes
- params.merge!(ddm_to_decdeg(latlon)).delete(:query)
- elsif latlon = query.match(/^(\d{1,3})°?(?:\s*(\d{1,3}(\.\d*)?)?['′]?)?\s*([NS])\W*(\d{1,3})°?(?:\s*(\d{1,3}(\.\d*)?)?['′]?)?\s*([EW])$/).try(:captures) # degrees, decimal minutes [NSEW]
+ elsif latlon = query.match(/^([NS])\s*(\d{1,3})°?(?:\s*(\d{1,3}(\.\d*)?)?['′]?)?\W*([EW])\s*(\d{1,3})°?(?:\s*(\d{1,3}(\.\d*)?)?['′]?)?$/).try(:captures) || # [NSEW] degrees, decimal minutes
+ query.match(/^(\d{1,3})°?(?:\s*(\d{1,3}(\.\d*)?)?['′]?)?\s*([NS])\W*(\d{1,3})°?(?:\s*(\d{1,3}(\.\d*)?)?['′]?)?\s*([EW])$/).try(:captures) # degrees, decimal minutes [NSEW]
params.merge!(ddm_to_decdeg(latlon)).delete(:query)
- elsif latlon = query.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,2})['′]?(?:\s*(\d{1,3}(\.\d*)?)?["″]?)?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,2})['′]?(?:\s*(\d{1,3}(\.\d*)?)?["″]?)?$/).try(:captures) # [NSEW] degrees, minutes, decimal seconds
- params.merge!(dms_to_decdeg(latlon)).delete(:query)
- elsif latlon = 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]
+ elsif latlon = query.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,2})['′]?(?:\s*(\d{1,3}(\.\d*)?)?["″]?)?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,2})['′]?(?:\s*(\d{1,3}(\.\d*)?)?["″]?)?$/).try(:captures) || # [NSEW] degrees, minutes, decimal seconds
+ 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*)?)$/)
# the correct page.
lookup_us = lookup.tr(" ", "_")
- if page = WIKI_PAGES.dig(locale, type, lookup_us)
- url = "https://wiki.openstreetmap.org/wiki/#{page}?uselang=#{locale}"
- elsif page = WIKI_PAGES.dig("en", type, lookup_us)
- url = "https://wiki.openstreetmap.org/wiki/#{page}?uselang=#{locale}"
- end
+ page = WIKI_PAGES.dig(locale, type, lookup_us) ||
+ WIKI_PAGES.dig("en", type, lookup_us)
+
+ url = "https://wiki.openstreetmap.org/wiki/#{page}?uselang=#{locale}" if page
url
end
# Use a method like this, so that we can easily change how we
# determine whether a changeset is open, without breaking code in at
# least 6 controllers
- def is_open?
+ def open?
# a changeset is open (that is, it will accept further changes) when
# it has not yet run out of time and its capacity is small enough.
# note that this may not be a hard limit - due to timing changes and
end
def set_closed_time_now
- self.closed_at = Time.now.utc if is_open?
+ self.closed_at = Time.now.utc if open?
end
def self.from_xml(xml, create: false)
@bbox ||= BoundingBox.new(min_lon, min_lat, max_lon, max_lat)
end
- def has_valid_bbox?
+ def bbox_valid?
bbox.complete?
end
# that would make it more than 24h long, in which case clip to
# 24h, as this has been decided is a reasonable time limit.
def update_closed_at
- if is_open?
+ if open?
self.closed_at = if (closed_at - created_at) > (MAX_TIME_OPEN - IDLE_TIMEOUT)
created_at + MAX_TIME_OPEN
else
raise OSM::APIUserChangesetMismatchError unless user.id == user_id
# can't change a closed changeset
- raise OSM::APIChangesetAlreadyClosedError, self unless is_open?
+ raise OSM::APIChangesetAlreadyClosedError, self unless open?
# copy the other's tags
self.tags = other.tags
raise OSM::APIChangesetMissingError
elsif new.changeset.user_id != user.id
raise OSM::APIUserChangesetMismatchError
- elsif !new.changeset.is_open?
+ elsif !new.changeset.open?
raise OSM::APIChangesetAlreadyClosedError, new.changeset
end
end
raise OSM::APIChangesetMissingError
elsif new.changeset.user_id != user.id
raise OSM::APIUserChangesetMismatchError
- elsif !new.changeset.is_open?
+ elsif !new.changeset.open?
raise OSM::APIChangesetAlreadyClosedError, new.changeset
end
end
raise OSM::APIChangesetMissingError
elsif user.id != changeset.user_id
raise OSM::APIUserChangesetMismatchError
- elsif !changeset.is_open?
+ elsif !changeset.open?
raise OSM::APIChangesetAlreadyClosedError, changeset
end
end
def redact!(redaction)
# check that this version isn't the current version
- raise OSM::APICannotRedactError if is_latest_version?
+ raise OSM::APICannotRedactError if latest_version?
# make the change
self.redaction = redaction
# check whether this element is the latest version - that is,
# has the same version as its "current" counterpart.
- def is_latest_version?
+ def latest_version?
current_node.version == version
end
end
# check whether this element is the latest version - that is,
# has the same version as its "current" counterpart.
- def is_latest_version?
+ def latest_version?
current_relation.version == version
end
end
# check whether this element is the latest version - that is,
# has the same version as its "current" counterpart.
- def is_latest_version?
+ def latest_version?
current_way.version == version
end
end
validates :timestamp, :presence => true
validates :visibility, :inclusion => %w[private public trackable identifiable]
- after_destroy :remove_files
after_save :set_filename
def tagstring
end
def large_picture
- if image.attached?
- data = image.blob.download
- else
- f = File.new(large_picture_name, "rb")
- data = f.sysread(File.size(f.path))
- f.close
- end
-
- data
+ image.blob.download
end
def icon_picture
- if icon.attached?
- data = icon.blob.download
- else
- f = File.new(icon_picture_name, "rb")
- data = f.sysread(File.size(f.path))
- f.close
- end
-
- data
- end
-
- def large_picture_name
- "#{Settings.gpx_image_dir}/#{id}.gif"
- end
-
- def icon_picture_name
- "#{Settings.gpx_image_dir}/#{id}_icon.gif"
- end
-
- def trace_name
- "#{Settings.gpx_trace_dir}/#{id}.gpx"
+ icon.blob.download
end
def mime_type
- if file.attached?
- file.content_type
- else
- content_type(trace_name)
- end
+ file.content_type
end
def extension_name
end
def xml_file
- with_trace_file do |trace_name|
- filetype = Open3.capture2("/usr/bin/file", "-Lbz", trace_name).first.chomp
+ file.open do |tracefile|
+ filetype = Open3.capture2("/usr/bin/file", "-Lbz", tracefile.path).first.chomp
gzipped = filetype.include?("gzip compressed")
bzipped = filetype.include?("bzip2 compressed")
zipped = filetype.include?("Zip archive")
file = Tempfile.new("trace.#{id}")
if tarred && gzipped
- system("tar", "-zxOf", trace_name, :out => file.path)
+ system("tar", "-zxOf", tracefile.path, :out => file.path)
elsif tarred && bzipped
- system("tar", "-jxOf", trace_name, :out => file.path)
+ system("tar", "-jxOf", tracefile.path, :out => file.path)
elsif tarred
- system("tar", "-xOf", trace_name, :out => file.path)
+ system("tar", "-xOf", tracefile.path, :out => file.path)
elsif gzipped
- system("gunzip", "-c", trace_name, :out => file.path)
+ system("gunzip", "-c", tracefile.path, :out => file.path)
elsif bzipped
- system("bunzip2", "-c", trace_name, :out => file.path)
+ system("bunzip2", "-c", tracefile.path, :out => file.path)
elsif zipped
- system("unzip", "-p", trace_name, "-x", "__MACOSX/*", :out => file.path, :err => "/dev/null")
+ system("unzip", "-p", tracefile.path, "-x", "__MACOSX/*", :out => file.path, :err => "/dev/null")
end
file.unlink
else
- file = File.open(trace_name)
+ file = File.open(tracefile.path)
end
file
def import
logger.info("GPX Import importing #{name} (#{id}) from #{user.email}")
- with_trace_file do |trace_name|
- gpx = GPX::File.new(trace_name)
+ file.open do |file|
+ gpx = GPX::File.new(file.path)
f_lat = 0
f_lon = 0
end
end
- def migrate_to_storage!
- file.attach(:io => File.open(trace_name),
- :filename => name,
- :content_type => content_type(trace_name),
- :identify => false)
-
- if inserted
- image.attach(:io => File.open(large_picture_name),
- :filename => "#{id}.gif",
- :content_type => "image/gif")
- icon.attach(:io => File.open(icon_picture_name),
- :filename => "#{id}_icon.gif",
- :content_type => "image/gif")
- end
-
- save!
-
- remove_files
- end
-
private
def content_type(file)
end
end
- def with_trace_file
- if file.attached?
- file.open do |file|
- yield file.path
- end
- else
- yield trace_name
- end
- end
-
def set_filename
file.blob.update(:filename => "#{id}#{extension_name}") if file.attached?
end
-
- def remove_files
- FileUtils.rm_f(trace_name)
- FileUtils.rm_f(icon_picture_name)
- FileUtils.rm_f(large_picture_name)
- end
end
OSM::GreatCircle.new(home_lat, home_lon).distance(nearby_user.home_lat, nearby_user.home_lon)
end
- def is_friends_with?(new_friend)
+ def friends_with?(new_friend)
friendships.exists?(:befriendee => new_friend)
end
attrs = {
"id" => changeset.id,
"created_at" => changeset.created_at.xmlschema,
- "open" => changeset.is_open?,
+ "open" => changeset.open?,
"comments_count" => changeset.comments.length,
"changes_count" => changeset.num_changes
}
-attrs["closed_at"] = changeset.closed_at.xmlschema unless changeset.is_open?
+attrs["closed_at"] = changeset.closed_at.xmlschema unless changeset.open?
changeset.bbox.to_unscaled.add_bounds_to(attrs, "_") if changeset.bbox.complete?
# user attributes
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.permissions @permissions
<% end %>
<% if current_user %>
- <% unless @changeset.is_open? %>
+ <% unless @changeset.open? %>
<form action="#" class="mb-3">
<div class="form-group">
<textarea class="form-control" name="text" cols="40" rows="5"></textarea>
<% changeset_data = { :id => changeset.id }
- if changeset.has_valid_bbox?
+ if changeset.bbox_valid?
bbox = changeset.bbox.to_unscaled
changeset_data[:bbox] = {
:minlon => bbox.min_lon,
end
end
- if changeset.has_valid_bbox?
+ if changeset.bbox_valid?
bbox = changeset.bbox.to_unscaled
# See http://georss.org/Encodings#Geometry
<ul class='clearfix text-muted'>
<li><%= link_to t("users.show.send message"), new_message_path(contact) %></li>
<li>
- <% if current_user.is_friends_with?(contact) %>
+ <% if current_user.friends_with?(contact) %>
<%= link_to t("users.show.remove as friend"), remove_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
<% else %>
<%= link_to t("users.show.add as friend"), make_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
<% if @applications.length > 0 %>
<table class="table table-borderless table-striped">
<thead>
- <th><%= t ".name" %></th>
- <th><%= t ".permissions" %></th>
- <th></th>
- <th></th>
+ <tr>
+ <th><%= t ".name" %></th>
+ <th><%= t ".permissions" %></th>
+ <th></th>
+ <th></th>
+ </tr>
</thead>
<tbody>
<%= render :partial => "application", :collection => @applications %>
<div>
<%= link_to t(".edit"), edit_oauth_application_path(@application), :class => "btn btn-outline-primary" %>
<%= link_to t(".delete"), oauth_application_path(@application), { :method => :delete, :class => "btn btn-outline-danger", :data => { :confirm => t(".confirm_delete") } } %>
-</td>
+</div>
<% if @applications.length > 0 %>
<table class="table table-borderless table-striped">
<thead>
- <th><%= t ".application" %></th>
- <th><%= t ".permissions" %></th>
- <th></th>
+ <tr>
+ <th><%= t ".application" %></th>
+ <th><%= t ".permissions" %></th>
+ <th></th>
+ </tr>
</thead>
<tbody>
<%= render :partial => "application", :collection => @applications %>
<p><%= t(".no_apps_html", :oauth => link_to(t(".oauth"), "https://oauth.net")) %></p>
<% else %>
<p><%= t ".registered_apps" %></p>
-<% @client_applications.each do |client| %>
- <div class="client_application">
- <%= link_to client.name, :action => :show, :id => client.id %>
- </div>
-<% end %>
+<ul>
+ <% @client_applications.each do |client| %>
+ <li class="client_application">
+ <%= link_to client.name, :action => :show, :id => client.id %>
+ </li>
+ <% end %>
+</ul>
<% end %>
-<h3><%= link_to t(".register_new"), :action => :new %></h3>
+<%= link_to t(".register_new"), { :action => :new }, :class => "btn btn-outline-primary" %>
<%= javascript_include_tag "edit/id" %>
<div id="map">
- <% data = { :key => Settings.id_key } -%>
- <% data[:lat] = @lat if @lat -%>
- <% data[:lon] = @lon if @lon -%>
- <% data[:gpx] = trace_data_url(params[:gpx], :format => :xml) if params[:gpx] -%>
- <% data[:url] = id_url(:locale => params[:locale]) -%>
+ <% data = { :key => Settings.id_key }
+ data[:lat] = @lat if @lat
+ data[:lon] = @lon if @lon
+ data[:gpx] = trace_data_url(params[:gpx], :format => :xml) if params[:gpx]
+ data[:url] = id_url(:locale => params[:locale]) %>
<%= tag.iframe "", :frameBorder => 0, :id => "id-embed", :class => "id-embed", :allowfullscreen => "", :data => data %>
</div>
<a href='<%= t ".#{site}.url" %>'>
<%= t ".#{site}.title" %>
</a>
- </h3>
+ </h6>
<p class='card-text'><%= t ".#{site}.description" %></p>
</div>
<div class="card-footer">
<!-- <![endif]-->
</head>
<body>
-<% data = {} -%>
-<% if Settings.key?(:id_key) %>
-<% token = current_user.access_token(Settings.id_key) %>
-<% data[:token] = token.token -%>
-<% data[:token_secret] = token.secret -%>
-<% data[:consumer_key] = token.client_application.key -%>
-<% data[:consumer_secret] = token.client_application.secret -%>
-<% end %>
-<% data[:locale] = ID::LOCALES.preferred(preferred_languages).to_s -%>
-<% data[:asset_map] = assets("iD").to_json -%>
+<% data = {}
+ if Settings.key?(:id_key)
+ token = current_user.access_token(Settings.id_key)
+ data[:token] = token.token
+ data[:token_secret] = token.secret
+ data[:consumer_key] = token.client_application.key
+ data[:consumer_secret] = token.client_application.secret
+ end
+ data[:locale] = ID::LOCALES.preferred(preferred_languages).to_s
+ data[:asset_map] = assets("iD").to_json %>
<%= tag.div "", :id => "id-container", :data => data %>
</body>
</html>
<% content_for :heading do %>
<h1><%= t(".heading_html", :name => link_to(@user.display_name, user_path(@user))) %></h1>
<% end %>
+
<% unless @user_blocks.empty? %>
<%= render :partial => "blocks", :locals => { :show_revoke_link => can?(:revoke, UserBlock), :show_user_name => false, :show_creator_name => true } %>
<% else %>
<%= message_body do %>
<p><%= t ".see_their_profile_html", :userurl => link_to(@viewurl, @viewurl) %></p>
- <% unless @friendship.befriendee.is_friends_with?(@friendship.befriender) -%>
+ <% unless @friendship.befriendee.friends_with?(@friendship.befriender) -%>
<p><%= t ".befriend_them_html", :befriendurl => link_to(@friendurl, @friendurl) %></p>
<% end -%>
<% end %>
<%= t '.see_their_profile', :userurl => @viewurl %>
-<% unless @friendship.befriendee.is_friends_with?(@friendship.befriender) -%>
+<% unless @friendship.befriendee.friends_with?(@friendship.befriender) -%>
<%= t '.befriend_them', :befriendurl => @friendurl %>
<% end -%>
<%= link_to t(".comments"), diary_comments_path(@user) %>
</li>
<li>
- <% if current_user and current_user.is_friends_with?(@user) %>
+ <% if current_user and current_user.friends_with?(@user) %>
<%= link_to t(".remove as friend"), remove_friend_path(:display_name => @user.display_name), :method => :post %>
<% elsif current_user %>
<%= link_to t(".add as friend"), make_friend_path(:display_name => @user.display_name), :method => :post %>
# Author: Dr. Mohammed
# Author: Fahad
# Author: Faris knight
+# Author: FiberAhmed
# Author: Grille chompa
# Author: HitomiAkane
# Author: Houcinee1
entry:
comment: التعليق
full: ملاحظة كاملة
+ account:
+ deletions:
+ show:
+ delete_account: حذف الحساب
+ confirm_delete: هل أنت متأكد؟
+ cancel: إلغاء
accounts:
edit:
title: عدل الحساب
success_confirm_needed: تم تحديث معلومات المستخدم بنجاح، تحقق من بريدك الإلكتروني
لملاحظة تأكيد العنوان الإلكتروني الجديد.
success: تم تحديث معلومات المستخدم بنجاح.
+ destroy:
+ success: تم حذف الحساب.
browse:
created: تم الإنشاء
closed: تم الإغلاق
entry:
comment: Komentář
full: Celá poznámka
+ account:
+ deletions:
+ show:
+ title: Smazat můj účet
+ warning: Pozor! Proces smazání účtu je konečný a nelze jej vrátit zpět.
+ delete_account: Smazat účet
+ delete_introduction: 'Svůj účet v OpenStreetMap můžete smazat pomocí níže
+ uvedeného tlačítka. Vezměte prosím na vědomí následující údaje:'
+ delete_profile: Vaše profilové informace včetně avatara, popisu a domovské
+ polohy budou odstraněny.
+ delete_display_name: Vaše zobrazované jméno bude odstraněno a může být znovu
+ použito jinými účty.
+ retain_caveats: 'Některé informace o vás však zůstanou v OpenStreetMap zachovány
+ i po smazání vašeho účtu:'
+ retain_edits: Vaše případné úpravy v databázi map budou zachovány.
+ retain_traces: Vaše případné nahrané stopy budou zachovány.
+ retain_diary_entries: Vaše případné záznamy a komentáře v deníku zůstanou
+ zachovány, ale nebudou viditelné.
+ retain_notes: Vaše poznámky k mapě a případné komentáře k poznámkám zůstanou
+ zachovány, ale nebudou viditelné.
+ retain_changeset_discussions: Vaše případné diskuse o sadě změn budou zachovány.
+ retain_email: Vaše e-mailová adresa bude zachována.
+ confirm_delete: Jste si jistý?
+ cancel: Zrušit
accounts:
edit:
title: Upravit účet
link text: co to znamená?
save changes button: Uložit změny
make edits public button: Zvěřejnit všechny moje úpravy
+ delete_account: Mazání účtu...
update:
success_confirm_needed: Uživatelské údaje byly úspěšně aktualizovány. Zkontrolujte
si e-mail, měla by vám přijít výzva k potvrzení nové e-mailové adresy.
success: Uživatelské údaje byly úspěšně aktualizovány.
+ destroy:
+ success: Účet smazán.
browse:
created: Vytvořeno
closed: Uzavřeno
trailhead: Začátek stezky
trunk: Významná silnice
trunk_link: Významná silnice
+ turning_circle: Místo na otočení
turning_loop: Otočná smyčka
unclassified: Silnice
"yes": Cesta
"yes": Místo
railway:
abandoned: Zrušená železniční trať
+ buffer_stop: Nárazníková zastávka
construction: Železnice ve výstavbě
disused: Nepoužívaná železniční trať
funicular: Lanová dráha
platform: Železniční nástupiště
preserved: Historická železnice
proposed: Navrhovaná železnice
+ rail: Železnice
spur: Železniční vlečka
station: Železniční stanice
stop: Železniční zastávka
switch: Výhybka
tram: Tramvajová trať
tram_stop: Tramvajová zastávka
+ turntable: Točna
yard: Přednádraží
shop:
agrarian: Obchod se zemědělskými stroji
activate_user: Aktivovat tohoto uživatele
deactivate_user: Deaktivovat tohoto uživatele
confirm_user: Potvrdit tohoto uživatele
+ unconfirm_user: Nepotvrdit tohoto uživatele
+ unsuspend_user: Zrušit pozastavení tohoto uživatele
hide_user: Skrýt tohoto uživatele
unhide_user: Zobrazit tohoto uživatele
delete_user: Odstranit tohoto uživatele
durchzulesen sowie zu akzeptieren.
agreed_with_pd: Du hast zudem erklärt, dass du deine Beiträge gemeinfrei veröffentlichst
(unter Public Domain stellst).
- link: https://www.osmfoundation.org/wiki/License/Contributor_Terms
+ link: https://wiki.osmfoundation.org/w/index.php?title=Licence/Contributor_Terms&uselang=de
link text: Worum handelt es sich?
save changes button: Änderungen speichern
make edits public button: Alle meine Bearbeitungen öffentlich machen
infringement_2_html: |-
Sofern du denkst, dass urheberrechtlich geschütztes Material unerlaubterweise zur
OpenStreetMap-Datenbank oder auf dieser Website hinzugefügt wurde, informiere dich
- bitte über unser <a href="https://www.osmfoundation.org/wiki/License/Takedown_procedure">Verfahren
+ bitte über unser <a href="https://wiki.osmfoundation.org/wiki/Takedown_procedure">Verfahren
zum Entfernen von Inhalten</a> oder melde dies direkt mit unserem
<a href="https://dmca.openstreetmap.org/">Onlineformular</a>.
trademarks_title_html: <span id="trademarks"></span>Markenzeichen
consider_pd: Zusätzlich zu den oben genannten Bedingungen betrachte ich meine
Beiträge als gemeinfrei (Public Domain)
consider_pd_why: Was bedeutet dies?
- consider_pd_why_url: https://www.osmfoundation.org/wiki/License/Why_would_I_want_my_contributions_to_be_public_domain
+ consider_pd_why_url: https://wiki.osmfoundation.org/wiki/Licence_and_Legal_FAQ/Why_would_I_want_my_contributions_to_be_public_domain?uselang=de
guidance_html: 'Informationen, die dabei helfen, diese Bedingungen zu verstehen:
eine <a href="%{summary}">verständliche Zusammenfassung</a> sowie einige <a
href="%{translations}">inoffizielle Übersetzungen</a>'
et accepter les nouvelles Conditions de contribution.
agreed_with_pd: Vous avez également déclaré que vous considériez vos modifications
comme relevant du domaine public.
- link: https://www.osmfoundation.org/wiki/License/Contributor_Terms
+ link: https://wiki.osmfoundation.org/wiki/Licence/Contributor_Terms
link text: qu’est-ce que ceci ?
save changes button: Enregistrer les modifications
make edits public button: Rendre toutes mes modifications publiques
droits.
infringement_2_html: Si vous pensez que des données ont été ajoutées à la
base de données OpenStreetMap ou à ce site en violation des droits d’auteur,
- veuillez vous référer à notre <a href="https://www.osmfoundation.org/wiki/License/Takedown_procedure">procédure
+ veuillez vous référer à notre <a href="https://wiki.osmfoundation.org/wiki/License/Takedown_procedure">procédure
de retrait de données</a> ou notifiez-nous directement à travers notre <a
href="https://dmca.openstreetmap.org/">formulaire en ligne</a>.
trademarks_title_html: <span id="marques"></span>Marques
consider_pd: En plus de l’accord ci-dessus, je considère mes contributions comme
étant dans le domaine public.
consider_pd_why: qu’est-ce que ceci ?
- consider_pd_why_url: https://www.osmfoundation.org/wiki/License/Why_would_I_want_my_contributions_to_be_public_domain
+ consider_pd_why_url: https://wiki.osmfoundation.org/wiki/Licence_and_Legal_FAQ/Why_would_I_want_my_contributions_to_be_public_domain
guidance_html: 'Pour plus d’information sur ces conditions : un <a href="%{summary}">résumé
lisible</a> et quelques <a href="%{translations}">traductions informelles</a>'
continue: Continuer
fy:
time:
formats:
- friendly: '%e %B %Y om %H.%M'
+ friendly: '%e %B %Y om %H.%M oere'
blog: '%e %B %Y'
helpers:
file:
Bydragersbetingsten te besjen en te akseptearjen.
agreed_with_pd: Jo hawwe ek oanjûn dat jo jo bewurkings as part fan it Publyk
Domein beskôgje.
- link: https://www.osmfoundation.org/wiki/License/Contributor_Terms
+ link: https://wiki.osmfoundation.org/wiki/Licence/Contributor_Terms
link text: wat is dat?
save changes button: Feroarings bewarje
make edits public button: Al myn bewurkings iepenbier meitsje
report: Dizze notysje melde
query:
title: Skaaimerken opfreegje
- introduction: Klik op 'e kaart foar skaaimerken fuortby
+ introduction: Klik op 'e kaart foar skaaimerken fuortby.
nearby: Skaaimerken yn 'e omkriten
enclosing: Omfetsjende skaaimerken
changesets:
copyright:
foreign:
title: Oer dizze oersetting
+ html: Yn it gefal dizze oersette side en %{english_original_link} fan inoar
+ ôfwike, is de Ingelske side beskiedend
+ english_link: it Ingelsktalich orizjineel
native:
+ title: Oer dizze side
+ html: Jo besjogge de Ingelske ferzje fan 'e auteursrjochteside. Jo kinne weromgean
+ nei de %{native_link} fan dizze side, of ophâlde te lêzen oer auteursrjochten
+ en %{mapping_link}.
native_link: Frysktalige ferzje
+ mapping_link: mei kaartmeitsjen úteinsette
legal_babble:
title_html: Auteursrjochten en lisinsje
+ intro_1_html: |-
+ OpenStreetMap<sup><a href="#trademarks">®</a></sup> is <i>iepen data</i>, en troch de <a
+ href="https://osmfoundation.org/">OpenStreetMap-stifting</a> (OSMF) beskikber steld ûnder de <a
+ href="https://opendatacommons.org/licenses/odbl/">Iepen
+ Databank-lisinsje</a> (ODbL) fan Open Data Commons.
+ intro_2_html: |-
+ It stiet jo frij ús data te kopiearjen, te fersprieden, út te stjoeren en oan te passen,
+ salang't jo OpenStreetMap en syn
+ bydragers mar neame. At jo ús data feroarje of ferwurkje, meie jo
+ it resultaat inkeld ûnder deselde lisinsje ferspriede. De
+ folsleine <a href="https://opendatacommons.org/licenses/odbl/1.0/">juridyske
+ tekst</a> jout in útlis oer jo rjochten en plichten.
+ intro_3_1_html: |-
+ Us dokumintaasje is beskikber ûnder de lisinsje
+ <a href="https://creativecommons.org/licenses/by-sa/2.0/">Creative
+ Commons Nammefermelding-Lyk diele 2.0</a> (CC BY-SA 2.0).
+ credit_title_html: Hoe moat OpenStreetMap neamd wurde
+ credit_1_html: Wy fereaskje dat jo de fermelding “© OpenStreetMap-bydragers”
+ brûke.
+ credit_2_1_html: |-
+ Jo moatte ek dúdlik meitsje dat de data beskikber is ûnder de Iepen
+ Databank-lisinsje. Jo kinne dat dwaan mei in keppeling nei
+ <a href="https://www.openstreetmap.org/copyright">dizze auteursrjochteside</a>.
+ As alternatyf, en as eask at jo OSM yn
+ datafoarm ferspriede, kinne jo de lisinsje(s) streekrjocht neame en keppelje. Yn media
+ dêr't keppelings net mooglik binne (bgl. printwurk) suggerearje wy dat jo
+ jo lêzers trochferwize nei openstreetmap.org (faaks troch
+ 'OpenStreetMap' út te skriuwen as dat adres) en nei opendatacommons.org.
+ credit_3_1_html: |-
+ De kaartstikken yn 'e “standertfoarmjouwing” op www.openstreetmap.org binne in
+ troch de OpenStreetMap-stifting fuortbrocht wurk, mei gebrûk fan OpenStreetMap-data
+ ûnder de Iepen Databank-lisinsje. At jo dy kaartfoarmjouwing brûke, is deselde taskriuwing
+ fereaske as foar de kaartdata.
+ credit_4_html: 'Foar in trochklikbere digitale kaart, moat de nammefermelding
+ yn ''e hoeke fan ''e kaart stean. Bygelyks:'
+ attribution_example:
+ alt: Foarbyld fan hoe't OpenStreetMap op in webside neamd wurdt
+ title: Foarbyld nammefermelding
+ more_title_html: Mear te witten komme
+ more_1_html: |-
+ Lês mear oer it brûken fan ús data, en hoe't wy fermeld wurde moatte, op 'e <a
+ href="https://osmfoundation.org/Licence">Lisinsjeside fan 'e OSMF</a>.
+ more_2_html: |-
+ Hoewol't OpenStreetMap iepen data is, kinne wy net
+ fergees in kaart-API foar tredden leverje.
+ Sjoch ús <a href="https://operations.osmfoundation.org/policies/api/">API-gebrûksbelied</a>,
+ <a href="https://operations.osmfoundation.org/policies/tiles/">Gebrûksbelied foar Kaartstikken</a>
+ en <a href="https://operations.osmfoundation.org/policies/nominatim/">Gebrûksbelied fan Nominatim</a>.
+ contributors_title_html: Us bydragers
+ contributors_intro_html: |-
+ Us bydragers binne tûzenen yndividuën. Wy nimme ek
+ data mei iepen lisinsjes op fan nasjonale kaartagintskippen
+ en oare boarnen, dêrûnder:
+ contributors_at_html: |-
+ <strong>Eastenryk</strong>: Befettet data fan
+ <a href="https://data.wien.gv.at/">Stadt Wien</a> (ûnder
+ <a href="https://creativecommons.org/licenses/by/3.0/at/deed.de">CC BY</a>),
+ <a href="https://www.vorarlberg.at/vorarlberg/bauen_wohnen/bauen/vermessung_geoinformation/weitereinformationen/services/wmsdienste.htm">Land Vorarlberg</a> en
+ Land Tirol (ûnder <a href="https://www.tirol.gv.at/applikationen/e-government/data/nutzungsbedingungen/">CC BY AT mei amendeminten</a>).
+ contributors_au_html: |-
+ <strong>Austraalje</strong>: Omfettet of ûntwikkele mei Administrative Boundaries ©
+ <a href="https://geoscape.com.au/legal/data-copyright-and-disclaimer/">Geoscape Austraalje</a>
+ troch it Mienebêst fan Austraalje beskikber steld ûnder de lisinsje
+ <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Nammefermelding 4.0 Ynternasjonaal (CC BY 4.0)</a>.
+ contributors_ca_html: |-
+ <strong>Kanada</strong>: Befettet data fan
+ GeoBase®, GeoGratis (© Departemint fan Natuerlike
+ Helpboarnen Kanada), CanVec (© Departemint fan Natuerlike
+ Helpboarnen Kanada), en StatCan (Geografy-difyzje,
+ Statistiken Kanada).
+ contributors_fi_html: |-
+ <strong>Finlân</strong>: Befettet data út 'e
+ Topografyske Databank en oare datasets fan 'e
+ Nasjonale Lânmjitting fan Finlân, ûnder de
+ <a href="https://www.maanmittauslaitos.fi/en/opendata-licence-version1">NLSFI-lisinsje</a>.
+ contributors_fr_html: |-
+ <strong>Frankryk</strong>: Befettet data mei as boarne
+ Direction Générale des Impôts.
+ contributors_nl_html: |-
+ <strong>Nederlân</strong>: Befettet © AND data, 2007
+ (<a href="https://www.and.com">www.and.com</a>)
+ contributors_nz_html: |-
+ <strong>Nij-Seelân</strong>: Befettet data mei as boarne de
+ <a href="https://data.linz.govt.nz/">LINZ Data Service</a> en
+ werbrûkber ûnder de lisinsje
+ <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
+ contributors_si_html: |-
+ <strong>Sloveenje</strong>: Befettet data fan 'e
+ <a href="http://www.gu.gov.si/en/">Lânmjittings- en Kartearringsautoriteit</a> en it
+ <a href="http://www.mkgp.gov.si/en/">Ministearje fan Lânbou, Boskbou en Fiedsel</a>
+ (iepenbiere ynformaasje fan Sloveenje).
+ contributors_es_html: |-
+ <strong>Spanje</strong>: Befettet data mei as boarne it
+ Spaansk Nasjonaal Geografysk Ynstitút (<a href="http://www.ign.es/">IGN</a>) en it
+ Nasjonaal Kartografysk Systeem (<a href="http://www.scne.es/">SCNE</a>)
+ werbrûkber ûnder de lisinsje <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
+ contributors_za_html: |-
+ <strong>Súd-Afrika</strong>: Befettet data mei as boarne
+ <a href="http://www.ngi.gov.za/">Chief Directorate:
+ National Geo-Spatial Information</a>, Steatsauteursrjochten foarbeholden.
+ contributors_gb_html: |-
+ <strong>Feriene Keninkryk</strong>: Befettet data fan Ordnance
+ Survey © Auteurs- en databankrjochten fan 'e Kroan
+ 2010-19.
+ contributors_footer_1_html: |-
+ Besjoch de <a
+ href="https://wiki.openstreetmap.org/wiki/Contributors">Bydragers-side</a>
+ op 'e OpenStreetMap-wiki foar fierdere ynformaasje oer dizze, en oare boarnen dy't brûkt binne
+ om OpenStreetMap foarút te helpen.
+ contributors_footer_2_html: |-
+ It opnimmen fan data yn OpenStreetMap betsjut net dat de oanbieder fan 'e oarspronklike
+ data efter OpenStreetMap stiet, ien of oare garânsje jout, of
+ oanspraaklikens oanfurdiget.
+ infringement_title_html: Skeining fan auteursrjochten
+ infringement_1_html: |-
+ OSM-bydragers wurde derop wiisd nea data ta te heakjen fan
+ boarnen mei auteursrjochten (bgl. Google Maps as printe kaarten) sûnder
+ de útdruklike tastimming fan 'e auteursrjochthawwers.
+ infringement_2_html: |-
+ At jo miene dat der materiaal mei auteursrjochten ûnrjochtlik
+ oan 'e OpenStreetMap-databank of dit webstee taheakke is, rieplachtsje dêrfoar
+ ús <a href="https://wiki.osmfoundation.org/wiki/Takedown_procedure">wiskproseduere</a>,
+ of tsjinje it drekst yn op ús
+ <a href="https://dmca.openstreetmap.org/">side mei in webformulier</a>.
+ trademarks_title_html: <span id="trademarks"></span>Hannelsmerken
+ trademarks_1_html: OpenStreetMap, it fergrutglês-logo en 'State of the Map'
+ binne registrearre hannelsmerken fan 'e OpenStreetMap-stifting. At jo fragen
+ hawwe oer jo gebrûk fan 'e merken, besjoch dan ús <a href="https://wiki.osmfoundation.org/wiki/Trademark_Policy">Hannelsmerkebelied</a>.
index:
js_1: Jo brûke ôf in webblêder dy't gjin JavaScript stipet, ôf jo hawwe JavaScript
útskeakele.
title: Jo applikaasje bewurkje
show:
title: OAuth-gegevens foar %{app_name}
+ key: 'Konsumint-kaai:'
+ secret: 'Konsumint-geheim:'
+ url: 'Fersykkaai-URL:'
+ access_url: 'Tagongskaai-URL:'
+ authorize_url: 'Autorisaasje-URL:'
support_notice: Wy stypje ûndertekeningen mei HMAC-SHA1 (oanret) en RSA-SHA1.
edit: Gegevens bewurkje
delete: Kliïnt wiskje
register_new: Jo applikaasje registrearje
form:
requests: 'Freegje de neikommende rjochten fan ''e meidogger:'
+ not_found:
+ sorry: Spitich, mar %{type} koe net fûn wurde.
create:
flash: Registrearjen fan 'e ynformaasje slagge
update:
consider_pd: Njonken it boppesteande, beskôgje ik myn bydragen as part fan it
Publyk Domein
consider_pd_why: wat is dat?
- consider_pd_why_url: https://www.osmfoundation.org/wiki/License/Why_would_I_want_my_contributions_to_be_public_domain
+ consider_pd_why_url: https://wiki.osmfoundation.org/wiki/Licence_and_Legal_FAQ/Why_would_I_want_my_contributions_to_be_public_domain
guidance_html: 'Ynformaasje om dy betingsten better te begripen: in <a href="%{summary}">lêsbere
gearfetting</a> en in pear <a href="%{translations}">ynformele oersettings</a>'
continue: Fierder
title: Deler mi conto
warning: Attention! Le deletion de un conto es definitive e irreversibile.
delete_account: Deler conto
+ delete_introduction: 'Tu pote deler tu conto OpenStreetMap con le button sequente.
+ Nota ben que:'
accounts:
edit:
title: Modificar conto
user_diaries_tooltip: Sjá blogg notenda
edit_with: Breyta með %{editor}
tag_line: Frjálsa wiki heimskortið
- intro_header: Velkomin í OpenStreetMap!
+ intro_header: Velkomin(n) í OpenStreetMap!
intro_text: OpenStreetMap er heimskort gert af fólki eins og þér. Það er gefið
út með opnu hugbúnaðarleyfi og það kostar ekkert að nota það.
intro_2_create_account: Búa til notandaaðgang
preferred_languages: Ákjósanleg tungumál
edit_preferences: Kjörstillingar
edit:
+ title: Valmöguleikar
save: Uppfæra kjörstillingar
cancel: Hætta við
update:
tímabundið. Skráðu þig inn í vefviðmótið til að skoða skilmála vegna framlags
(Contributor Terms). Þú þarft ekki endilega að samþykkja þá, en þú verður
að skoða þá.
+ settings_menu:
+ account_settings: Kjörstillingar
oauth:
authorize:
title: Auðkenndu aðgang að notandaaðganginum þínum
flash: Þú afturkallaðir aðgangsteiknið fyrir %{application}
permissions:
missing: Þú hefur ekki gefið forritinu heimild fyrir aðgang að þessum eiginleikum
+ scopes:
+ write_api: Breyta kortagögnunum.
+ read_gpx: Lesa einka-GPS-ferlana þína.
+ write_gpx: Senda inn GPS feril.
+ write_notes: Breyta minnispunktum.
oauth_clients:
new:
title: Skrá nýtt forrit
show:
edit: Breyta
delete: Eyða
+ client_secret: Notendu Leyndarmál
+ client_secret_warning: Vertu viss um að vista þessa leyndarmál - það verður
+ ekki nothæft aftur
+ permissions: Réttindi
+ redirect_uris: Tilvísa tengslar
+ not_found:
+ sorry: Því miður, forritið fannst ekki.
+ oauth2_authorizations:
+ new:
+ title: Réttindi Nauðsynleg
+ introduction: Veita %{application} aðgang að aðgangnum þínum með eftirfarandi
+ réttindi?
+ authorize: Leyfa
+ deny: Hafna
+ error:
+ title: Villa kom upp
+ show:
+ title: Auðkennisnúmer
+ oauth2_authorized_applications:
+ index:
+ title: Auðkenndu forritin mín
+ application: Forrit
+ permissions: Réttindi
users:
new:
title: Nýskrá
no_auto_account_create: Því miður getum við eki búið til reikning fyrir þig
sjálfkrafa.
contact_support_html: Hafðu samband við <a href="%{support}">vefstjóra</a> til
- að fá reikning búinn til.
+ að fá aðgang búinn til.
about:
header: Frjálst og breytanlegt
html: |-
italy: Ítalía
rest_of_world: Restin af heiminum
terms_declined_flash:
+ terms_declined_link: þessari wiki síðu
terms_declined_url: https://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined
no_such_user:
title: Notandi ekki til
my profile: Notandasniðið mitt
my settings: Stillingarnar mínar
my comments: Athugasemdir mínar
+ my_preferences: Valmöguleikar
+ my_dashboard: Stjórnborðið Mitt
blocks on me: Bönn gegn mér
blocks by me: Bönn eftir mig
+ edit_profile: Breyta Notandasíðu
send message: Senda skilaboð
diary: Blogg
edits: Breytingar
activate_user: Virkja þennan notanda
deactivate_user: Gera þennan notanda óvirkan
confirm_user: Staðfesta þennan notanda
+ unconfirm_user: Óstaðfesta þennan notanda
+ unsuspend_user: Óbanna þessum Notanda
hide_user: Fela þennan notanda
unhide_user: Af-fela þennan notanda
delete_user: Eyða þessum notanda
suspended:
title: Aðgangur frystur
heading: Aðgangur frystur
+ support: Aðstoð
body_html: "<p>\nÞví miður, notandaaðgangurinn þinn hefur verið frystur vegna
- grunsamlegrar \nvirkni.\n</p>\n<p>\nHafðu samband við <a href=\"%{webmaster}\">vefstjóra</a>
+ grunsamlegrar \nvirkni.\n</p>\n<p>\nÞessi ákvörðun verður endurskoðuð af stjórnanda
+ stuttu eftir, þú mátt hafa samband við <a href=\"%{webmaster}\">vefstjóra</a>
ef þú \nvilt ræða þetta mál.\n</p>"
auth_failure:
connection_failed: Tenging við auðkenningarþjónustu mistókst
no_authorization_code: Enginn auðkenningarkóði
unknown_signature_algorithm: Óþekkt reiknirit undirritunar
invalid_scope: Ógilt notkunarsvið
+ unknown_error: Auðkenning mistókst
auth_association:
heading: Auðkennið þitt er ekki ennþá tengt neinum OpenStreetMap-aðgangi.
option_1: |-
custom_dimensions: Setja sérsniðnar stærðir
format: 'Snið:'
scale: 'Kvarði:'
+ image_dimensions: Myndin mun sýna venjulegt lag á %{width} x %{height}
download: Sækja
short_url: Stutt URL-slóð
include_marker: Hafa með kortamerkið
copyright: © <a href='%{copyright_url}'>Þátttakendur í OpenStreetMap verkefninu</a>
donate_link_text: <a class='donate-attr' href='%{donate_url}'>Styrkja verkefnið</a>
terms: <a href='%{terms_url}' target='_blank'>Skilmálar vefsvæðis og API-kerfisviðmóts</a>
+ cyclosm: Stíll kortatígla frá <a href='%{cyclosm_url}' target='_blank'>CyclOSM</a>
+ haldið af <a href='%{osmfrance_url}' target='_blank'>OpenStreetMap France</a>
thunderforest: Kortatíglar frá <a href='%{thunderforest_url}' target='_blank'>Andy
Allan</a>
opnvkarte: Kortatíglar frá <a href='%{memomaps_url}' target='_blank'>MeMoMaps</a>
accettare le nuove regole per contribuire.
agreed_with_pd: Hai anche dichiarato di considerare le tue modifiche come
fossero di pubblico dominio.
- link: https://www.osmfoundation.org/wiki/License/Contributor_Terms
+ link: https://wiki.osmfoundation.org/wiki/Licence/Contributor_Terms
link text: che cos'è questo?
save changes button: Salva modifiche
make edits public button: Rendi pubbliche tutte le mie modifiche
stampate) senza esplicita autorizzazione dei titolari del copyright.
infringement_2_html: |-
Se ritieni che materiale protetto da copyright sia stato impropriamente aggiunto al database di OpenStreetMap o a questo sito, consulta la nostra
- <a href="https://www.osmfoundation.org/wiki/License/Takedown_procedure">procedura di rimozione per violazione del copyright</a> o segnalacelo direttamente alla nostra
+ <a href="https://wiki.osmfoundation.org/wiki/Takedown_procedure">procedura di rimozione per violazione del copyright</a> o segnalacelo direttamente alla nostra
<a href="https://dmca.openstreetmap.org/">pagina di segnalazione on-line</a>.
trademarks_title_html: <span id="trademarks"></span>Marchi registrati
trademarks_1_html: '"OpenStreetMap", il logo con la lente d''ingrandimento
consider_pd: In aggiunta a quanto sopra, considero i miei contributi come fossero
di pubblico dominio
consider_pd_why: cos'è questo?
- consider_pd_why_url: https://www.osmfoundation.org/wiki/License/Why_would_I_want_my_contributions_to_be_public_domain
+ consider_pd_why_url: https://wiki.osmfoundation.org/wiki/Licence_and_Legal_FAQ/Why_would_I_want_my_contributions_to_be_public_domain
guidance_html: 'Informazioni utili a capire questi termini: un <a href="%{summary}">riassunto
leggibile</a> ed alcune <a href="%{translations}">traduzioni informali</a>'
continue: Continua
entry:
comment: Kommentar
full: Hela anteckningen
+ account:
+ deletions:
+ show:
+ title: Radera mitt konto
+ warning: Varning! Kontots raderingsprocess är slutgiltig och kan inte återställas.
+ delete_account: Radera konto
+ delete_introduction: 'Du kan radera ditt OpenStreetMap-konto med knappen nedan.
+ Notera följande detaljer:'
+ delete_profile: Din profilinformation, inklusive din avatar, beskrivning och
+ hemposition kommer tas bort.
+ delete_display_name: Ditt visade namn kommer tas bort och kan återanvändas
+ av andra konton.
+ retain_caveats: 'Viss information om dig kommer bevaras på OpenStreetMap,
+ även efter att ditt konto raderats:'
+ retain_edits: Dina redigeringar på kartdatabasen, om du gjort några, kommer
+ bevaras.
+ retain_traces: Dina uppladdade spår, om du gjort några, kommer bevaras.
+ retain_diary_entries: Dina dagboksinlägg och dagbokskommentarer, om du gjort
+ några, kommer bevaras men hållas gömda.
+ retain_notes: Dina kartanteckningar och notkommentarer, om du gjort några,
+ kommer bevaras men hållas gömda.
+ retain_changeset_discussions: Dina diskussioner på ändringsuppsätningar, om
+ du gjort några, kommer bevaras.
+ retain_email: Din e-postadress kommer bevaras.
+ confirm_delete: Är du säker?
+ cancel: Avbryt
accounts:
edit:
title: Redigera konto
link: https://www.osmfoundation.org/wiki/License/Contributor_Terms
link text: vad är detta?
save changes button: Spara ändringar
- make edits public button: Gör alla mina redigeringar publika
+ make edits public button: Gör alla mina redigeringar offentliga
+ delete_account: Radera konto...
update:
success_confirm_needed: Användarinformation uppdaterades. Kontrollera din e-post
för att bekräfta din e-postadress.
success: Användarinformation uppdaterades.
+ destroy:
+ success: Kontot har raderats.
browse:
created: Skapad
closed: Stängd
friend: Vän
show:
title: Min kontrollpanel
- no_home_location_html: '%{edit_profile_link} och sätt din hemplats för att se
- närliggande användare.'
+ no_home_location_html: '%{edit_profile_link} och sätt din hemposition för att
+ se närliggande användare.'
edit_your_profile: Redigera din profil
my friends: Mina vänner
no friends: Du har inte lagt till några vänner ännu.
trailhead: Vandringsstartpunkt
trunk: Stamväg
trunk_link: På-/avfart till stamväg/motortrafikled
+ turning_circle: Vändplats
turning_loop: Vändslinga
unclassified: Oklassificerad väg
"yes": Väg
platform: Tågperrong
preserved: Bevarad järnväg
proposed: Föreslagen järnväg
+ rail: Räls
spur: Sidospår
station: Tågstation
stop: Järnvägshållplats
switch: Järnvägsväxel
tram: Spårväg
tram_stop: Spårvagnshållplats
+ turntable: Vändskiva
yard: Bangård
shop:
agrarian: Jordbruksbutik
är intresserad av'
your_note: '%{commenter} har kommenterat en av dina kartanteckningar i närheten
av %{place}.'
- your_note_html: '%{commenter} har löst en av dina kartanteckningar i närheten
+ your_note_html: '%{commenter} har löst en av dina kartanteckning i närheten
av %{place}.'
commented_note: '%{commenter} har löst en kartanteckning du har kommenterat.
Anteckningen är nära %{place}.'
%{place}.'
your_note_html: '%{commenter} har återaktiverat en av dina kartanteckningar
nära %{place}.'
- commented_note: '%{commenter} har återaktiverat en kartnotering du har kommenterat
- på. Noteringen är nära %{place}.'
- commented_note_html: '%{commenter} har återaktiverat en kartnotering du har
- kommenterat på. Noteringen är nära %{place}.'
+ commented_note: '%{commenter} har återaktiverat en kartanteckning du har kommenterat
+ på. Anteckningen är nära %{place}.'
+ commented_note_html: '%{commenter} har återaktiverat en kartanteckning du
+ har kommenterat på. Anteckningen är nära %{place}.'
details: Fler detaljer om anteckningen finns på %{url}.
details_html: Fler detaljer om anteckningen finns på %{url}.
changeset_comment_notification:
entry:
comment: Yorum
full: Notun tamamı
+ account:
+ deletions:
+ show:
+ title: Hesabımı Sil
+ warning: Uyarı! Hesap silme işlemi kesindir ve geri alınamaz.
+ delete_account: Hesabı Sil
+ delete_introduction: 'Aşağıdaki butonu kullanarak OpenStreetMap hesabınızı
+ silebilirsiniz. Lütfen, aşağıdaki ayrıntılara dikkat edin:'
+ delete_profile: Avatarınız, açıklamanız ve ana konumunuz dahil olmak üzere
+ profil bilgileriniz silinecektir.
+ delete_display_name: Görünen adınız silinecek ve başka hesaplar tarafından
+ yeniden kullanılabilir hâle gelecektir.
+ retain_caveats: 'Ancak hesabınız silindikten sonra bile sizinle ilgili bazı
+ bilgiler OpenStreetMap''te tutulacaktır:'
+ retain_edits: Varsa harita veritabanında yaptığınız düzenlemeler saklanacaktır.
+ retain_traces: Şayet iz yüklediyseniz bunlar silinmeyecektir.
+ retain_diary_entries: Günlük girdileriniz ve varsa günlük yorumlarınız kaldırılmayacak
+ ancak gizlenecektir.
+ retain_notes: Harita notlarınız ve varsa not yorumlarınız korunacak ancak
+ gizlenecektir.
+ retain_changeset_discussions: Varsa, değişiklik seti tartışmalarınız korunacaktır.
+ retain_email: E-posta adresiniz saklanacaktır.
+ confirm_delete: Emin misiniz?
+ cancel: İptal
accounts:
edit:
title: Hesabı düzenle
link text: bu nedir?
save changes button: Değişiklikleri Kaydet
make edits public button: Bütün girdiklerim herkese açık olsun
+ delete_account: Hesabı Sil...
update:
success_confirm_needed: Kullanıcı bilgisi başarıyla güncellendi. Yeni e-posta
adresinizi onaylamak için e-mail'inizi lütfen kontrol ediniz.
success: Kullanıcı bilgisi başarıyla güncellendi.
+ destroy:
+ success: Hesap Silindi.
browse:
created: Oluşturuldu
closed: Kapandı
not yet agreed: 您还没有同意新的贡献者条款。
review link text: 请跟随此链接,方便您查看并接受新的贡献者条款。
agreed_with_pd: 您也将您的编辑释于公有领域。
- link: https://www.osmfoundation.org/wiki/License/Contributor_Terms
+ link: https://wiki.osmfoundation.org/wiki/Licence/Contributor_Terms
link text: 这是什么?
save changes button: 保存更改
make edits public button: 公开我所有的编辑
contributors_footer_2_html: OpenStreetMap 纳入数据并不意味着原始数据提供者认可 OpenStreetMap、提供任何担保或担负任何法律责任。
infringement_title_html: 著作权侵犯
infringement_1_html: OSM 的贡献者会被提醒,绝不要在没有著作权人的明确许可时添加来自任何有著作权的来源的数据(如谷歌地图或印刷地图)。
- infringement_2_html: 如果您认为版权的材料已被不恰当地添加的 OpenStreetMap 数据库或该网站,请参见我们的<a href="https://www.osmfoundation.org/wiki/License/Takedown_procedure">撤除程序</a>,或直接在我们的<a
+ infringement_2_html: 如果您认为版权的材料已被不恰当地添加的 OpenStreetMap 数据库或该网站,请参见我们的<a href="https://wiki.osmfoundation.org/wiki/Takedown_procedure">撤除程序</a>,或直接在我们的<a
href="https://dmca.openstreetmap.org/">在线申报页面</a>上提出。
trademarks_title_html: <span id="trademarks"></span>商标
trademarks_1_html: OpenStreetMap、放大镜标志和地图状态是OpenStreetMap基金会的注册商标。如果您对使用这些标志有任何问题,请参见我们的<a
read_tou: 我已阅读并同意使用条款
consider_pd: 除了上述协议,我同意将我的贡献释于公有领域
consider_pd_why: 这是什么?
- consider_pd_why_url: http://www.osmfoundation.org/wiki/License/Why_would_I_want_my_contributions_to_be_public_domain
+ consider_pd_why_url: https://wiki.osmfoundation.org/wiki/Licence_and_Legal_FAQ/Why_would_I_want_my_contributions_to_be_public_domain
guidance_html: 帮助理解这些条款的信息:一个<a href="%{summary}">可读的摘要</a>和一些<a href="%{translations}">非正式翻译</a>
continue: 继续
declined: http://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined
diary_feed_delay: 0
# Default legale (jurisdiction location) for contributor terms
default_legale: GB
-# Location of GPX traces and images
-gpx_trace_dir: "/home/osm/traces"
-gpx_image_dir: "/home/osm/images"
# Location of data for attachments
attachments_dir: ":rails_root/public/attachments"
# Log file to use
-# Trace directories for testing
-gpx_trace_dir: <%= Rails.root.join("test", "gpx", "traces") %>
-gpx_image_dir: <%= Rails.root.join("test", "gpx", "images") %>
# Ignore the diary feed delay unless we're specifically testing it
diary_feed_delay: 0
# Geonames credentials for testing
raise ArgumentError, "Page/Paginator mismatch" if page.is_a?(Page) && page.paginator != self
page = page.to_i
- @current_page_number = has_page_number?(page) ? page : 1
+ @current_page_number = contains_page?(page) ? page : 1
end
# Returns a Page object representing this paginator's current page.
alias length page_count
# Returns true if this paginator contains the page of index +number+.
- def has_page_number?(number)
+ def contains_page?(number)
number >= 1 && number <= page_count
end
def initialize(paginator, number)
@paginator = paginator
@number = number.to_i
- @number = 1 unless @paginator.has_page_number? @number
+ @number = 1 unless @paginator.contains_page? @number
end
attr_reader :paginator, :number
def padding=(padding)
@padding = padding.negative? ? 0 : padding
# Find the beginning and end pages of the window
- @first = if @paginator.has_page_number?(@page.number - @padding)
+ @first = if @paginator.contains_page?(@page.number - @padding)
@paginator[@page.number - @padding]
else
@paginator.first
end
- @last = if @paginator.has_page_number?(@page.number + @padding)
+ @last = if @paginator.contains_page?(@page.number + @padding)
@paginator[@page.number + @padding]
else
@paginator.last
@reader.read
raise OSM::APIBadUserInput, "Document element should be 'osmChange'." if @reader.name != "osmChange"
- result = OSM::API.new.get_xml_doc
+ result = OSM::API.new.xml_doc
result.root.name = "diffResult"
# loop at the top level, within the <osmChange> element
end
class API
- def get_xml_doc
+ def xml_doc
doc = XML::Document.new
doc.encoding = XML::Encoding::UTF_8
root = XML::Node.new "osm"
+++ /dev/null
-namespace :traces do
- desc "Migrate trace files to ActiveStorage"
- task :migrate_to_storage => :environment do
- Trace
- .with_attached_file
- .where(:file_attachment => { :id => nil })
- .find_each(&:migrate_to_storage!)
- end
-end
# test that it really is closed now
cs = Changeset.find(changeset.id)
- assert_not(cs.is_open?,
+ assert_not(cs.open?,
"changeset should be closed now (#{cs.closed_at} > #{Time.now.utc}.")
end
assert_equal Changeset::MAX_ELEMENTS + 1, changeset.num_changes
# check that the changeset is now closed as well
- assert_not(changeset.is_open?,
+ assert_not(changeset.open?,
"changeset should have been auto-closed by exceeding " \
"element limit.")
end
{ :path => "/api/0.6/permissions", :method => :get },
{ :controller => "api/permissions", :action => "show" }
)
+ assert_routing(
+ { :path => "/api/0.6/permissions.json", :method => :get },
+ { :controller => "api/permissions", :action => "show", :format => "json" }
+ )
end
def test_permissions_anonymous
assert_select "osm > permissions", :count => 1 do
assert_select "permission", :count => 0
end
+
+ # Test json
+ get permissions_path(:format => "json")
+ assert_response :success
+ assert_equal "application/json", @response.media_type
+
+ js = ActiveSupport::JSON.decode(@response.body)
+ assert_not_nil js
+ assert_equal 0, js["permissions"].count
end
def test_permissions_basic_auth
assert_select "permission[name='#{p}']", :count => 1
end
end
+
+ # Test json
+ get permissions_path(:format => "json"), :headers => auth_header
+ assert_response :success
+ assert_equal "application/json", @response.media_type
+
+ js = ActiveSupport::JSON.decode(@response.body)
+ assert_not_nil js
+ assert_equal ClientApplication.all_permissions.size, js["permissions"].count
+ ClientApplication.all_permissions.each do |p|
+ assert_includes js["permissions"], p.to_s
+ end
end
def test_permissions_oauth1
version = nil
with_controller(Api::ChangesetsController.new) do
- doc = OSM::API.new.get_xml_doc
+ doc = OSM::API.new.xml_doc
change = XML::Node.new "osmChange"
doc.root = change
modify = XML::Node.new "modify"
module Api
class TracesControllerTest < ActionDispatch::IntegrationTest
- # Use temporary directories with unique names for each test
- # This allows the tests to be run in parallel.
- def setup
- @gpx_trace_dir_orig = Settings.gpx_trace_dir
- @gpx_image_dir_orig = Settings.gpx_image_dir
- Settings.gpx_trace_dir = Dir.mktmpdir("trace", Rails.root.join("test/gpx"))
- Settings.gpx_image_dir = Dir.mktmpdir("image", Rails.root.join("test/gpx"))
- end
-
- def teardown
- FileUtils.remove_dir(Settings.gpx_trace_dir)
- FileUtils.remove_dir(Settings.gpx_image_dir)
- Settings.gpx_trace_dir = @gpx_trace_dir_orig
- Settings.gpx_image_dir = @gpx_image_dir_orig
- end
-
##
# test all routes which lead to this controller
def test_routes
get oauth_applications_path
assert_response :success
assert_template "oauth2_applications/index"
- assert_select "tr", 2
+ assert_select "tbody tr", 2
end
def test_new
get oauth_authorized_applications_path
assert_response :success
assert_template "oauth2_authorized_applications/index"
- assert_select "tr", 2
+ assert_select "tbody tr", 2
end
def test_destroy
get oauth_authorized_applications_path
assert_response :success
assert_template "oauth2_authorized_applications/index"
- assert_select "tr", 1
+ assert_select "tbody tr", 1
end
end
get oauth_clients_path(:display_name => user.display_name)
assert_response :success
assert_template "index"
- assert_select "div.client_application", 2
+ assert_select "li.client_application", 2
end
def test_new
require "test_helper"
class TracesControllerTest < ActionDispatch::IntegrationTest
- # Use temporary directories with unique names for each test
- # This allows the tests to be run in parallel.
- def setup
- @gpx_trace_dir_orig = Settings.gpx_trace_dir
- @gpx_image_dir_orig = Settings.gpx_image_dir
- Settings.gpx_trace_dir = Dir.mktmpdir("trace", Rails.root.join("test/gpx"))
- Settings.gpx_image_dir = Dir.mktmpdir("image", Rails.root.join("test/gpx"))
- end
-
- def teardown
- FileUtils.remove_dir(Settings.gpx_trace_dir)
- FileUtils.remove_dir(Settings.gpx_image_dir)
- Settings.gpx_trace_dir = @gpx_trace_dir_orig
- Settings.gpx_image_dir = @gpx_image_dir_orig
- end
-
##
# test all routes which lead to this controller
def test_routes
get "/user/#{ERB::Util.u(user.display_name)}/oauth_clients"
assert_response :success
assert_template "oauth_clients/index"
- assert_in_body { assert_select "div>a", "My New App" }
+ assert_in_body { assert_select "li>a", "My New App" }
end
##
require "gpx"
class TraceTest < ActiveSupport::TestCase
- # Use temporary directories with unique names for each test
- # This allows the tests to be run in parallel.
- def setup
- @gpx_trace_dir_orig = Settings.gpx_trace_dir
- @gpx_image_dir_orig = Settings.gpx_image_dir
- Settings.gpx_trace_dir = Dir.mktmpdir("trace", Rails.root.join("test/gpx"))
- Settings.gpx_image_dir = Dir.mktmpdir("image", Rails.root.join("test/gpx"))
- end
-
- def teardown
- FileUtils.remove_dir(Settings.gpx_trace_dir)
- FileUtils.remove_dir(Settings.gpx_image_dir)
- Settings.gpx_trace_dir = @gpx_trace_dir_orig
- Settings.gpx_image_dir = @gpx_image_dir_orig
- end
-
def test_visible
public_trace_file = create(:trace)
create(:trace, :deleted)
charlie = create(:user, :active)
create(:friendship, :befriender => alice, :befriendee => bob)
- assert alice.is_friends_with?(bob)
- assert_not alice.is_friends_with?(charlie)
- assert_not bob.is_friends_with?(alice)
- assert_not bob.is_friends_with?(charlie)
- assert_not charlie.is_friends_with?(bob)
- assert_not charlie.is_friends_with?(alice)
+ assert alice.friends_with?(bob)
+ assert_not alice.friends_with?(charlie)
+ assert_not bob.friends_with?(alice)
+ assert_not bob.friends_with?(charlie)
+ assert_not charlie.friends_with?(bob)
+ assert_not charlie.friends_with?(alice)
end
def test_users_nearby
end
def xml_for_node(node)
- doc = OSM::API.new.get_xml_doc
+ doc = OSM::API.new.xml_doc
doc.root << xml_node_for_node(node)
doc
end
end
def xml_for_way(way)
- doc = OSM::API.new.get_xml_doc
+ doc = OSM::API.new.xml_doc
doc.root << xml_node_for_way(way)
doc
end
end
def xml_for_relation(relation)
- doc = OSM::API.new.get_xml_doc
+ doc = OSM::API.new.xml_doc
doc.root << xml_node_for_relation(relation)
doc
end