geopolitical 2.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +28 -0
- data/README.md +152 -73
- data/app/controllers/geopolitical/application_controller.rb +8 -0
- data/app/controllers/geopolitical/cities_controller.rb +44 -10
- data/app/controllers/geopolitical/geopolitical_controller.rb +11 -9
- data/app/controllers/geopolitical/hoods_controller.rb +47 -9
- data/app/controllers/geopolitical/nations_controller.rb +45 -7
- data/app/controllers/geopolitical/regions_controller.rb +47 -7
- data/app/helpers/geopolitical/application_helper.rb +2 -0
- data/app/models/city.rb +149 -48
- data/app/models/concerns/geopolitocracy.rb +121 -34
- data/app/models/hood.rb +44 -18
- data/app/models/nation.rb +96 -17
- data/app/models/region.rb +42 -14
- data/app/views/geopolitical/cities/_city.html.haml +2 -5
- data/app/views/geopolitical/cities/_form.html.haml +25 -28
- data/app/views/geopolitical/cities/edit.html.haml +1 -0
- data/app/views/geopolitical/cities/index.html.haml +17 -20
- data/app/views/geopolitical/cities/new.html.haml +1 -0
- data/app/views/geopolitical/cities/show.html.haml +7 -7
- data/app/views/geopolitical/geopolitical/index.html.haml +7 -9
- data/app/views/geopolitical/hoods/_city.html.haml +2 -5
- data/app/views/geopolitical/hoods/_form.html.haml +21 -22
- data/app/views/geopolitical/hoods/edit.html.haml +1 -0
- data/app/views/geopolitical/hoods/index.html.haml +13 -18
- data/app/views/geopolitical/hoods/new.html.haml +1 -0
- data/app/views/geopolitical/hoods/show.html.haml +5 -5
- data/app/views/geopolitical/nations/_form.html.haml +11 -8
- data/app/views/geopolitical/nations/_nation.html.haml +5 -0
- data/app/views/geopolitical/nations/edit.html.haml +1 -0
- data/app/views/geopolitical/nations/index.html.haml +16 -20
- data/app/views/geopolitical/nations/new.html.haml +1 -0
- data/app/views/geopolitical/nations/show.html.haml +7 -7
- data/app/views/geopolitical/regions/_form.html.haml +10 -8
- data/app/views/geopolitical/regions/_region.html.haml +2 -5
- data/app/views/geopolitical/regions/edit.html.haml +1 -0
- data/app/views/geopolitical/regions/index.html.haml +12 -15
- data/app/views/geopolitical/regions/new.html.haml +1 -0
- data/app/views/geopolitical/regions/show.html.haml +5 -5
- data/app/views/layouts/geopolitical.html.haml +13 -15
- data/config/locales/geopolitical.en.yml +76 -0
- data/config/locales/geopolitical.pt.yml +77 -0
- data/geopolitical.gemspec +14 -12
- data/lib/geopolitical/engine.rb +3 -0
- data/lib/geopolitical/version.rb +3 -2
- data/lib/geopolitical.rb +23 -3
- metadata +42 -118
- data/.coveralls.yml +0 -1
- data/.gitignore +0 -11
- data/.rspec +0 -1
- data/.travis.yml +0 -26
- data/Gemfile +0 -15
- data/Guardfile +0 -24
- data/Rakefile +0 -25
- data/app/serializers/city_serializer.rb +0 -8
- data/app/serializers/nation_serializer.rb +0 -4
- data/app/serializers/region_serializer.rb +0 -4
- data/bin/rails +0 -8
- data/lib/tasks/geopolitical_tasks.rake +0 -4
- data/spec/dummy/README.rdoc +0 -28
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/stylesheets/application.css +0 -13
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/config/application.rb +0 -27
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -29
- data/spec/dummy/config/environments/production.rb +0 -80
- data/spec/dummy/config/environments/test.rb +0 -36
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -12
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -23
- data/spec/dummy/config/mongoid.yml +0 -63
- data/spec/dummy/config/routes.rb +0 -56
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +0 -23532
- data/spec/dummy/public/404.html +0 -58
- data/spec/dummy/public/422.html +0 -58
- data/spec/dummy/public/500.html +0 -57
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/fabricators/city_fabricator.rb +0 -6
- data/spec/fabricators/hood_fabricator.rb +0 -5
- data/spec/fabricators/nation_fabricator.rb +0 -4
- data/spec/fabricators/region_fabricator.rb +0 -5
- data/spec/models/city_spec.rb +0 -158
- data/spec/models/hood_spec.rb +0 -47
- data/spec/models/nation_spec.rb +0 -53
- data/spec/models/region_spec.rb +0 -20
- data/spec/spec_helper.rb +0 -57
data/app/models/region.rb
CHANGED
|
@@ -1,32 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Represents a region, province, or state within a nation.
|
|
1
4
|
#
|
|
2
|
-
#
|
|
3
|
-
#
|
|
5
|
+
# Regions belong to a nation and can have multiple cities. They can also have
|
|
6
|
+
# a designated capital city. Regions inherit common geopolitical attributes
|
|
7
|
+
# from the `Geopolitocracy` concern (like `name`, `abbr`, `slug`, `pop`, `phone`, `postal`).
|
|
4
8
|
class Region
|
|
5
9
|
include Mongoid::Document
|
|
6
|
-
include Geopolitocracy
|
|
10
|
+
include Geopolitocracy # Provides common geopolitical fields like name, abbr, slug, etc.
|
|
7
11
|
|
|
12
|
+
# @!attribute [rw] timezone
|
|
13
|
+
# @return [String, nil] The primary IANA timezone identifier for the region (e.g., "America/New_York").
|
|
8
14
|
field :timezone, type: String
|
|
9
15
|
|
|
16
|
+
# @!attribute [rw] nation
|
|
17
|
+
# @return [Nation] The nation this region belongs to. Required.
|
|
10
18
|
belongs_to :nation
|
|
11
19
|
|
|
20
|
+
# @!attribute [rw] cities
|
|
21
|
+
# @return [Mongoid::Relations::Targets::Enumerable<City>] The cities within this region.
|
|
22
|
+
# Cities are destroyed if the region is destroyed.
|
|
12
23
|
has_many :cities, dependent: :destroy
|
|
13
24
|
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
# @!attribute [rw] capital
|
|
26
|
+
# @return [City, nil] The capital city of this region. Optional.
|
|
27
|
+
belongs_to :capital, inverse_of: :region_governancy, class_name: 'City', optional: true
|
|
16
28
|
|
|
17
29
|
validates :nation, presence: true
|
|
18
|
-
validates :name,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
validates :name, uniqueness: { scope: :nation_id, message: 'must be unique within its nation' }
|
|
31
|
+
# `abbr` (from Geopolitocracy) should also be unique within its nation if present.
|
|
32
|
+
validates :abbr,
|
|
33
|
+
uniqueness: { scope: :nation_id, allow_nil: true, message: 'must be unique within its nation if provided' }
|
|
34
|
+
# Slug (from Geopolitocracy) should be unique within its nation. Presence is already validated by Geopolitocracy.
|
|
35
|
+
validates :slug, uniqueness: { scope: :nation_id, message: 'must be unique within its nation' }
|
|
36
|
+
|
|
37
|
+
index({ slug: 1 }) # For .search; global uniqueness is not required, see the compound index below
|
|
38
|
+
index({ abbr: 1 }, { sparse: true }) # Sparse index as abbr can be nil
|
|
39
|
+
index({ nation_id: 1, name: 1 }, { unique: true }) # Enforce uniqueness of name within nation
|
|
40
|
+
index({ nation_id: 1, abbr: 1 }, { unique: true, sparse: true }) # Enforce uniqueness of abbr within nation
|
|
41
|
+
index({ nation_id: 1, slug: 1 }, { unique: true }) # Enforce uniqueness of slug within nation
|
|
42
|
+
|
|
43
|
+
# Retrieves the phone dialing code for the region.
|
|
44
|
+
# Falls back to the nation's phone code if the region's is not set.
|
|
45
|
+
# Assumes `phone` field is provided by `Geopolitocracy`.
|
|
46
|
+
#
|
|
47
|
+
# @return [String, nil] The phone dialing code.
|
|
25
48
|
def phone
|
|
26
|
-
self[:phone] || nation
|
|
49
|
+
self[:phone] || nation&.phone
|
|
27
50
|
end
|
|
28
51
|
|
|
52
|
+
# Retrieves the primary postal code scheme or prefix for the region.
|
|
53
|
+
# Falls back to the nation's postal code scheme if the region's is not set.
|
|
54
|
+
# Assumes `postal` field is provided by `Geopolitocracy`.
|
|
55
|
+
#
|
|
56
|
+
# @return [String, nil] The postal code scheme or prefix.
|
|
29
57
|
def postal
|
|
30
|
-
self[:postal] || nation
|
|
58
|
+
self[:postal] || nation&.postal
|
|
31
59
|
end
|
|
32
60
|
end
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
.city
|
|
2
|
-
%h4= link_to city.name, city
|
|
3
|
-
%span.gray
|
|
2
|
+
%h4= link_to city.name, city_path(city)
|
|
4
3
|
.right
|
|
5
|
-
= link_to
|
|
6
|
-
.right
|
|
7
|
-
.gray= time_ago_in_words city.created_at
|
|
4
|
+
= link_to t('geopolitical.actions.edit'), edit_city_path(city)
|
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
.container
|
|
2
2
|
.row
|
|
3
3
|
.page-header
|
|
4
|
-
%h1
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
= f.submit
|
|
30
|
-
.grid_8
|
|
31
|
-
#map=# gmaps(@map, false, false)
|
|
4
|
+
%h1
|
|
5
|
+
- key = @city.new_record? ? 'new' : 'edit'
|
|
6
|
+
= t("geopolitical.forms.#{key}", model: City.model_name.human)
|
|
7
|
+
.row
|
|
8
|
+
= form_with model: @city, url: (@city.persisted? ? city_path(@city) : cities_path), html: { class: 'form' } do |f|
|
|
9
|
+
- if @city.errors.any?
|
|
10
|
+
%ul
|
|
11
|
+
- @city.errors.full_messages.each do |message|
|
|
12
|
+
%li= message
|
|
13
|
+
.form-group
|
|
14
|
+
= f.label :nation_id
|
|
15
|
+
= f.select :nation_id, @nations, include_blank: true
|
|
16
|
+
.form-group
|
|
17
|
+
= f.label :region_id
|
|
18
|
+
= f.select :region_id, @regions, include_blank: true
|
|
19
|
+
.form-group
|
|
20
|
+
= f.label :name
|
|
21
|
+
= f.text_field :name
|
|
22
|
+
.form-group
|
|
23
|
+
= f.label :slug
|
|
24
|
+
= f.text_field :slug
|
|
25
|
+
.form-group
|
|
26
|
+
= f.label :souls
|
|
27
|
+
= f.number_field :souls
|
|
28
|
+
= f.submit t('geopolitical.actions.save')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= render 'form'
|
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
.container
|
|
2
2
|
.row
|
|
3
3
|
.page-header
|
|
4
|
-
%h1.title
|
|
5
|
-
|
|
6
|
-
= link_to "New City", new_city_path
|
|
4
|
+
%h1.title= City.model_name.human(count: 2)
|
|
5
|
+
= link_to t('geopolitical.actions.new', model: City.model_name.human), new_city_path
|
|
7
6
|
.row
|
|
8
7
|
.content
|
|
9
8
|
%table.table
|
|
10
9
|
%thead
|
|
11
10
|
%tr
|
|
12
|
-
%th
|
|
13
|
-
%th
|
|
14
|
-
%th
|
|
15
|
-
%th
|
|
16
|
-
%th
|
|
11
|
+
%th= City.human_attribute_name(:name)
|
|
12
|
+
%th= City.human_attribute_name(:postal)
|
|
13
|
+
%th= City.human_attribute_name(:region_id)
|
|
14
|
+
%th= City.human_attribute_name(:nation_id)
|
|
15
|
+
%th= City.human_attribute_name(:souls)
|
|
17
16
|
%th
|
|
18
17
|
%tbody
|
|
19
|
-
-
|
|
18
|
+
- @cities.each do |city|
|
|
20
19
|
%tr
|
|
21
20
|
%td
|
|
22
21
|
= city.name
|
|
23
|
-
= link_to city.slug
|
|
24
|
-
%td= city.
|
|
25
|
-
%td= city.region
|
|
26
|
-
%td= city.nation
|
|
22
|
+
= link_to city.slug, city_path(city)
|
|
23
|
+
%td= city.postal
|
|
24
|
+
%td= city.region&.name
|
|
25
|
+
%td= city.nation&.name
|
|
27
26
|
%td= city.souls
|
|
28
|
-
%td{:
|
|
29
|
-
= link_to '
|
|
30
|
-
=
|
|
31
|
-
|
|
27
|
+
%td{align: 'right'}
|
|
28
|
+
= link_to t('geopolitical.actions.edit'), edit_city_path(city)
|
|
29
|
+
= button_to t('geopolitical.actions.destroy'), city_path(city), method: :delete,
|
|
30
|
+
data: { turbo_confirm: t('geopolitical.actions.confirm_destroy', model: City.model_name.human) }
|
|
32
31
|
.row
|
|
33
|
-
|
|
34
|
-
.row
|
|
35
|
-
= link_to 'Back', root_path
|
|
32
|
+
= link_to t('geopolitical.actions.back'), root_path
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= render 'form'
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
%h1= @city.name
|
|
4
4
|
.row
|
|
5
5
|
%p
|
|
6
|
-
%b
|
|
6
|
+
%b #{City.human_attribute_name(:slug)}:
|
|
7
7
|
= @city.slug
|
|
8
8
|
%p
|
|
9
|
-
%b
|
|
10
|
-
= link_to @city.nation, @city.nation
|
|
9
|
+
%b #{City.human_attribute_name(:nation_id)}:
|
|
10
|
+
= link_to @city.nation, nation_path(@city.nation) if @city.nation
|
|
11
11
|
%p
|
|
12
|
-
%b
|
|
13
|
-
= link_to @city.region, @city.region
|
|
12
|
+
%b #{City.human_attribute_name(:region_id)}:
|
|
13
|
+
= link_to @city.region, region_path(@city.region) if @city.region
|
|
14
14
|
.row
|
|
15
|
-
= link_to '
|
|
15
|
+
= link_to t('geopolitical.actions.edit'), edit_city_path(@city)
|
|
16
16
|
|
|
|
17
|
-
= link_to '
|
|
17
|
+
= link_to t('geopolitical.actions.back'), cities_path
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
%h1
|
|
1
|
+
%h1= t('geopolitical.title')
|
|
2
2
|
%hr
|
|
3
3
|
|
|
4
4
|
- [Nation, Region, City, Hood].each do |klass|
|
|
5
5
|
.block
|
|
6
6
|
%h3.title
|
|
7
|
-
= link_to klass.model_name.human
|
|
7
|
+
= link_to klass.model_name.human(count: 2), send("#{klass.to_s.downcase.pluralize}_path")
|
|
8
8
|
%small= klass.count
|
|
9
9
|
.right.links
|
|
10
|
-
= link_to
|
|
11
|
-
|
|
10
|
+
= link_to t('geopolitical.actions.new', model: klass.model_name.human),
|
|
11
|
+
send("new_#{klass.to_s.downcase}_path")
|
|
12
12
|
|
|
13
13
|
%br
|
|
14
14
|
%h4
|
|
15
|
-
|
|
16
|
-
%small= link_to
|
|
15
|
+
= t('geopolitical.dashboard.populate')
|
|
16
|
+
%small= link_to 'geonames_local', 'https://github.com/nofxx/geonames_local'
|
|
17
17
|
|
|
18
18
|
%hr
|
|
19
|
-
%p
|
|
20
|
-
%p= link_to "fireho/geopolitical", "http://github.com/fireho/geopolitical"
|
|
21
|
-
%p= link_to "< Back", "/"
|
|
19
|
+
%p= link_to 'fireho/geopolitical', 'https://github.com/fireho/geopolitical'
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
.hood
|
|
2
|
-
%h4= link_to hood.name, hood
|
|
3
|
-
%span.gray
|
|
2
|
+
%h4= link_to hood.name, hood_path(hood)
|
|
4
3
|
.right
|
|
5
|
-
= link_to
|
|
6
|
-
.right
|
|
7
|
-
.gray= time_ago_in_words hood.created_at
|
|
4
|
+
= link_to t('geopolitical.actions.edit'), edit_hood_path(hood)
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
.container
|
|
2
2
|
.row
|
|
3
3
|
.page-header
|
|
4
|
-
%h1
|
|
4
|
+
%h1
|
|
5
|
+
- key = @hood.new_record? ? 'new' : 'edit'
|
|
6
|
+
= t("geopolitical.forms.#{key}", model: Hood.model_name.human)
|
|
5
7
|
.row
|
|
6
8
|
.content
|
|
7
|
-
=
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
= f.submit
|
|
26
|
-
.grid_8
|
|
27
|
-
#map=# gmaps(@map, false, false)
|
|
9
|
+
= form_with model: @hood, url: (@hood.persisted? ? hood_path(@hood) : hoods_path), html: { class: 'form' } do |f|
|
|
10
|
+
- if @hood.errors.any?
|
|
11
|
+
%ul
|
|
12
|
+
- @hood.errors.full_messages.each do |message|
|
|
13
|
+
%li= message
|
|
14
|
+
.form-group
|
|
15
|
+
= f.label :city_id
|
|
16
|
+
= f.select :city_id, @cities, include_blank: true
|
|
17
|
+
.form-group
|
|
18
|
+
= f.label :name
|
|
19
|
+
= f.text_field :name
|
|
20
|
+
.form-group
|
|
21
|
+
= f.label :slug
|
|
22
|
+
= f.text_field :slug
|
|
23
|
+
.form-group
|
|
24
|
+
= f.label :souls
|
|
25
|
+
= f.number_field :souls
|
|
26
|
+
= f.submit t('geopolitical.actions.save')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= render 'form'
|
|
@@ -1,33 +1,28 @@
|
|
|
1
1
|
.container
|
|
2
2
|
.row
|
|
3
3
|
.page-header
|
|
4
|
-
%h1.title
|
|
5
|
-
|
|
6
|
-
= link_to "New Hood", new_hood_path
|
|
4
|
+
%h1.title= Hood.model_name.human(count: 2)
|
|
5
|
+
= link_to t('geopolitical.actions.new', model: Hood.model_name.human), new_hood_path
|
|
7
6
|
.row
|
|
8
7
|
.content
|
|
9
8
|
%table.table
|
|
10
9
|
%thead
|
|
11
10
|
%tr
|
|
12
|
-
%th
|
|
13
|
-
%th
|
|
14
|
-
%th
|
|
15
|
-
%th Population
|
|
11
|
+
%th= Hood.human_attribute_name(:name)
|
|
12
|
+
%th= Hood.human_attribute_name(:city_id)
|
|
13
|
+
%th= Hood.human_attribute_name(:souls)
|
|
16
14
|
%th
|
|
17
15
|
%tbody
|
|
18
|
-
-
|
|
16
|
+
- @hoods.each do |hood|
|
|
19
17
|
%tr
|
|
20
18
|
%td
|
|
21
19
|
= hood.name
|
|
22
|
-
= link_to hood.slug
|
|
23
|
-
%td= hood.city
|
|
24
|
-
%td= hood.city.name
|
|
20
|
+
= link_to hood.slug, hood_path(hood)
|
|
21
|
+
%td= hood.city&.name
|
|
25
22
|
%td= hood.souls
|
|
26
|
-
%td{:
|
|
27
|
-
= link_to '
|
|
28
|
-
=
|
|
29
|
-
|
|
23
|
+
%td{align: 'right'}
|
|
24
|
+
= link_to t('geopolitical.actions.edit'), edit_hood_path(hood)
|
|
25
|
+
= button_to t('geopolitical.actions.destroy'), hood_path(hood), method: :delete,
|
|
26
|
+
data: { turbo_confirm: t('geopolitical.actions.confirm_destroy', model: Hood.model_name.human) }
|
|
30
27
|
.row
|
|
31
|
-
|
|
32
|
-
.row
|
|
33
|
-
= link_to 'Back', root_path
|
|
28
|
+
= link_to t('geopolitical.actions.back'), root_path
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= render 'form'
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
%h1= @hood.name
|
|
4
4
|
.row
|
|
5
5
|
%p
|
|
6
|
-
%b
|
|
6
|
+
%b #{Hood.human_attribute_name(:slug)}:
|
|
7
7
|
= @hood.slug
|
|
8
8
|
%p
|
|
9
|
-
%b
|
|
10
|
-
= link_to @hood.city, @hood.city
|
|
9
|
+
%b #{Hood.human_attribute_name(:city_id)}:
|
|
10
|
+
= link_to @hood.city, city_path(@hood.city) if @hood.city
|
|
11
11
|
.row
|
|
12
|
-
= link_to '
|
|
12
|
+
= link_to t('geopolitical.actions.edit'), edit_hood_path(@hood)
|
|
13
13
|
|
|
|
14
|
-
= link_to '
|
|
14
|
+
= link_to t('geopolitical.actions.back'), hoods_path
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
.container
|
|
2
2
|
.row
|
|
3
3
|
.page-header
|
|
4
|
-
%h1
|
|
4
|
+
%h1
|
|
5
|
+
- key = @nation.new_record? ? 'new' : 'edit'
|
|
6
|
+
= t("geopolitical.forms.#{key}", model: Nation.model_name.human)
|
|
5
7
|
.row
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
= form_with model: @nation, url: (@nation.persisted? ? nation_path(@nation) : nations_path) do |f|
|
|
9
|
+
- if @nation.errors.any?
|
|
10
|
+
%ul
|
|
11
|
+
- @nation.errors.full_messages.each do |message|
|
|
12
|
+
%li= message
|
|
9
13
|
.form-group
|
|
10
14
|
= f.label :name
|
|
11
15
|
= f.text_field :name
|
|
@@ -19,8 +23,7 @@
|
|
|
19
23
|
= f.label :lang
|
|
20
24
|
= f.text_field :lang
|
|
21
25
|
.form-group
|
|
22
|
-
= f.label :
|
|
23
|
-
= f.text_field :
|
|
24
|
-
|
|
26
|
+
= f.label :cash
|
|
27
|
+
= f.text_field :cash
|
|
25
28
|
.forms-buttons
|
|
26
|
-
= f.submit
|
|
29
|
+
= f.submit t('geopolitical.actions.save')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= render 'form'
|
|
@@ -1,36 +1,32 @@
|
|
|
1
1
|
.container
|
|
2
2
|
.row
|
|
3
3
|
.page-header
|
|
4
|
-
%h1.title
|
|
5
|
-
|
|
6
|
-
= link_to "New Nation", new_nation_path
|
|
4
|
+
%h1.title= Nation.model_name.human(count: 2)
|
|
5
|
+
= link_to t('geopolitical.actions.new', model: Nation.model_name.human), new_nation_path
|
|
7
6
|
.row
|
|
8
7
|
.content
|
|
9
8
|
%table.table
|
|
10
9
|
%thead
|
|
11
10
|
%tr
|
|
12
|
-
%th
|
|
13
|
-
%th
|
|
14
|
-
%th
|
|
15
|
-
%th
|
|
16
|
-
%th
|
|
17
|
-
%th
|
|
11
|
+
%th= Nation.human_attribute_name(:abbr)
|
|
12
|
+
%th= Nation.human_attribute_name(:code3)
|
|
13
|
+
%th= Nation.human_attribute_name(:name)
|
|
14
|
+
%th= Nation.human_attribute_name(:postal)
|
|
15
|
+
%th= Nation.human_attribute_name(:lang)
|
|
16
|
+
%th= Nation.human_attribute_name(:cash)
|
|
18
17
|
%th
|
|
19
18
|
%tbody
|
|
20
|
-
-
|
|
19
|
+
- @nations.each do |nation|
|
|
21
20
|
%tr
|
|
22
|
-
%td
|
|
23
|
-
|
|
24
|
-
= nation.abbr
|
|
25
|
-
%td= nation.code
|
|
21
|
+
%td= nation.abbr
|
|
22
|
+
%td= nation.code3.presence || nation.code
|
|
26
23
|
%td
|
|
27
24
|
= nation.name
|
|
28
|
-
= link_to nation.slug, nation
|
|
29
|
-
%td= nation.
|
|
30
|
-
%td= truncate(nation.lang)
|
|
25
|
+
= link_to nation.slug, nation_path(nation)
|
|
26
|
+
%td= nation.postal
|
|
27
|
+
%td= truncate(nation.lang.to_s)
|
|
31
28
|
%td= nation.cash
|
|
32
29
|
%td.last
|
|
33
|
-
|
|
34
|
-
= link_to "Edit", edit_nation_path(nation)
|
|
30
|
+
= link_to t('geopolitical.actions.edit'), edit_nation_path(nation)
|
|
35
31
|
.row
|
|
36
|
-
= link_to '
|
|
32
|
+
= link_to t('geopolitical.actions.back'), root_path
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= render 'form'
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
%h1= @nation.name
|
|
4
4
|
.row
|
|
5
5
|
%p
|
|
6
|
-
%b
|
|
7
|
-
#{@nation.abbr} #{@nation.
|
|
6
|
+
%b #{Nation.human_attribute_name(:abbr)}:
|
|
7
|
+
#{@nation.abbr} #{@nation.code3}
|
|
8
8
|
%p
|
|
9
|
-
%b
|
|
9
|
+
%b #{Nation.human_attribute_name(:slug)}:
|
|
10
10
|
= @nation.slug
|
|
11
11
|
%p
|
|
12
|
-
%b
|
|
12
|
+
%b #{Nation.human_attribute_name(:lang)}:
|
|
13
13
|
= @nation.lang
|
|
14
14
|
%p
|
|
15
|
-
%b
|
|
15
|
+
%b #{Nation.human_attribute_name(:cash)}:
|
|
16
16
|
= @nation.cash
|
|
17
17
|
.row
|
|
18
|
-
= link_to '
|
|
18
|
+
= link_to t('geopolitical.actions.edit'), edit_nation_path(@nation)
|
|
19
19
|
|
|
|
20
|
-
= link_to '
|
|
20
|
+
= link_to t('geopolitical.actions.back'), nations_path
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
.container
|
|
2
2
|
.row
|
|
3
3
|
.page-header
|
|
4
|
-
%h1
|
|
4
|
+
%h1
|
|
5
|
+
- key = @region.new_record? ? 'new' : 'edit'
|
|
6
|
+
= t("geopolitical.forms.#{key}", model: Region.model_name.human)
|
|
5
7
|
.row
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
= form_with model: @region, url: (@region.persisted? ? region_path(@region) : regions_path) do |f|
|
|
9
|
+
- if @region.errors.any?
|
|
10
|
+
%ul
|
|
11
|
+
- @region.errors.full_messages.each do |message|
|
|
12
|
+
%li= message
|
|
10
13
|
.form-group
|
|
11
14
|
= f.label :name
|
|
12
15
|
= f.text_field :name
|
|
@@ -18,7 +21,6 @@
|
|
|
18
21
|
= f.text_field :slug
|
|
19
22
|
.form-group
|
|
20
23
|
= f.label :nation_id
|
|
21
|
-
= f.select :nation_id, @nations
|
|
22
|
-
|
|
24
|
+
= f.select :nation_id, @nations, include_blank: true
|
|
23
25
|
.forms-buttons
|
|
24
|
-
= f.submit
|
|
26
|
+
= f.submit t('geopolitical.actions.save')
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
.region
|
|
2
|
-
%h4= link_to region.name, region
|
|
3
|
-
%span.gray
|
|
2
|
+
%h4= link_to region.name, region_path(region)
|
|
4
3
|
.right
|
|
5
|
-
|
|
6
|
-
.right
|
|
7
|
-
= link_to "Editar", edit_region_path(region) if admin?
|
|
4
|
+
= link_to t('geopolitical.actions.edit'), edit_region_path(region)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= render 'form'
|
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
.container
|
|
2
2
|
.row
|
|
3
3
|
.page-header
|
|
4
|
-
%h1.title
|
|
5
|
-
|
|
6
|
-
= link_to "New Regions", new_region_path
|
|
4
|
+
%h1.title= Region.model_name.human(count: 2)
|
|
5
|
+
= link_to t('geopolitical.actions.new', model: Region.model_name.human), new_region_path
|
|
7
6
|
.row
|
|
8
7
|
.content
|
|
9
8
|
%table.table
|
|
10
9
|
%thead
|
|
11
10
|
%tr
|
|
12
|
-
%th
|
|
13
|
-
%th
|
|
14
|
-
%th
|
|
15
|
-
%th
|
|
11
|
+
%th= Region.human_attribute_name(:abbr)
|
|
12
|
+
%th= Region.human_attribute_name(:name)
|
|
13
|
+
%th= Region.human_attribute_name(:nation_id)
|
|
14
|
+
%th= Region.human_attribute_name(:cities)
|
|
16
15
|
%th
|
|
17
16
|
%tbody
|
|
18
|
-
-
|
|
17
|
+
- @regions.each do |region|
|
|
19
18
|
%tr
|
|
20
|
-
%td
|
|
21
|
-
= region.abbr
|
|
19
|
+
%td= region.abbr
|
|
22
20
|
%td
|
|
23
21
|
= region.name
|
|
24
|
-
= link_to region.slug, region
|
|
25
|
-
%td= region.nation
|
|
22
|
+
= link_to region.slug, region_path(region)
|
|
23
|
+
%td= region.nation&.name
|
|
26
24
|
%td= region.cities.count
|
|
27
25
|
%td.last
|
|
28
|
-
|
|
29
|
-
= link_to 'Edit', edit_region_path(region)
|
|
26
|
+
= link_to t('geopolitical.actions.edit'), edit_region_path(region)
|
|
30
27
|
.row
|
|
31
|
-
= link_to '
|
|
28
|
+
= link_to t('geopolitical.actions.back'), root_path
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= render 'form'
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
%h1= @region.name
|
|
4
4
|
.row
|
|
5
5
|
%p
|
|
6
|
-
%b
|
|
6
|
+
%b #{Region.human_attribute_name(:slug)}:
|
|
7
7
|
= @region.slug
|
|
8
8
|
%p
|
|
9
|
-
%b
|
|
9
|
+
%b #{Region.human_attribute_name(:nation_id)}:
|
|
10
10
|
= link_to @region.nation, @region.nation
|
|
11
11
|
%p
|
|
12
|
-
%b
|
|
12
|
+
%b #{Region.human_attribute_name(:abbr)}:
|
|
13
13
|
= @region.abbr
|
|
14
14
|
.row
|
|
15
|
-
= link_to '
|
|
15
|
+
= link_to t('geopolitical.actions.edit'), edit_region_path(@region)
|
|
16
16
|
|
|
|
17
|
-
= link_to '
|
|
17
|
+
= link_to t('geopolitical.actions.back'), regions_path
|