china_regions 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65852eef10a092038e498c3f7eec696ad6c2598072839bf3edafbc96d52579c6
4
- data.tar.gz: '0169f567da375fd7d4e9713fe6004991ab01b34ee0a8e4fb61f33284ee96d296'
3
+ metadata.gz: 72b433dc0d51468a2a5e06c4b51aa450e2e9ff661f13995019e7bc05f99d5b7f
4
+ data.tar.gz: 748f7542e2a8a7c6267d9bb543505706c1c1104eb08d3d71c4eb5891180d9c20
5
5
  SHA512:
6
- metadata.gz: 639f67a31cf88385fec479e174e5d25999c8ee2f4e61fdac1fdf31e08012aefbfa8d5c32c40c97989dcad9629085ff656804f06d3c4931818e0158a07dd70f76
7
- data.tar.gz: 903e20a4be9c05635e05117ace6e8e429b44d50be7938c02d7708631c4462a20c1f8a04e846a3e9cc54ccbdf8886ef1b2b0f325d8847a53d7c78ed89fd35ed47
6
+ metadata.gz: 64083c36bff08087d65f17a820cb24245f7279d5d2d10f5973b8dd9e39aba2fb2e57176a3322788af92b9b43c560f4d32664114a3768f0f91edeb6804c29e1f9
7
+ data.tar.gz: 314f8737b7bdc229d1f442260947ee0f4df14dade593f3a34252cc8497beed94885653ecf22d82f117f6f83d196d76d52b084384140f8c7d24ad0f4031701cc0
@@ -10,7 +10,7 @@ class City < ApplicationRecord
10
10
 
11
11
  # Relationships
12
12
  belongs_to :province, counter_cache: true
13
- delegate :name, to: :province
13
+ delegate :name, to: :province, prefix: true
14
14
 
15
15
  has_many :districts, dependent: :destroy
16
16
 
@@ -9,19 +9,19 @@ class District < ApplicationRecord
9
9
 
10
10
  # Relationships
11
11
  belongs_to :city, counter_cache: true
12
- delegate :name, to: :city
12
+ delegate :name, to: :city, prefix: true
13
13
 
14
14
  # Filters
15
15
  scope :for_city, ->(city_id) { where(city_id: city_id) }
16
16
 
17
- def full_name
18
- [province.name, city_name, name].compact.join(' - ')
19
- end
20
-
21
17
  def province
22
18
  city.province
23
19
  end
24
20
 
21
+ def full_name
22
+ [province.name, city_name, name].compact.join(' - ')
23
+ end
24
+
25
25
  def short_name
26
26
  @short_name ||= name.gsub(/区|县|市|自治县/, '')
27
27
  end
@@ -10,18 +10,23 @@ en:
10
10
  attributes:
11
11
  province:
12
12
  name: Name
13
+ code: Code
13
14
  name_en: English Name
14
15
  name_abbr: Short Name
16
+ cities_count: Cities Count
15
17
  city:
16
- name: Nam
18
+ name: Name
17
19
  province_id: Province
18
20
  province: Province
19
21
  name_en: English Name
20
22
  name_abbr: Short Name
21
23
  level: Level
24
+ code: Code
25
+ districts_count: Districts Count
22
26
  district:
23
27
  name: Name
24
28
  city_id: City
25
29
  city: City
26
30
  name_en: English Name
27
31
  name_abbr: Short Name
32
+ code: Code
@@ -10,8 +10,10 @@ zh:
10
10
  attributes:
11
11
  province:
12
12
  name: 名称
13
+ code: 编码
13
14
  name_en: 拼音
14
15
  name_abbr: 简称
16
+ cities_count: 城市数
15
17
  city:
16
18
  name: 名称
17
19
  province_id: 省份
@@ -19,9 +21,12 @@ zh:
19
21
  name_en: 拼音
20
22
  name_abbr: 简称
21
23
  level: 等级
24
+ code: 编码
25
+ districts_count: 地区数
22
26
  district:
23
27
  name: 名称
24
28
  city_id: 城市
25
29
  city: 城市
26
30
  name_en: 拼音
27
31
  name_abbr: 简称
32
+ code: 编码
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChinaRegions
4
- VERSION = '1.0.3'
4
+ VERSION = '1.0.4'
5
5
  end
@@ -14,7 +14,7 @@ module ChinaRegions
14
14
  def copy_locales
15
15
  %w[en zh].each do |locale|
16
16
  config_file = "config/locales/regions.#{locale}.yml"
17
- copy_file "../../../../config/locales/#{locale}.yml", config_file unless File.exist?(config_file)
17
+ copy_file "../../../../config/locales/china_regions.#{locale}.yml", config_file unless File.exist?(config_file)
18
18
  end
19
19
  end
20
20
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: china_regions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Encore Shao
@@ -120,8 +120,8 @@ files:
120
120
  - bin/console
121
121
  - bin/setup
122
122
  - china_regions.gemspec
123
- - config/locales/en.yml
124
- - config/locales/zh.yml
123
+ - config/locales/china_regions.en.yml
124
+ - config/locales/china_regions.zh.yml
125
125
  - config/routes.rb
126
126
  - lib/china_regions.rb
127
127
  - lib/china_regions/engine.rb