geopolitical 3.2.0 → 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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -1
  3. data/README.md +41 -0
  4. data/app/models/city.rb +9 -10
  5. data/app/models/concerns/geopolitocracy.rb +3 -3
  6. data/app/models/geopolitical/postal/brasilapi.rb +39 -0
  7. data/app/models/geopolitical/postal/geoapify.rb +39 -0
  8. data/app/models/geopolitical/postal/google.rb +64 -0
  9. data/app/models/geopolitical/postal.rb +105 -0
  10. data/app/models/nation.rb +1 -0
  11. data/app/models/region.rb +4 -2
  12. data/app/views/geopolitical/cities/_city.html.erb +6 -0
  13. data/app/views/geopolitical/cities/_form.html.erb +42 -0
  14. data/app/views/geopolitical/cities/edit.html.erb +1 -0
  15. data/app/views/geopolitical/cities/index.html.erb +46 -0
  16. data/app/views/geopolitical/cities/new.html.erb +1 -0
  17. data/app/views/geopolitical/cities/show.html.erb +24 -0
  18. data/app/views/geopolitical/geopolitical/edit.html.erb +1 -0
  19. data/app/views/geopolitical/geopolitical/index.html.erb +24 -0
  20. data/app/views/geopolitical/geopolitical/new.html.erb +1 -0
  21. data/app/views/geopolitical/hoods/_city.html.erb +6 -0
  22. data/app/views/geopolitical/hoods/_form.html.erb +40 -0
  23. data/app/views/geopolitical/hoods/edit.html.erb +1 -0
  24. data/app/views/geopolitical/hoods/index.html.erb +42 -0
  25. data/app/views/geopolitical/hoods/new.html.erb +1 -0
  26. data/app/views/geopolitical/hoods/show.html.erb +20 -0
  27. data/app/views/geopolitical/nations/_form.html.erb +44 -0
  28. data/app/views/geopolitical/nations/_nation.html.erb +7 -0
  29. data/app/views/geopolitical/nations/edit.html.erb +1 -0
  30. data/app/views/geopolitical/nations/index.html.erb +46 -0
  31. data/app/views/geopolitical/nations/new.html.erb +1 -0
  32. data/app/views/geopolitical/nations/show.html.erb +28 -0
  33. data/app/views/geopolitical/regions/_form.html.erb +40 -0
  34. data/app/views/geopolitical/regions/_region.html.erb +6 -0
  35. data/app/views/geopolitical/regions/edit.html.erb +1 -0
  36. data/app/views/geopolitical/regions/index.html.erb +42 -0
  37. data/app/views/geopolitical/regions/new.html.erb +1 -0
  38. data/app/views/geopolitical/regions/show.html.erb +24 -0
  39. data/app/views/layouts/geopolitical.html.erb +25 -0
  40. data/geopolitical.gemspec +2 -3
  41. data/lib/geopolitical/engine.rb +0 -1
  42. data/lib/geopolitical/version.rb +1 -1
  43. data/lib/geopolitical.rb +13 -0
  44. metadata +35 -45
  45. data/app/views/geopolitical/cities/_city.html.haml +0 -4
  46. data/app/views/geopolitical/cities/_form.html.haml +0 -28
  47. data/app/views/geopolitical/cities/edit.html.haml +0 -1
  48. data/app/views/geopolitical/cities/index.html.haml +0 -32
  49. data/app/views/geopolitical/cities/new.html.haml +0 -1
  50. data/app/views/geopolitical/cities/show.html.haml +0 -17
  51. data/app/views/geopolitical/geopolitical/edit.html.haml +0 -1
  52. data/app/views/geopolitical/geopolitical/index.html.haml +0 -19
  53. data/app/views/geopolitical/geopolitical/new.html.haml +0 -1
  54. data/app/views/geopolitical/hoods/_city.html.haml +0 -4
  55. data/app/views/geopolitical/hoods/_form.html.haml +0 -26
  56. data/app/views/geopolitical/hoods/edit.html.haml +0 -1
  57. data/app/views/geopolitical/hoods/index.html.haml +0 -28
  58. data/app/views/geopolitical/hoods/new.html.haml +0 -1
  59. data/app/views/geopolitical/hoods/show.html.haml +0 -14
  60. data/app/views/geopolitical/nations/_form.html.haml +0 -29
  61. data/app/views/geopolitical/nations/_nation.html.haml +0 -5
  62. data/app/views/geopolitical/nations/edit.html.haml +0 -1
  63. data/app/views/geopolitical/nations/index.html.haml +0 -32
  64. data/app/views/geopolitical/nations/new.html.haml +0 -1
  65. data/app/views/geopolitical/nations/show.html.haml +0 -20
  66. data/app/views/geopolitical/regions/_form.html.haml +0 -26
  67. data/app/views/geopolitical/regions/_region.html.haml +0 -4
  68. data/app/views/geopolitical/regions/edit.html.haml +0 -1
  69. data/app/views/geopolitical/regions/index.html.haml +0 -28
  70. data/app/views/geopolitical/regions/new.html.haml +0 -1
  71. data/app/views/geopolitical/regions/show.html.haml +0 -17
  72. data/app/views/layouts/geopolitical.html.haml +0 -18
@@ -0,0 +1,42 @@
1
+ <div class="container">
2
+ <div class="row">
3
+ <div class="page-header">
4
+ <h1 class="title"><%= Hood.model_name.human(count: 2) %></h1>
5
+ <%= link_to t('geopolitical.actions.new', model: Hood.model_name.human), new_hood_path %>
6
+ </div>
7
+ </div>
8
+ <div class="row">
9
+ <div class="content">
10
+ <table class="table">
11
+ <thead>
12
+ <tr>
13
+ <th><%= Hood.human_attribute_name(:name) %></th>
14
+ <th><%= Hood.human_attribute_name(:city_id) %></th>
15
+ <th><%= Hood.human_attribute_name(:souls) %></th>
16
+ <th></th>
17
+ </tr>
18
+ </thead>
19
+ <tbody>
20
+ <% @hoods.each do |hood| %>
21
+ <tr>
22
+ <td>
23
+ <%= hood.name %>
24
+ <%= link_to hood.slug, hood_path(hood) %>
25
+ </td>
26
+ <td><%= hood.city&.name %></td>
27
+ <td><%= hood.souls %></td>
28
+ <td align="right">
29
+ <%= link_to t('geopolitical.actions.edit'), edit_hood_path(hood) %>
30
+ <%= button_to t('geopolitical.actions.destroy'), hood_path(hood), method: :delete,
31
+ data: { turbo_confirm: t('geopolitical.actions.confirm_destroy', model: Hood.model_name.human) } %>
32
+ </td>
33
+ </tr>
34
+ <% end %>
35
+ </tbody>
36
+ </table>
37
+ </div>
38
+ </div>
39
+ <div class="row">
40
+ <%= link_to t('geopolitical.actions.back'), root_path %>
41
+ </div>
42
+ </div>
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1,20 @@
1
+ <div class="container">
2
+ <div class="row">
3
+ <h1><%= @hood.name %></h1>
4
+ </div>
5
+ <div class="row">
6
+ <p>
7
+ <b><%= Hood.human_attribute_name(:slug) %>:</b>
8
+ <%= @hood.slug %>
9
+ </p>
10
+ <p>
11
+ <b><%= Hood.human_attribute_name(:city_id) %>:</b>
12
+ <%= link_to @hood.city, city_path(@hood.city) if @hood.city %>
13
+ </p>
14
+ </div>
15
+ <div class="row">
16
+ <%= link_to t('geopolitical.actions.edit'), edit_hood_path(@hood) %>
17
+ |
18
+ <%= link_to t('geopolitical.actions.back'), hoods_path %>
19
+ </div>
20
+ </div>
@@ -0,0 +1,44 @@
1
+ <div class="container">
2
+ <div class="row">
3
+ <div class="page-header">
4
+ <h1>
5
+ <% key = @nation.new_record? ? 'new' : 'edit' %>
6
+ <%= t("geopolitical.forms.#{key}", model: Nation.model_name.human) %>
7
+ </h1>
8
+ </div>
9
+ </div>
10
+ <div class="row">
11
+ <%= form_with model: @nation, url: (@nation.persisted? ? nation_path(@nation) : nations_path) do |f| %>
12
+ <% if @nation.errors.any? %>
13
+ <ul>
14
+ <% @nation.errors.full_messages.each do |message| %>
15
+ <li><%= message %></li>
16
+ <% end %>
17
+ </ul>
18
+ <% end %>
19
+ <div class="form-group">
20
+ <%= f.label :name %>
21
+ <%= f.text_field :name %>
22
+ </div>
23
+ <div class="form-group">
24
+ <%= f.label :abbr %>
25
+ <%= f.text_field :abbr %>
26
+ </div>
27
+ <div class="form-group">
28
+ <%= f.label :slug %>
29
+ <%= f.text_field :slug %>
30
+ </div>
31
+ <div class="form-group">
32
+ <%= f.label :lang %>
33
+ <%= f.text_field :lang %>
34
+ </div>
35
+ <div class="form-group">
36
+ <%= f.label :cash %>
37
+ <%= f.text_field :cash %>
38
+ </div>
39
+ <div class="forms-buttons">
40
+ <%= f.submit t('geopolitical.actions.save') %>
41
+ </div>
42
+ <% end %>
43
+ </div>
44
+ </div>
@@ -0,0 +1,7 @@
1
+ <div class="nation">
2
+ <h4><%= link_to nation.name, nation_path(nation) %></h4>
3
+ <span class="gray"><%= nation.abbr %></span>
4
+ <div class="right">
5
+ <%= link_to t('geopolitical.actions.edit'), edit_nation_path(nation) %>
6
+ </div>
7
+ </div>
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1,46 @@
1
+ <div class="container">
2
+ <div class="row">
3
+ <div class="page-header">
4
+ <h1 class="title"><%= Nation.model_name.human(count: 2) %></h1>
5
+ <%= link_to t('geopolitical.actions.new', model: Nation.model_name.human), new_nation_path %>
6
+ </div>
7
+ </div>
8
+ <div class="row">
9
+ <div class="content">
10
+ <table class="table">
11
+ <thead>
12
+ <tr>
13
+ <th><%= Nation.human_attribute_name(:abbr) %></th>
14
+ <th><%= Nation.human_attribute_name(:code3) %></th>
15
+ <th><%= Nation.human_attribute_name(:name) %></th>
16
+ <th><%= Nation.human_attribute_name(:postal) %></th>
17
+ <th><%= Nation.human_attribute_name(:lang) %></th>
18
+ <th><%= Nation.human_attribute_name(:cash) %></th>
19
+ <th></th>
20
+ </tr>
21
+ </thead>
22
+ <tbody>
23
+ <% @nations.each do |nation| %>
24
+ <tr>
25
+ <td><%= nation.abbr %></td>
26
+ <td><%= nation.code3.presence || nation.code %></td>
27
+ <td>
28
+ <%= nation.name %>
29
+ <%= link_to nation.slug, nation_path(nation) %>
30
+ </td>
31
+ <td><%= nation.postal %></td>
32
+ <td><%= truncate(nation.lang.to_s) %></td>
33
+ <td><%= nation.cash %></td>
34
+ <td class="last">
35
+ <%= link_to t('geopolitical.actions.edit'), edit_nation_path(nation) %>
36
+ </td>
37
+ </tr>
38
+ <% end %>
39
+ </tbody>
40
+ </table>
41
+ </div>
42
+ </div>
43
+ <div class="row">
44
+ <%= link_to t('geopolitical.actions.back'), root_path %>
45
+ </div>
46
+ </div>
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1,28 @@
1
+ <div class="container">
2
+ <div class="row">
3
+ <h1><%= @nation.name %></h1>
4
+ </div>
5
+ <div class="row">
6
+ <p>
7
+ <b><%= Nation.human_attribute_name(:abbr) %>:</b>
8
+ <%= @nation.abbr %> <%= @nation.code3 %>
9
+ </p>
10
+ <p>
11
+ <b><%= Nation.human_attribute_name(:slug) %>:</b>
12
+ <%= @nation.slug %>
13
+ </p>
14
+ <p>
15
+ <b><%= Nation.human_attribute_name(:lang) %>:</b>
16
+ <%= @nation.lang %>
17
+ </p>
18
+ <p>
19
+ <b><%= Nation.human_attribute_name(:cash) %>:</b>
20
+ <%= @nation.cash %>
21
+ </p>
22
+ </div>
23
+ <div class="row">
24
+ <%= link_to t('geopolitical.actions.edit'), edit_nation_path(@nation) %>
25
+ |
26
+ <%= link_to t('geopolitical.actions.back'), nations_path %>
27
+ </div>
28
+ </div>
@@ -0,0 +1,40 @@
1
+ <div class="container">
2
+ <div class="row">
3
+ <div class="page-header">
4
+ <h1>
5
+ <% key = @region.new_record? ? 'new' : 'edit' %>
6
+ <%= t("geopolitical.forms.#{key}", model: Region.model_name.human) %>
7
+ </h1>
8
+ </div>
9
+ </div>
10
+ <div class="row">
11
+ <%= form_with model: @region, url: (@region.persisted? ? region_path(@region) : regions_path) do |f| %>
12
+ <% if @region.errors.any? %>
13
+ <ul>
14
+ <% @region.errors.full_messages.each do |message| %>
15
+ <li><%= message %></li>
16
+ <% end %>
17
+ </ul>
18
+ <% end %>
19
+ <div class="form-group">
20
+ <%= f.label :name %>
21
+ <%= f.text_field :name %>
22
+ </div>
23
+ <div class="form-group">
24
+ <%= f.label :abbr %>
25
+ <%= f.text_field :abbr %>
26
+ </div>
27
+ <div class="form-group">
28
+ <%= f.label :slug %>
29
+ <%= f.text_field :slug %>
30
+ </div>
31
+ <div class="form-group">
32
+ <%= f.label :nation_id %>
33
+ <%= f.select :nation_id, @nations, include_blank: true %>
34
+ </div>
35
+ <div class="forms-buttons">
36
+ <%= f.submit t('geopolitical.actions.save') %>
37
+ </div>
38
+ <% end %>
39
+ </div>
40
+ </div>
@@ -0,0 +1,6 @@
1
+ <div class="region">
2
+ <h4><%= link_to region.name, region_path(region) %></h4>
3
+ <div class="right">
4
+ <%= link_to t('geopolitical.actions.edit'), edit_region_path(region) %>
5
+ </div>
6
+ </div>
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1,42 @@
1
+ <div class="container">
2
+ <div class="row">
3
+ <div class="page-header">
4
+ <h1 class="title"><%= Region.model_name.human(count: 2) %></h1>
5
+ <%= link_to t('geopolitical.actions.new', model: Region.model_name.human), new_region_path %>
6
+ </div>
7
+ </div>
8
+ <div class="row">
9
+ <div class="content">
10
+ <table class="table">
11
+ <thead>
12
+ <tr>
13
+ <th><%= Region.human_attribute_name(:abbr) %></th>
14
+ <th><%= Region.human_attribute_name(:name) %></th>
15
+ <th><%= Region.human_attribute_name(:nation_id) %></th>
16
+ <th><%= Region.human_attribute_name(:cities) %></th>
17
+ <th></th>
18
+ </tr>
19
+ </thead>
20
+ <tbody>
21
+ <% @regions.each do |region| %>
22
+ <tr>
23
+ <td><%= region.abbr %></td>
24
+ <td>
25
+ <%= region.name %>
26
+ <%= link_to region.slug, region_path(region) %>
27
+ </td>
28
+ <td><%= region.nation&.name %></td>
29
+ <td><%= region.cities.count %></td>
30
+ <td class="last">
31
+ <%= link_to t('geopolitical.actions.edit'), edit_region_path(region) %>
32
+ </td>
33
+ </tr>
34
+ <% end %>
35
+ </tbody>
36
+ </table>
37
+ </div>
38
+ </div>
39
+ <div class="row">
40
+ <%= link_to t('geopolitical.actions.back'), root_path %>
41
+ </div>
42
+ </div>
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1,24 @@
1
+ <div class="container">
2
+ <div class="row">
3
+ <h1><%= @region.name %></h1>
4
+ </div>
5
+ <div class="row">
6
+ <p>
7
+ <b><%= Region.human_attribute_name(:slug) %>:</b>
8
+ <%= @region.slug %>
9
+ </p>
10
+ <p>
11
+ <b><%= Region.human_attribute_name(:nation_id) %>:</b>
12
+ <%= link_to @region.nation, @region.nation %>
13
+ </p>
14
+ <p>
15
+ <b><%= Region.human_attribute_name(:abbr) %>:</b>
16
+ <%= @region.abbr %>
17
+ </p>
18
+ </div>
19
+ <div class="row">
20
+ <%= link_to t('geopolitical.actions.edit'), edit_region_path(@region) %>
21
+ |
22
+ <%= link_to t('geopolitical.actions.back'), regions_path %>
23
+ </div>
24
+ </div>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
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') %></title>
7
+ <%= stylesheet_link_tag 'geopolitical/application', media: 'all' %>
8
+ <%= javascript_include_tag 'geopolitical/application' %>
9
+ <%= csrf_meta_tags %>
10
+ </head>
11
+ <body>
12
+ <nav>
13
+ <% [Nation, Region, City, Hood].each do |klass| %>
14
+ <%= link_to klass.model_name.human(count: 2), send("#{klass.to_s.downcase.pluralize}_path") %>
15
+ <% end %>
16
+ </nav>
17
+ <% if notice %>
18
+ <p class="notice"><%= notice %></p>
19
+ <% end %>
20
+ <% if alert %>
21
+ <p class="alert"><%= alert %></p>
22
+ <% end %>
23
+ <%= yield %>
24
+ </body>
25
+ </html>
data/geopolitical.gemspec CHANGED
@@ -16,11 +16,10 @@ Gem::Specification.new do |s|
16
16
 
17
17
  # Ship the engine (app, config, lib) and the docs. No specs, no dev tooling.
18
18
  s.files = `git ls-files -z`.split("\x0")
19
- .grep(%r{^(app|config|lib)/|^(README\.md|CHANGELOG\.md|MIT-LICENSE|geopolitical\.gemspec)$})
19
+ .grep(%r{^(app|config|lib)/|^(README\.md|CHANGELOG\.md|MIT-LICENSE|geopolitical\.gemspec)$})
20
20
  s.require_paths = ['lib']
21
21
  s.required_ruby_version = '>= 3.2.0'
22
22
 
23
- s.add_dependency 'haml', '>= 6.0'
24
23
  s.add_dependency 'mongoid', '>= 8.0.0'
25
- s.add_dependency 'mongoid-geospatial', '>= 4.0.0'
24
+ s.add_dependency 'mongoid-geospatial', '>= 7.0.0'
26
25
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'mongoid'
4
4
  require 'mongoid/geospatial'
5
- require 'haml'
6
5
 
7
6
  module Geopolitical
8
7
  # Rails Engine
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Geopolitical
4
- VERSION = '3.2.0'
4
+ VERSION = '4.1.0'
5
5
  end
data/lib/geopolitical.rb CHANGED
@@ -15,6 +15,15 @@ module Geopolitical
15
15
  # Geopolitical.parent_controller = 'Admin::BaseController'
16
16
  #
17
17
  mattr_accessor :parent_controller, default: 'ActionController::Base'
18
+
19
+ # The typing search behind Geopolitical::Postal.suggest / .pick — :google or
20
+ # :geoapify, and its key. Either unset and the search is off.
21
+ #
22
+ # Geopolitical.postal_provider = :google
23
+ # Geopolitical.postal_key = ENV['GOOGLE_MAPS_KEY']
24
+ #
25
+ mattr_accessor :postal_provider
26
+ mattr_accessor :postal_key
18
27
  end
19
28
 
20
29
  if Object.const_defined?('Rails')
@@ -27,4 +36,8 @@ else
27
36
  require_relative '../app/models/region'
28
37
  require_relative '../app/models/city'
29
38
  require_relative '../app/models/hood'
39
+ require_relative '../app/models/geopolitical/postal'
40
+ require_relative '../app/models/geopolitical/postal/brasilapi'
41
+ require_relative '../app/models/geopolitical/postal/google'
42
+ require_relative '../app/models/geopolitical/postal/geoapify'
30
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geopolitical
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos Piccinini
@@ -9,20 +9,6 @@ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
- - !ruby/object:Gem::Dependency
13
- name: haml
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - ">="
17
- - !ruby/object:Gem::Version
18
- version: '6.0'
19
- type: :runtime
20
- prerelease: false
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - ">="
24
- - !ruby/object:Gem::Version
25
- version: '6.0'
26
12
  - !ruby/object:Gem::Dependency
27
13
  name: mongoid
28
14
  requirement: !ruby/object:Gem::Requirement
@@ -43,14 +29,14 @@ dependencies:
43
29
  requirements:
44
30
  - - ">="
45
31
  - !ruby/object:Gem::Version
46
- version: 4.0.0
32
+ version: 7.0.0
47
33
  type: :runtime
48
34
  prerelease: false
49
35
  version_requirements: !ruby/object:Gem::Requirement
50
36
  requirements:
51
37
  - - ">="
52
38
  - !ruby/object:Gem::Version
53
- version: 4.0.0
39
+ version: 7.0.0
54
40
  description: 'The whole planet as four Mongoid models: hierarchy, i18n names, unicode-safe
55
41
  slugs, geo queries, phone/postal fallbacks and an admin engine.'
56
42
  email:
@@ -75,37 +61,41 @@ files:
75
61
  - app/helpers/geopolitical/application_helper.rb
76
62
  - app/models/city.rb
77
63
  - app/models/concerns/geopolitocracy.rb
64
+ - app/models/geopolitical/postal.rb
65
+ - app/models/geopolitical/postal/brasilapi.rb
66
+ - app/models/geopolitical/postal/geoapify.rb
67
+ - app/models/geopolitical/postal/google.rb
78
68
  - app/models/hood.rb
79
69
  - app/models/nation.rb
80
70
  - app/models/region.rb
81
- - app/views/geopolitical/cities/_city.html.haml
82
- - app/views/geopolitical/cities/_form.html.haml
83
- - app/views/geopolitical/cities/edit.html.haml
84
- - app/views/geopolitical/cities/index.html.haml
85
- - app/views/geopolitical/cities/new.html.haml
86
- - app/views/geopolitical/cities/show.html.haml
87
- - app/views/geopolitical/geopolitical/edit.html.haml
88
- - app/views/geopolitical/geopolitical/index.html.haml
89
- - app/views/geopolitical/geopolitical/new.html.haml
90
- - app/views/geopolitical/hoods/_city.html.haml
91
- - app/views/geopolitical/hoods/_form.html.haml
92
- - app/views/geopolitical/hoods/edit.html.haml
93
- - app/views/geopolitical/hoods/index.html.haml
94
- - app/views/geopolitical/hoods/new.html.haml
95
- - app/views/geopolitical/hoods/show.html.haml
96
- - app/views/geopolitical/nations/_form.html.haml
97
- - app/views/geopolitical/nations/_nation.html.haml
98
- - app/views/geopolitical/nations/edit.html.haml
99
- - app/views/geopolitical/nations/index.html.haml
100
- - app/views/geopolitical/nations/new.html.haml
101
- - app/views/geopolitical/nations/show.html.haml
102
- - app/views/geopolitical/regions/_form.html.haml
103
- - app/views/geopolitical/regions/_region.html.haml
104
- - app/views/geopolitical/regions/edit.html.haml
105
- - app/views/geopolitical/regions/index.html.haml
106
- - app/views/geopolitical/regions/new.html.haml
107
- - app/views/geopolitical/regions/show.html.haml
108
- - app/views/layouts/geopolitical.html.haml
71
+ - app/views/geopolitical/cities/_city.html.erb
72
+ - app/views/geopolitical/cities/_form.html.erb
73
+ - app/views/geopolitical/cities/edit.html.erb
74
+ - app/views/geopolitical/cities/index.html.erb
75
+ - app/views/geopolitical/cities/new.html.erb
76
+ - app/views/geopolitical/cities/show.html.erb
77
+ - app/views/geopolitical/geopolitical/edit.html.erb
78
+ - app/views/geopolitical/geopolitical/index.html.erb
79
+ - app/views/geopolitical/geopolitical/new.html.erb
80
+ - app/views/geopolitical/hoods/_city.html.erb
81
+ - app/views/geopolitical/hoods/_form.html.erb
82
+ - app/views/geopolitical/hoods/edit.html.erb
83
+ - app/views/geopolitical/hoods/index.html.erb
84
+ - app/views/geopolitical/hoods/new.html.erb
85
+ - app/views/geopolitical/hoods/show.html.erb
86
+ - app/views/geopolitical/nations/_form.html.erb
87
+ - app/views/geopolitical/nations/_nation.html.erb
88
+ - app/views/geopolitical/nations/edit.html.erb
89
+ - app/views/geopolitical/nations/index.html.erb
90
+ - app/views/geopolitical/nations/new.html.erb
91
+ - app/views/geopolitical/nations/show.html.erb
92
+ - app/views/geopolitical/regions/_form.html.erb
93
+ - app/views/geopolitical/regions/_region.html.erb
94
+ - app/views/geopolitical/regions/edit.html.erb
95
+ - app/views/geopolitical/regions/index.html.erb
96
+ - app/views/geopolitical/regions/new.html.erb
97
+ - app/views/geopolitical/regions/show.html.erb
98
+ - app/views/layouts/geopolitical.html.erb
109
99
  - config/locales/geopolitical.en.yml
110
100
  - config/locales/geopolitical.pt.yml
111
101
  - config/routes.rb
@@ -1,4 +0,0 @@
1
- .city
2
- %h4= link_to city.name, city_path(city)
3
- .right
4
- = link_to t('geopolitical.actions.edit'), edit_city_path(city)
@@ -1,28 +0,0 @@
1
- .container
2
- .row
3
- .page-header
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')
@@ -1 +0,0 @@
1
- = render 'form'
@@ -1,32 +0,0 @@
1
- .container
2
- .row
3
- .page-header
4
- %h1.title= City.model_name.human(count: 2)
5
- = link_to t('geopolitical.actions.new', model: City.model_name.human), new_city_path
6
- .row
7
- .content
8
- %table.table
9
- %thead
10
- %tr
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)
16
- %th
17
- %tbody
18
- - @cities.each do |city|
19
- %tr
20
- %td
21
- = city.name
22
- = link_to city.slug, city_path(city)
23
- %td= city.postal
24
- %td= city.region&.name
25
- %td= city.nation&.name
26
- %td= city.souls
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) }
31
- .row
32
- = link_to t('geopolitical.actions.back'), root_path
@@ -1 +0,0 @@
1
- = render 'form'
@@ -1,17 +0,0 @@
1
- .container
2
- .row
3
- %h1= @city.name
4
- .row
5
- %p
6
- %b #{City.human_attribute_name(:slug)}:
7
- = @city.slug
8
- %p
9
- %b #{City.human_attribute_name(:nation_id)}:
10
- = link_to @city.nation, nation_path(@city.nation) if @city.nation
11
- %p
12
- %b #{City.human_attribute_name(:region_id)}:
13
- = link_to @city.region, region_path(@city.region) if @city.region
14
- .row
15
- = link_to t('geopolitical.actions.edit'), edit_city_path(@city)
16
- |
17
- = link_to t('geopolitical.actions.back'), cities_path
@@ -1 +0,0 @@
1
- = render "form"
@@ -1,19 +0,0 @@
1
- %h1= t('geopolitical.title')
2
- %hr
3
-
4
- - [Nation, Region, City, Hood].each do |klass|
5
- .block
6
- %h3.title
7
- = link_to klass.model_name.human(count: 2), send("#{klass.to_s.downcase.pluralize}_path")
8
- %small= klass.count
9
- .right.links
10
- = link_to t('geopolitical.actions.new', model: klass.model_name.human),
11
- send("new_#{klass.to_s.downcase}_path")
12
-
13
- %br
14
- %h4
15
- = t('geopolitical.dashboard.populate')
16
- %small= link_to 'geonames_local', 'https://github.com/nofxx/geonames_local'
17
-
18
- %hr
19
- %p= link_to 'fireho/geopolitical', 'https://github.com/fireho/geopolitical'
@@ -1 +0,0 @@
1
- = render "form"
@@ -1,4 +0,0 @@
1
- .hood
2
- %h4= link_to hood.name, hood_path(hood)
3
- .right
4
- = link_to t('geopolitical.actions.edit'), edit_hood_path(hood)