geopolitical 0.8.0 → 0.8.1

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
  SHA1:
3
- metadata.gz: c55a764fadc3fe399215272245cfec87b13cbd26
4
- data.tar.gz: 9123f029747d1ea441bb3e2ea727c453814d2da0
3
+ metadata.gz: c839075fc478bd86ac981d8de6663d082edb3eae
4
+ data.tar.gz: 3e661f747bf2998c4878302f409bf5cf34acca6a
5
5
  SHA512:
6
- metadata.gz: 8939c9fed0774622aa082854fae5aabc23155838019dfc979e74b4179e4befd9c605c71f796591b164eba762a442d1b63c402966ef9f71b2eb034f6f7071e990
7
- data.tar.gz: 55d7c0149c46244807ce238bb2fc27db2387a39b458411e0a308f42b7bcf28a437b2985fd50b13fdc4b58db97cb30ae8eeba2cda5d3787f105f99406b1694190
6
+ metadata.gz: 969e0608da36268ece8f032962d79aabcfc261ab7873dc18a90bd76c79e586ff5db8af0d88e1f14c10166762da0ae4f885128b60cce0c8ce0419ce100b5bf882
7
+ data.tar.gz: 191cfd245bc863f4fab038bf60abd36490a3b6cd4f2e5a3829155371aba9208691b529be1eef363746332f9d10a413b3b2dc8f515904ac0b333a806086a3d8da
@@ -1,7 +1,7 @@
1
1
  module Geopolitical
2
2
  class RegionsController < GeopoliticalController
3
3
  inherit_resources
4
- before_filter :get_relatives, :only => [:new, :edit]
4
+ before_filter :get_relatives, :only => [:new, :edit, :create, :update]
5
5
 
6
6
  def collection
7
7
  @regions = Region.ordered.page(params[:page])
@@ -10,7 +10,7 @@ module Geopolitical
10
10
  private
11
11
 
12
12
  def get_relatives
13
- @nations = Nation.all
13
+ @nations = Nation.all.map { |n| [n.name, n.id] }
14
14
  end
15
15
 
16
16
  end
data/app/models/city.rb CHANGED
@@ -4,10 +4,10 @@ class City
4
4
  include Geopolitical::Helpers
5
5
 
6
6
  field :gid, type: Integer
7
+ field :zip, type: String
7
8
  field :slug, type: String
8
9
  field :name, type: String, localize: true
9
10
  field :area, type: Integer
10
- field :zip, type: Integer
11
11
  field :souls, type: Integer
12
12
  field :geom, type: Point, spatial: true
13
13
  # field :ascii, type: String
data/app/models/region.rb CHANGED
@@ -15,9 +15,8 @@ class Region
15
15
  scope :ordered, order_by(name: 1)
16
16
 
17
17
  validates :nation, presence: true
18
- validates :name, presence: true
18
+ validates :name, presence: true, uniqueness: { :scope => :nation_id }
19
19
 
20
- validates :name, uniqueness: { :scope => :nation_id }
21
20
 
22
21
 
23
22
  end
@@ -10,6 +10,7 @@
10
10
  %thead
11
11
  %tr
12
12
  %th Nome
13
+ %th ZIP
13
14
  %th Region
14
15
  %th Nation
15
16
  %th Population
@@ -20,6 +21,7 @@
20
21
  %td
21
22
  = city.name
22
23
  = link_to city.slug , city
24
+ %td= city.zip
23
25
  %td= city.region.name if city.region
24
26
  %td= city.nation.name
25
27
  %td= city.souls
@@ -12,6 +12,7 @@
12
12
  %th Abbr
13
13
  %th ISO
14
14
  %th Name
15
+ %th Postal
15
16
  %th Lang
16
17
  %th Cash
17
18
  %th
@@ -25,7 +26,8 @@
25
26
  %td
26
27
  = nation.name
27
28
  = link_to nation.slug, nation
28
- %td= nation.lang
29
+ %td= nation.zip
30
+ %td= truncate(nation.lang)
29
31
  %td= nation.cash
30
32
  %td.last
31
33
  =# link_to "Destroy!", nation_path(nation), :method => :delete
@@ -5,7 +5,8 @@
5
5
  .row
6
6
 
7
7
  = form_for(@region) do |f|
8
- =# f.error_messages
8
+ - f.object.errors.each do |err|
9
+ = err
9
10
  .form-group
10
11
  = f.label :name
11
12
  = f.text_field :name
@@ -1,3 +1,4 @@
1
+ require 'mongoid_geospatial'
1
2
  require 'inherited_resources'
2
3
 
3
4
  module Geopolitical
@@ -16,7 +16,8 @@ module Geopolitical
16
16
 
17
17
  def slug= txt
18
18
  return unless txt
19
- self[:slug] = txt.downcase.gsub(/\s/, '-') #.gsub(/\W/, '')
19
+ self[:slug] = txt.encode(Encoding::ISO_8859_1).
20
+ gsub(/\s/, '-').downcase
20
21
  end
21
22
 
22
23
  end
@@ -1,3 +1,3 @@
1
1
  module Geopolitical
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  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: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos Piccinini
@@ -160,7 +160,6 @@ files:
160
160
  - app/controllers/geopolitical/nations_controller.rb
161
161
  - app/controllers/geopolitical/zones_controller.rb
162
162
  - app/controllers/geopolitical/cities_controller.rb
163
- - app/controllers/zones_controller.rb
164
163
  - app/models/zone_member.rb
165
164
  - app/models/city.rb
166
165
  - app/models/address.rb
@@ -1,17 +0,0 @@
1
- module Geopolitical
2
- class RegionsController < GeopoliticalController
3
- inherit_resources
4
- before_filter :get_relatives, :only => [:new, :edit]
5
-
6
- def collection
7
- @regions = Region.ordered.page(params[:page])
8
- end
9
-
10
- private
11
-
12
- def get_relatives
13
- @nations = Nation.all
14
- end
15
-
16
- end
17
- end