geopolitical 3.2.1 → 4.1.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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/README.md +41 -0
  4. data/app/models/city.rb +8 -10
  5. data/app/models/geopolitical/postal/brasilapi.rb +39 -0
  6. data/app/models/geopolitical/postal/geoapify.rb +39 -0
  7. data/app/models/geopolitical/postal/google.rb +64 -0
  8. data/app/models/geopolitical/postal.rb +105 -0
  9. data/app/views/geopolitical/cities/_city.html.erb +6 -0
  10. data/app/views/geopolitical/cities/_form.html.erb +42 -0
  11. data/app/views/geopolitical/cities/edit.html.erb +1 -0
  12. data/app/views/geopolitical/cities/index.html.erb +46 -0
  13. data/app/views/geopolitical/cities/new.html.erb +1 -0
  14. data/app/views/geopolitical/cities/show.html.erb +24 -0
  15. data/app/views/geopolitical/geopolitical/edit.html.erb +1 -0
  16. data/app/views/geopolitical/geopolitical/index.html.erb +24 -0
  17. data/app/views/geopolitical/geopolitical/new.html.erb +1 -0
  18. data/app/views/geopolitical/hoods/_city.html.erb +6 -0
  19. data/app/views/geopolitical/hoods/_form.html.erb +40 -0
  20. data/app/views/geopolitical/hoods/edit.html.erb +1 -0
  21. data/app/views/geopolitical/hoods/index.html.erb +42 -0
  22. data/app/views/geopolitical/hoods/new.html.erb +1 -0
  23. data/app/views/geopolitical/hoods/show.html.erb +20 -0
  24. data/app/views/geopolitical/nations/_form.html.erb +44 -0
  25. data/app/views/geopolitical/nations/_nation.html.erb +7 -0
  26. data/app/views/geopolitical/nations/edit.html.erb +1 -0
  27. data/app/views/geopolitical/nations/index.html.erb +46 -0
  28. data/app/views/geopolitical/nations/new.html.erb +1 -0
  29. data/app/views/geopolitical/nations/show.html.erb +28 -0
  30. data/app/views/geopolitical/regions/_form.html.erb +40 -0
  31. data/app/views/geopolitical/regions/_region.html.erb +6 -0
  32. data/app/views/geopolitical/regions/edit.html.erb +1 -0
  33. data/app/views/geopolitical/regions/index.html.erb +42 -0
  34. data/app/views/geopolitical/regions/new.html.erb +1 -0
  35. data/app/views/geopolitical/regions/show.html.erb +24 -0
  36. data/app/views/layouts/geopolitical.html.erb +25 -0
  37. data/geopolitical.gemspec +2 -3
  38. data/lib/geopolitical/engine.rb +0 -1
  39. data/lib/geopolitical/version.rb +1 -1
  40. data/lib/geopolitical.rb +13 -0
  41. metadata +35 -45
  42. data/app/views/geopolitical/cities/_city.html.haml +0 -4
  43. data/app/views/geopolitical/cities/_form.html.haml +0 -28
  44. data/app/views/geopolitical/cities/edit.html.haml +0 -1
  45. data/app/views/geopolitical/cities/index.html.haml +0 -32
  46. data/app/views/geopolitical/cities/new.html.haml +0 -1
  47. data/app/views/geopolitical/cities/show.html.haml +0 -17
  48. data/app/views/geopolitical/geopolitical/edit.html.haml +0 -1
  49. data/app/views/geopolitical/geopolitical/index.html.haml +0 -19
  50. data/app/views/geopolitical/geopolitical/new.html.haml +0 -1
  51. data/app/views/geopolitical/hoods/_city.html.haml +0 -4
  52. data/app/views/geopolitical/hoods/_form.html.haml +0 -26
  53. data/app/views/geopolitical/hoods/edit.html.haml +0 -1
  54. data/app/views/geopolitical/hoods/index.html.haml +0 -28
  55. data/app/views/geopolitical/hoods/new.html.haml +0 -1
  56. data/app/views/geopolitical/hoods/show.html.haml +0 -14
  57. data/app/views/geopolitical/nations/_form.html.haml +0 -29
  58. data/app/views/geopolitical/nations/_nation.html.haml +0 -5
  59. data/app/views/geopolitical/nations/edit.html.haml +0 -1
  60. data/app/views/geopolitical/nations/index.html.haml +0 -32
  61. data/app/views/geopolitical/nations/new.html.haml +0 -1
  62. data/app/views/geopolitical/nations/show.html.haml +0 -20
  63. data/app/views/geopolitical/regions/_form.html.haml +0 -26
  64. data/app/views/geopolitical/regions/_region.html.haml +0 -4
  65. data/app/views/geopolitical/regions/edit.html.haml +0 -1
  66. data/app/views/geopolitical/regions/index.html.haml +0 -28
  67. data/app/views/geopolitical/regions/new.html.haml +0 -1
  68. data/app/views/geopolitical/regions/show.html.haml +0 -17
  69. data/app/views/layouts/geopolitical.html.haml +0 -18
@@ -1,14 +0,0 @@
1
- .container
2
- .row
3
- %h1= @hood.name
4
- .row
5
- %p
6
- %b #{Hood.human_attribute_name(:slug)}:
7
- = @hood.slug
8
- %p
9
- %b #{Hood.human_attribute_name(:city_id)}:
10
- = link_to @hood.city, city_path(@hood.city) if @hood.city
11
- .row
12
- = link_to t('geopolitical.actions.edit'), edit_hood_path(@hood)
13
- |
14
- = link_to t('geopolitical.actions.back'), hoods_path
@@ -1,29 +0,0 @@
1
- .container
2
- .row
3
- .page-header
4
- %h1
5
- - key = @nation.new_record? ? 'new' : 'edit'
6
- = t("geopolitical.forms.#{key}", model: Nation.model_name.human)
7
- .row
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
13
- .form-group
14
- = f.label :name
15
- = f.text_field :name
16
- .form-group
17
- = f.label :abbr
18
- = f.text_field :abbr
19
- .form-group
20
- = f.label :slug
21
- = f.text_field :slug
22
- .form-group
23
- = f.label :lang
24
- = f.text_field :lang
25
- .form-group
26
- = f.label :cash
27
- = f.text_field :cash
28
- .forms-buttons
29
- = f.submit t('geopolitical.actions.save')
@@ -1,5 +0,0 @@
1
- .nation
2
- %h4= link_to nation.name, nation_path(nation)
3
- %span.gray= nation.abbr
4
- .right
5
- = link_to t('geopolitical.actions.edit'), edit_nation_path(nation)
@@ -1 +0,0 @@
1
- = render 'form'
@@ -1,32 +0,0 @@
1
- .container
2
- .row
3
- .page-header
4
- %h1.title= Nation.model_name.human(count: 2)
5
- = link_to t('geopolitical.actions.new', model: Nation.model_name.human), new_nation_path
6
- .row
7
- .content
8
- %table.table
9
- %thead
10
- %tr
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)
17
- %th
18
- %tbody
19
- - @nations.each do |nation|
20
- %tr
21
- %td= nation.abbr
22
- %td= nation.code3.presence || nation.code
23
- %td
24
- = nation.name
25
- = link_to nation.slug, nation_path(nation)
26
- %td= nation.postal
27
- %td= truncate(nation.lang.to_s)
28
- %td= nation.cash
29
- %td.last
30
- = link_to t('geopolitical.actions.edit'), edit_nation_path(nation)
31
- .row
32
- = link_to t('geopolitical.actions.back'), root_path
@@ -1 +0,0 @@
1
- = render 'form'
@@ -1,20 +0,0 @@
1
- .container
2
- .row
3
- %h1= @nation.name
4
- .row
5
- %p
6
- %b #{Nation.human_attribute_name(:abbr)}:
7
- #{@nation.abbr} #{@nation.code3}
8
- %p
9
- %b #{Nation.human_attribute_name(:slug)}:
10
- = @nation.slug
11
- %p
12
- %b #{Nation.human_attribute_name(:lang)}:
13
- = @nation.lang
14
- %p
15
- %b #{Nation.human_attribute_name(:cash)}:
16
- = @nation.cash
17
- .row
18
- = link_to t('geopolitical.actions.edit'), edit_nation_path(@nation)
19
- |
20
- = link_to t('geopolitical.actions.back'), nations_path
@@ -1,26 +0,0 @@
1
- .container
2
- .row
3
- .page-header
4
- %h1
5
- - key = @region.new_record? ? 'new' : 'edit'
6
- = t("geopolitical.forms.#{key}", model: Region.model_name.human)
7
- .row
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
13
- .form-group
14
- = f.label :name
15
- = f.text_field :name
16
- .form-group
17
- = f.label :abbr
18
- = f.text_field :abbr
19
- .form-group
20
- = f.label :slug
21
- = f.text_field :slug
22
- .form-group
23
- = f.label :nation_id
24
- = f.select :nation_id, @nations, include_blank: true
25
- .forms-buttons
26
- = f.submit t('geopolitical.actions.save')
@@ -1,4 +0,0 @@
1
- .region
2
- %h4= link_to region.name, region_path(region)
3
- .right
4
- = link_to t('geopolitical.actions.edit'), edit_region_path(region)
@@ -1 +0,0 @@
1
- = render 'form'
@@ -1,28 +0,0 @@
1
- .container
2
- .row
3
- .page-header
4
- %h1.title= Region.model_name.human(count: 2)
5
- = link_to t('geopolitical.actions.new', model: Region.model_name.human), new_region_path
6
- .row
7
- .content
8
- %table.table
9
- %thead
10
- %tr
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)
15
- %th
16
- %tbody
17
- - @regions.each do |region|
18
- %tr
19
- %td= region.abbr
20
- %td
21
- = region.name
22
- = link_to region.slug, region_path(region)
23
- %td= region.nation&.name
24
- %td= region.cities.count
25
- %td.last
26
- = link_to t('geopolitical.actions.edit'), edit_region_path(region)
27
- .row
28
- = link_to t('geopolitical.actions.back'), root_path
@@ -1 +0,0 @@
1
- = render 'form'
@@ -1,17 +0,0 @@
1
- .container
2
- .row
3
- %h1= @region.name
4
- .row
5
- %p
6
- %b #{Region.human_attribute_name(:slug)}:
7
- = @region.slug
8
- %p
9
- %b #{Region.human_attribute_name(:nation_id)}:
10
- = link_to @region.nation, @region.nation
11
- %p
12
- %b #{Region.human_attribute_name(:abbr)}:
13
- = @region.abbr
14
- .row
15
- = link_to t('geopolitical.actions.edit'), edit_region_path(@region)
16
- |
17
- = link_to t('geopolitical.actions.back'), regions_path
@@ -1,18 +0,0 @@
1
- !!!
2
- %html{lang: I18n.locale}
3
- %head
4
- %meta{charset: 'utf-8'}/
5
- %meta{content: 'width=device-width, initial-scale=1.0', name: 'viewport'}/
6
- %title= t('geopolitical.title')
7
- = stylesheet_link_tag 'geopolitical/application', media: 'all'
8
- = javascript_include_tag 'geopolitical/application'
9
- = csrf_meta_tags
10
- %body
11
- %nav
12
- - [Nation, Region, City, Hood].each do |klass|
13
- = link_to klass.model_name.human(count: 2), send("#{klass.to_s.downcase.pluralize}_path")
14
- - if notice
15
- %p.notice= notice
16
- - if alert
17
- %p.alert= alert
18
- = yield