diff options
author | James Lopez <james@gitlab.com> | 2019-09-11 19:02:13 +0300 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2019-09-11 19:02:13 +0300 |
commit | 0abc902576a755355b1daf75e19d1f37c6ffb5ff (patch) | |
tree | b4d3d8f85518da9c780a029b221b9aa2a0aa4391 | |
parent | 3ffdae92b3575960e21515e7646a6f906e9ac1e0 (diff) | |
parent | 54b51d956e6fd1439f303f233da167d62ce2e50a (diff) |
Merge branch 'countries_option' into 'master'
Back port changes for country list Api
See merge request gitlab-org/gitlab-ce!32688
-rw-r--r-- | Gemfile | 3 | ||||
-rw-r--r-- | Gemfile.lock | 8 | ||||
-rw-r--r-- | config/dependency_decisions.yml | 7 | ||||
-rw-r--r-- | config/initializers/countries.rb | 61 | ||||
-rw-r--r-- | config/routes.rb | 1 |
5 files changed, 80 insertions, 0 deletions
@@ -447,3 +447,6 @@ gem 'unleash', '~> 0.1.5' # Structured logging gem 'lograge', '~> 0.5' gem 'grape_logging', '~> 1.7' + +# Countries list +gem 'countries', '~> 3.0' diff --git a/Gemfile.lock b/Gemfile.lock index 301b54f9a9f..fbdb78663e4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -159,6 +159,10 @@ GEM contracts (0.11.0) cork (0.3.0) colored2 (~> 3.1) + countries (3.0.0) + i18n_data (~> 0.8.0) + sixarm_ruby_unaccent (~> 1.1) + unicode_utils (~> 1.4) crack (0.4.3) safe_yaml (~> 1.0.0) crass (1.0.4) @@ -458,6 +462,7 @@ GEM httpclient (2.8.3) i18n (1.6.0) concurrent-ruby (~> 1.0) + i18n_data (0.8.0) icalendar (2.4.1) ice_nine (0.11.2) influxdb (0.2.3) @@ -924,6 +929,7 @@ GEM json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) + sixarm_ruby_unaccent (1.2.0) slack-notifier (1.5.1) snowplow-tracker (0.6.1) contracts (~> 0.7, <= 0.11) @@ -988,6 +994,7 @@ GEM unf_ext unf_ext (0.0.7.5) unicode-display_width (1.6.0) + unicode_utils (1.4.0) unicorn (5.4.1) kgio (~> 2.6) raindrops (~> 0.7) @@ -1086,6 +1093,7 @@ DEPENDENCIES commonmarker (~> 0.17) concurrent-ruby (~> 1.1) connection_pool (~> 2.0) + countries (~> 3.0) creole (~> 0.5.0) danger (~> 6.0) database_cleaner (~> 1.7.0) diff --git a/config/dependency_decisions.yml b/config/dependency_decisions.yml index 33c90989548..5346bf45473 100644 --- a/config/dependency_decisions.yml +++ b/config/dependency_decisions.yml @@ -613,3 +613,10 @@ :why: https://bitbucket.org/atlassian/atlassian-jwt-ruby/src/master/LICENSE.txt :versions: [] :when: 2019-08-30 05:45:35.317663000 Z +- - :license + - unicode_utils + - MIT + - :who: Aishwarya Subramanain + :why: https://github.com/hexorx/countries/blob/master/LICENSE + :versions: [] + :when: 2019-09-11 13:08:28.431132000 Z diff --git a/config/initializers/countries.rb b/config/initializers/countries.rb new file mode 100644 index 00000000000..d65ae19852f --- /dev/null +++ b/config/initializers/countries.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +ISO3166.configure do |config| + config.locales = [:en] +end + +# GitLab permits users to sign up in Ukraine except the Crimean Region: https://about.gitlab.com/handbook/people-operations/code-of-conduct/#trade-compliance-exportimport-control +# This overrides the display name for Ukraine to Ukraine (except Crimean Region) +# To be removed after https://gitlab.com/gitlab-org/gitlab-ee/issues/14784 is implemented +# Data fetched is based on https://github.com/hexorx/countries/blob/master/lib/countries/data/countries/UA.yaml +ISO3166::Data.register( + continent: "Europe", + address_format: "|- + {{recipient}} + {{street}} + {{city}} {{region_short}} + {{postalcode}} + {{country}}", + alpha2: "UA", + alpha3: "UKR", + country_code: '380', + international_prefix: '810', + ioc: "UKR", + gec: "UP", + name: "Ukraine (except Crimean Region)", + national_destination_code_lengths: [2], + national_number_lengths: [8, 9], + national_prefix: '8', + number: '804', + region: "Europe", + subregion: "Eastern Europe", + world_region: "EMEA", + un_locode: "UA", + nationality: "Ukrainian", + vat_rates: { + standard: 20 + }, + reduced: [7], + super_reduced: { + parking: { postal_code: true } + }, + unofficial_names: %w(Ukraine Ucrania ウクライナ Oekraïne Украина Україна Украіна), + languages_official: ["uk"], + languages_spoken: ["uk"], + geo: { + latitude: 48.379433, + latitude_dec: '48.92656326293945', + longitude: 31.16558, + longitude_dec: '31.47578239440918', + max_latitude: 52.37958099999999, + max_longitude: 40.2285809, + min_latitude: 44.2924, + min_longitude: 22.137159, + bounds: { + northeast: { lat: 52.37958099999999, lng: 40.2285809 }, + southwest: { lat: 44.2924, lng: 22.137159 } + } + }, + currency_code: "UAH", + start_of_week: "monday" +) diff --git a/config/routes.rb b/config/routes.rb index a622ce268da..7d091576e8f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -112,6 +112,7 @@ Rails.application.routes.draw do draw :jira_connect draw :username draw :trial_registration + draw :country end Gitlab.ee do |