geopolitical 0.0.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +1 -1
- data/README.md +24 -0
- data/Rakefile +3 -20
- data/app/assets/javascripts/geopolitical/application.js +3 -5
- data/app/assets/stylesheets/geopolitical/application.css +1 -1
- data/app/controllers/geopolitical/cities_controller.rb +4 -3
- data/app/controllers/geopolitical/geopolitical_controller.rb +12 -3
- data/app/controllers/geopolitical/hoods_controller.rb +8 -2
- data/app/controllers/geopolitical/nations_controller.rb +16 -0
- data/app/controllers/geopolitical/{provinces_controller.rb → regions_controller.rb} +4 -3
- data/app/controllers/geopolitical/zones_controller.rb +12 -0
- data/app/controllers/zones_controller.rb +17 -0
- data/app/models/address.rb +65 -0
- data/app/models/city.rb +28 -29
- data/app/models/hood.rb +9 -11
- data/app/models/nation.rb +24 -0
- data/app/models/region.rb +23 -0
- data/app/models/zone.rb +25 -0
- data/app/models/zone_member.rb +9 -0
- data/app/views/geopolitical/cities/_form.html.haml +11 -10
- data/app/views/geopolitical/cities/index.html.haml +32 -30
- data/app/views/geopolitical/cities/show.html.haml +17 -26
- data/app/views/geopolitical/geopolitical/edit.html.haml +1 -0
- data/app/views/geopolitical/geopolitical/index.html.haml +19 -22
- data/app/views/geopolitical/geopolitical/new.html.haml +1 -0
- data/app/views/geopolitical/hoods/_city.html.haml +7 -0
- data/app/views/geopolitical/hoods/_form.html.haml +27 -0
- data/app/views/geopolitical/hoods/index.html.haml +33 -0
- data/app/views/geopolitical/hoods/show.html.haml +14 -0
- data/app/views/geopolitical/nations/_form.html.haml +26 -0
- data/app/views/geopolitical/nations/_nation.html.haml +0 -0
- data/app/views/geopolitical/nations/index.html.haml +34 -0
- data/app/views/geopolitical/nations/show.html.haml +20 -0
- data/app/views/geopolitical/regions/_form.html.haml +23 -0
- data/app/views/geopolitical/regions/_region.html.haml +7 -0
- data/app/views/geopolitical/regions/index.html.haml +31 -0
- data/app/views/geopolitical/regions/show.html.haml +17 -0
- data/app/views/geopolitical/zones/_form.html.haml +23 -0
- data/app/views/geopolitical/zones/_region.html.haml +7 -0
- data/app/views/geopolitical/zones/index.html.haml +31 -0
- data/app/views/geopolitical/zones/show.html.haml +21 -0
- data/app/views/layouts/geopolitical.html.haml +20 -0
- data/config/routes.rb +5 -4
- data/lib/geopolitical/engine.rb +2 -2
- data/lib/geopolitical/helpers.rb +23 -0
- data/lib/geopolitical/version.rb +1 -1
- data/lib/geopolitical.rb +4 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +27 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/mongoid.yml +13 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/log/test.log +2111 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/fabricators/city_fabricator.rb +6 -0
- data/spec/fabricators/hood_fabricator.rb +6 -0
- data/spec/fabricators/nation_fabricator.rb +4 -0
- data/spec/fabricators/region_fabricator.rb +5 -0
- data/spec/models/city_spec.rb +98 -0
- data/spec/models/hood_spec.rb +16 -0
- data/spec/models/nation_spec.rb +12 -0
- data/spec/models/region_spec.rb +12 -0
- data/spec/spec_helper.rb +54 -0
- metadata +198 -42
- data/README.rdoc +0 -3
- data/app/controllers/geopolitical/countries_controller.rb +0 -10
- data/app/models/country.rb +0 -20
- data/app/models/province.rb +0 -17
- data/app/views/geopolitical/cities/edit.html.haml +0 -1
- data/app/views/geopolitical/cities/new.html.haml +0 -1
- data/app/views/geopolitical/countries/_country.html.haml +0 -11
- data/app/views/geopolitical/countries/edit.html.haml +0 -7
- data/app/views/geopolitical/countries/index.html.haml +0 -28
- data/app/views/geopolitical/countries/new.html.haml +0 -5
- data/app/views/geopolitical/countries/show.html.haml +0 -10
- data/app/views/geopolitical/provinces/_province.html.haml +0 -7
- data/app/views/geopolitical/provinces/edit.html.haml +0 -7
- data/app/views/geopolitical/provinces/index.html.haml +0 -18
- data/app/views/geopolitical/provinces/new.html.haml +0 -5
- data/app/views/geopolitical/provinces/show.html.haml +0 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c55a764fadc3fe399215272245cfec87b13cbd26
|
4
|
+
data.tar.gz: 9123f029747d1ea441bb3e2ea727c453814d2da0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8939c9fed0774622aa082854fae5aabc23155838019dfc979e74b4179e4befd9c605c71f796591b164eba762a442d1b63c402966ef9f71b2eb034f6f7071e990
|
7
|
+
data.tar.gz: 55d7c0149c46244807ce238bb2fc27db2387a39b458411e0a308f42b7bcf28a437b2985fd50b13fdc4b58db97cb30ae8eeba2cda5d3787f105f99406b1694190
|
data/MIT-LICENSE
CHANGED
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Geopolitical
|
2
|
+
============
|
3
|
+
|
4
|
+
[![Code Climate](https://codeclimate.com/github/fireho/geopolitical.png)](https://codeclimate.com/github/fireho/geopolitical)
|
5
|
+
[![Build Status](https://travis-ci.org/fireho/geopolitical.png)](https://travis-ci.org/fireho/geopolitical)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
Geopolitical models ready to use!
|
10
|
+
|
11
|
+
Use
|
12
|
+
---
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
Populate
|
17
|
+
--------
|
18
|
+
|
19
|
+
Use Geonames_local to populate data easily!
|
20
|
+
"geonames_local"(https://github.com/fireho/geonames_local)
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
This project rocks and uses MIT-LICENSE.
|
data/Rakefile
CHANGED
@@ -1,16 +1,10 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
1
|
begin
|
3
2
|
require 'bundler/setup'
|
4
3
|
rescue LoadError
|
5
4
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
5
|
end
|
7
|
-
|
8
|
-
|
9
|
-
rescue LoadError
|
10
|
-
require 'rdoc/rdoc'
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
RDoc::Task = Rake::RDocTask
|
13
|
-
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
14
8
|
|
15
9
|
RDoc::Task.new(:rdoc) do |rdoc|
|
16
10
|
rdoc.rdoc_dir = 'rdoc'
|
@@ -20,21 +14,10 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
20
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
15
|
end
|
22
16
|
|
23
|
-
APP_RAKEFILE = File.expand_path("../
|
17
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
24
18
|
load 'rails/tasks/engine.rake'
|
25
19
|
|
26
20
|
|
27
21
|
|
28
22
|
Bundler::GemHelper.install_tasks
|
29
23
|
|
30
|
-
#require 'rake/testtask'
|
31
|
-
|
32
|
-
#Rake::TestTask.new(:test) do |t|
|
33
|
-
# t.libs << 'lib'
|
34
|
-
# t.libs << 'test'
|
35
|
-
# t.pattern = 'test/**/*_test.rb'
|
36
|
-
# t.verbose = false
|
37
|
-
#end
|
38
|
-
|
39
|
-
|
40
|
-
#task :default => :test
|
@@ -5,11 +5,9 @@
|
|
5
5
|
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
6
|
//
|
7
7
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
//
|
8
|
+
// compiled file.
|
9
9
|
//
|
10
|
-
//
|
11
|
-
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
12
|
//
|
13
|
-
//= require jquery
|
14
|
-
//= require jquery_ujs
|
15
13
|
//= require_tree .
|
@@ -1,10 +1,11 @@
|
|
1
1
|
module Geopolitical
|
2
|
-
class CitiesController <
|
2
|
+
class CitiesController < GeopoliticalController
|
3
3
|
# allow "admin"
|
4
|
+
inherit_resources
|
4
5
|
before_filter :load_relatives, :only => [:new, :edit, :create, :update]
|
5
6
|
|
6
7
|
def collection
|
7
|
-
City.ordered.search(params[:search]
|
8
|
+
@cities = City.ordered.search(params[:search]).page(params[:page]) # @cc.nation.cities
|
8
9
|
end
|
9
10
|
|
10
11
|
private
|
@@ -16,7 +17,7 @@ module Geopolitical
|
|
16
17
|
end
|
17
18
|
|
18
19
|
def load_relatives
|
19
|
-
@
|
20
|
+
@regions = Region.only(:name).map {|e| [e.name,e.id]}
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
@@ -1,12 +1,21 @@
|
|
1
1
|
module Geopolitical
|
2
|
-
class GeopoliticalController <
|
3
|
-
|
2
|
+
class GeopoliticalController < ActionController::Base
|
3
|
+
|
4
|
+
layout 'geopolitical'
|
4
5
|
|
5
6
|
def index
|
6
|
-
@
|
7
|
+
@regions = Region.all
|
7
8
|
@cities = City.all
|
8
9
|
end
|
9
10
|
|
10
11
|
|
12
|
+
private
|
13
|
+
|
14
|
+
def permitted_params
|
15
|
+
params.permit!
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
|
11
20
|
end
|
12
21
|
end
|
@@ -1,12 +1,18 @@
|
|
1
1
|
module Geopolitical
|
2
|
-
class HoodsController <
|
2
|
+
class HoodsController < GeopoliticalController
|
3
3
|
inherit_resources
|
4
4
|
# belongs_to :city
|
5
5
|
# respond_to :html, :xml, :json
|
6
|
+
before_filter :load_relatives, :only => [:new, :edit, :create, :update]
|
6
7
|
|
7
8
|
def collection
|
8
|
-
@hoods = Hood.ordered.
|
9
|
+
@hoods = Hood.ordered.page(params[:page])
|
9
10
|
end
|
10
11
|
|
12
|
+
private
|
13
|
+
|
14
|
+
def load_relatives
|
15
|
+
@cities = City.only(:name).map {|e| [e.name,e.id]}
|
16
|
+
end
|
11
17
|
end
|
12
18
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Geopolitical
|
2
|
+
class NationsController < GeopoliticalController
|
3
|
+
inherit_resources
|
4
|
+
|
5
|
+
def collection
|
6
|
+
@nations = Nation.ordered #.page(params[:page])
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
# def permitted_params
|
12
|
+
# params.permit! #require(:nation).permit!
|
13
|
+
# end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -1,16 +1,17 @@
|
|
1
1
|
module Geopolitical
|
2
|
-
class
|
2
|
+
class RegionsController < GeopoliticalController
|
3
3
|
inherit_resources
|
4
4
|
before_filter :get_relatives, :only => [:new, :edit]
|
5
5
|
|
6
6
|
def collection
|
7
|
-
@
|
7
|
+
@regions = Region.ordered.page(params[:page])
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
11
11
|
|
12
12
|
def get_relatives
|
13
|
-
@
|
13
|
+
@nations = Nation.all
|
14
14
|
end
|
15
|
+
|
15
16
|
end
|
16
17
|
end
|
@@ -0,0 +1,17 @@
|
|
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
|
@@ -0,0 +1,65 @@
|
|
1
|
+
class Address
|
2
|
+
include Mongoid::Document
|
3
|
+
# include Mongoid::Symbolize
|
4
|
+
include Mongoid::Timestamps
|
5
|
+
include Mongoid::Geospatial
|
6
|
+
|
7
|
+
field :zip, type: String
|
8
|
+
field :name, type: String
|
9
|
+
field :title, type: String
|
10
|
+
field :number, type: String
|
11
|
+
field :extra, type: String
|
12
|
+
field :info, type: String
|
13
|
+
|
14
|
+
field :geom, type: Point
|
15
|
+
|
16
|
+
field :hood_name, type: String
|
17
|
+
field :city_name, type: String
|
18
|
+
field :region_name, type: String
|
19
|
+
field :nation_name, type: String
|
20
|
+
|
21
|
+
embedded_in :addressable, polymorphic: true
|
22
|
+
|
23
|
+
belongs_to :nation
|
24
|
+
belongs_to :region
|
25
|
+
belongs_to :city
|
26
|
+
belongs_to :hood
|
27
|
+
|
28
|
+
validates :name, presence: true
|
29
|
+
|
30
|
+
def print_location
|
31
|
+
"#{hood_name} #{city_name} - #{region_name} "
|
32
|
+
end
|
33
|
+
|
34
|
+
def print_full_location
|
35
|
+
print_location + nation_name
|
36
|
+
end
|
37
|
+
|
38
|
+
def geom
|
39
|
+
g = super
|
40
|
+
unless g
|
41
|
+
self.geom = '0,0'
|
42
|
+
return super
|
43
|
+
end
|
44
|
+
g
|
45
|
+
end
|
46
|
+
|
47
|
+
def geom=(data)
|
48
|
+
self[:geom] = data.split(',')
|
49
|
+
end
|
50
|
+
|
51
|
+
def form_geom
|
52
|
+
"#{geom.try(:x)},#{geom.try(:y)}"
|
53
|
+
end
|
54
|
+
|
55
|
+
def form_geom=(data)
|
56
|
+
self.geom = data
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_s
|
60
|
+
"#{name} #{number}" + print_location
|
61
|
+
end
|
62
|
+
#index tie_id: 1, created_at: -1
|
63
|
+
# symbolize :kind, :in => [:street, :avenue, :road], default: :street
|
64
|
+
|
65
|
+
end
|
data/app/models/city.rb
CHANGED
@@ -1,54 +1,53 @@
|
|
1
1
|
class City
|
2
2
|
include Mongoid::Document
|
3
3
|
include Mongoid::Geospatial
|
4
|
+
include Geopolitical::Helpers
|
4
5
|
|
5
|
-
|
6
|
+
field :gid, type: Integer
|
7
|
+
field :slug, type: String
|
8
|
+
field :name, type: String, localize: true
|
9
|
+
field :area, type: Integer
|
10
|
+
field :zip, type: Integer
|
11
|
+
field :souls, type: Integer
|
12
|
+
field :geom, type: Point, spatial: true
|
13
|
+
# field :ascii, type: String
|
6
14
|
|
7
|
-
|
8
|
-
field :name
|
9
|
-
field :area
|
10
|
-
field :gid, type: Integer
|
11
|
-
field :zip, type: Integer
|
12
|
-
field :souls, type: Integer
|
13
|
-
field :geom, type: Point, spatial: true
|
15
|
+
spatial_scope :geom
|
14
16
|
|
15
|
-
|
16
|
-
index :slug
|
17
|
-
spatial_index :geom
|
17
|
+
attr_writer :x, :y, :z
|
18
18
|
|
19
|
-
belongs_to :
|
20
|
-
belongs_to :
|
19
|
+
belongs_to :region
|
20
|
+
belongs_to :nation
|
21
21
|
has_many :hoods
|
22
22
|
|
23
|
-
before_validation :set_defaults
|
24
23
|
|
25
|
-
|
26
|
-
validates_uniqueness_of :name, :scope => :province_id
|
24
|
+
index name: 1
|
27
25
|
|
28
|
-
|
26
|
+
scope :ordered, order_by(name: 1)
|
29
27
|
|
30
|
-
|
28
|
+
validates :slug, presence: true, uniqueness: true
|
29
|
+
validates :name, uniqueness: { :scope => :region_id }
|
30
|
+
|
31
|
+
# scope :close_to, GeoHelper::CLOSE
|
32
|
+
|
33
|
+
before_validation :set_defaults
|
31
34
|
|
32
|
-
def abbr
|
33
|
-
province ? province.abbr : country.abbr
|
34
|
-
end
|
35
35
|
|
36
36
|
def set_defaults
|
37
|
-
self.
|
38
|
-
self.slug ||= name.try(:downcase) # don't use slugize
|
37
|
+
self.nation ||= region.try(:nation)
|
39
38
|
end
|
40
39
|
|
41
|
-
def
|
42
|
-
|
43
|
-
cities.page(page)
|
40
|
+
def abbr
|
41
|
+
region ? region.abbr : nation.abbr
|
44
42
|
end
|
45
43
|
|
46
|
-
def self.
|
47
|
-
|
44
|
+
def self.search txt
|
45
|
+
where(slug: /#{txt}/i)
|
48
46
|
end
|
49
47
|
|
50
48
|
def <=> other
|
51
|
-
self.
|
49
|
+
self.slug <=> other.slug
|
52
50
|
end
|
53
51
|
|
52
|
+
|
54
53
|
end
|
data/app/models/hood.rb
CHANGED
@@ -1,23 +1,21 @@
|
|
1
1
|
class Hood
|
2
2
|
include Mongoid::Document
|
3
|
-
include Mongoid::Timestamps
|
4
3
|
|
5
|
-
field :
|
4
|
+
field :gid, type: Integer
|
5
|
+
field :slug, type: String
|
6
|
+
field :name, type: String, localize: true
|
6
7
|
field :souls, type: Integer
|
7
8
|
field :zip, type: Integer
|
8
9
|
field :rank, type: Integer
|
9
|
-
field :zip, type: Integer
|
10
10
|
|
11
|
-
belongs_to :city
|
11
|
+
belongs_to :city
|
12
12
|
|
13
|
-
validates
|
13
|
+
validates :city, :name, presence: true
|
14
14
|
|
15
|
-
|
16
|
-
cities = search ? where(:field => /#{search}/i) : all
|
17
|
-
cities.page(page)
|
18
|
-
end
|
15
|
+
scope :ordered, order_by(name: 1)
|
19
16
|
|
20
|
-
def
|
21
|
-
|
17
|
+
def to_s
|
18
|
+
name || slug
|
22
19
|
end
|
20
|
+
|
23
21
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class Nation
|
2
|
+
include Mongoid::Document
|
3
|
+
include Geopolitical::Helpers
|
4
|
+
|
5
|
+
field :gid, type: Integer # geonames id
|
6
|
+
field :slug, type: String
|
7
|
+
field :name, type: String, localize: true
|
8
|
+
field :abbr, type: String
|
9
|
+
field :code # optional phone/whatever code
|
10
|
+
field :zip, type: String
|
11
|
+
field :cash, type: String
|
12
|
+
field :lang, type: String
|
13
|
+
|
14
|
+
has_many :regions, :dependent => :destroy
|
15
|
+
has_many :cities, :dependent => :destroy
|
16
|
+
|
17
|
+
scope :ordered, order_by(name: 1)
|
18
|
+
|
19
|
+
validates :slug, :abbr, uniqueness: true, presence: true
|
20
|
+
|
21
|
+
alias :currency :cash
|
22
|
+
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class Region
|
2
|
+
include Mongoid::Document
|
3
|
+
include Geopolitical::Helpers
|
4
|
+
|
5
|
+
field :gid, type: Integer # geonames id
|
6
|
+
field :slug, type: String
|
7
|
+
field :name, type: String, localize: true
|
8
|
+
field :abbr, type: String
|
9
|
+
field :codes, type: Array # phone codes
|
10
|
+
|
11
|
+
belongs_to :nation
|
12
|
+
|
13
|
+
has_many :cities, :dependent => :destroy
|
14
|
+
|
15
|
+
scope :ordered, order_by(name: 1)
|
16
|
+
|
17
|
+
validates :nation, presence: true
|
18
|
+
validates :name, presence: true
|
19
|
+
|
20
|
+
validates :name, uniqueness: { :scope => :nation_id }
|
21
|
+
|
22
|
+
|
23
|
+
end
|
data/app/models/zone.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
class Zone
|
2
|
+
include Mongoid::Document
|
3
|
+
|
4
|
+
field :gid, type: Integer # geonames id
|
5
|
+
field :slug, type: String
|
6
|
+
field :name, type: String, localize: true
|
7
|
+
field :abbr, type: String
|
8
|
+
field :kind, type: String
|
9
|
+
|
10
|
+
has_many :zone_members, :dependent => :destroy
|
11
|
+
|
12
|
+
scope :ordered, order_by(name: 1)
|
13
|
+
|
14
|
+
validates :name, presence: true, uniqueness: true
|
15
|
+
|
16
|
+
|
17
|
+
def members
|
18
|
+
zone_members.map(&:member)
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_s
|
22
|
+
name
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -1,20 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
= @city.new_record? ? "Nova Cidade" : "Editando Cidade"
|
1
|
+
.container
|
2
|
+
.row
|
3
|
+
.page-header
|
4
|
+
%h1= @city.new_record? ? "Nova Cidade" : "Editando Cidade"
|
5
5
|
.container_16
|
6
|
-
.box.
|
6
|
+
.box.secondary.shadow
|
7
7
|
= form_for(@city, :html => {:class => "form"}) do |f|
|
8
|
+
- f.object.errors.each do |err|
|
9
|
+
= err
|
8
10
|
.grid_3
|
9
11
|
=# hidden_field_tag 'city_geom_xy', @city.ll, :name => "city[xy]", :class => "geom_xy"
|
10
12
|
=# hidden_field_tag 'city_geom_y', @city.y, :name => "city[y]", :class => "geom_y"
|
11
13
|
=# hidden_field_tag 'city_geom_z', @city.z, :name => "city[z]", :class => "geom_z"
|
12
14
|
|
13
|
-
.
|
15
|
+
.forms_btns
|
14
16
|
.citydata
|
15
17
|
.field{"data-role" => "fieldcontain"}
|
16
|
-
= f.label :
|
17
|
-
= f.select :
|
18
|
+
= f.label :region
|
19
|
+
= f.select :region_id, @regions
|
18
20
|
.group
|
19
21
|
= f.label :name
|
20
22
|
= f.text_field :name, :size => 30
|
@@ -24,7 +26,6 @@
|
|
24
26
|
.field
|
25
27
|
= f.label :souls
|
26
28
|
= f.text_field :souls, :size => 30
|
27
|
-
=
|
29
|
+
= f.submit
|
28
30
|
.grid_8
|
29
31
|
#map=# gmaps(@map, false, false)
|
30
|
-
.clear
|
@@ -1,31 +1,33 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
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
|
-
= link_to 'Voltar', "/", :class => 'icon back'
|
30
|
-
|
1
|
+
.container
|
2
|
+
.row
|
3
|
+
.page-header
|
4
|
+
%h1.title Cities
|
5
|
+
=# render "shared/filter"
|
6
|
+
= link_to "New City", new_city_path
|
7
|
+
.row
|
8
|
+
.content
|
9
|
+
%table.table
|
10
|
+
%thead
|
11
|
+
%tr
|
12
|
+
%th Nome
|
13
|
+
%th Region
|
14
|
+
%th Nation
|
15
|
+
%th Population
|
16
|
+
%th
|
17
|
+
%tbody
|
18
|
+
- for city in @cities
|
19
|
+
%tr
|
20
|
+
%td
|
21
|
+
= city.name
|
22
|
+
= link_to city.slug , city
|
23
|
+
%td= city.region.name if city.region
|
24
|
+
%td= city.nation.name
|
25
|
+
%td= city.souls
|
26
|
+
%td{:align => 'right'}
|
27
|
+
= link_to 'Edit', edit_city_path(city)
|
28
|
+
= link_to 'Destroy', city, :confirm => 'Destroy city?', :method => :delete
|
31
29
|
|
30
|
+
.row
|
31
|
+
.pagination= paginate @cities
|
32
|
+
.row
|
33
|
+
= link_to 'Back', root_path
|
@@ -1,26 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
%
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
-# %p= @city.y
|
19
|
-
.grid_4
|
20
|
-
-# - @city.hoods.each do |hood|
|
21
|
-
-# %p= link_to hood.name, hood
|
22
|
-
.grid_8
|
23
|
-
-# .inner= gmaps(@map, false, false)
|
24
|
-
= link_to t(:back), cities_path
|
25
|
-
.clear
|
26
|
-
|
1
|
+
.container
|
2
|
+
.row
|
3
|
+
%h1= @city.name
|
4
|
+
.row
|
5
|
+
%p
|
6
|
+
%b Slug:
|
7
|
+
= @city.slug
|
8
|
+
%p
|
9
|
+
%b Nation:
|
10
|
+
= link_to @city.nation, @city.nation
|
11
|
+
%p
|
12
|
+
%b Region:
|
13
|
+
= link_to @city.region, @city.region
|
14
|
+
.row
|
15
|
+
= link_to 'Edit', edit_city_path(@city)
|
16
|
+
|
|
17
|
+
= link_to 'Back', cities_path
|
@@ -0,0 +1 @@
|
|
1
|
+
= render "form"
|