geopolitical 0.0.1 → 0.8.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 (106) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +24 -0
  4. data/Rakefile +3 -20
  5. data/app/assets/javascripts/geopolitical/application.js +3 -5
  6. data/app/assets/stylesheets/geopolitical/application.css +1 -1
  7. data/app/controllers/geopolitical/cities_controller.rb +4 -3
  8. data/app/controllers/geopolitical/geopolitical_controller.rb +12 -3
  9. data/app/controllers/geopolitical/hoods_controller.rb +8 -2
  10. data/app/controllers/geopolitical/nations_controller.rb +16 -0
  11. data/app/controllers/geopolitical/{provinces_controller.rb → regions_controller.rb} +4 -3
  12. data/app/controllers/geopolitical/zones_controller.rb +12 -0
  13. data/app/controllers/zones_controller.rb +17 -0
  14. data/app/models/address.rb +65 -0
  15. data/app/models/city.rb +28 -29
  16. data/app/models/hood.rb +9 -11
  17. data/app/models/nation.rb +24 -0
  18. data/app/models/region.rb +23 -0
  19. data/app/models/zone.rb +25 -0
  20. data/app/models/zone_member.rb +9 -0
  21. data/app/views/geopolitical/cities/_form.html.haml +11 -10
  22. data/app/views/geopolitical/cities/index.html.haml +32 -30
  23. data/app/views/geopolitical/cities/show.html.haml +17 -26
  24. data/app/views/geopolitical/geopolitical/edit.html.haml +1 -0
  25. data/app/views/geopolitical/geopolitical/index.html.haml +19 -22
  26. data/app/views/geopolitical/geopolitical/new.html.haml +1 -0
  27. data/app/views/geopolitical/hoods/_city.html.haml +7 -0
  28. data/app/views/geopolitical/hoods/_form.html.haml +27 -0
  29. data/app/views/geopolitical/hoods/index.html.haml +33 -0
  30. data/app/views/geopolitical/hoods/show.html.haml +14 -0
  31. data/app/views/geopolitical/nations/_form.html.haml +26 -0
  32. data/app/views/geopolitical/nations/_nation.html.haml +0 -0
  33. data/app/views/geopolitical/nations/index.html.haml +34 -0
  34. data/app/views/geopolitical/nations/show.html.haml +20 -0
  35. data/app/views/geopolitical/regions/_form.html.haml +23 -0
  36. data/app/views/geopolitical/regions/_region.html.haml +7 -0
  37. data/app/views/geopolitical/regions/index.html.haml +31 -0
  38. data/app/views/geopolitical/regions/show.html.haml +17 -0
  39. data/app/views/geopolitical/zones/_form.html.haml +23 -0
  40. data/app/views/geopolitical/zones/_region.html.haml +7 -0
  41. data/app/views/geopolitical/zones/index.html.haml +31 -0
  42. data/app/views/geopolitical/zones/show.html.haml +21 -0
  43. data/app/views/layouts/geopolitical.html.haml +20 -0
  44. data/config/routes.rb +5 -4
  45. data/lib/geopolitical/engine.rb +2 -2
  46. data/lib/geopolitical/helpers.rb +23 -0
  47. data/lib/geopolitical/version.rb +1 -1
  48. data/lib/geopolitical.rb +4 -0
  49. data/spec/dummy/README.rdoc +28 -0
  50. data/spec/dummy/Rakefile +6 -0
  51. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  52. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  53. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  54. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  55. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  56. data/spec/dummy/bin/bundle +3 -0
  57. data/spec/dummy/bin/rails +4 -0
  58. data/spec/dummy/bin/rake +4 -0
  59. data/spec/dummy/config/application.rb +27 -0
  60. data/spec/dummy/config/boot.rb +5 -0
  61. data/spec/dummy/config/environment.rb +5 -0
  62. data/spec/dummy/config/environments/development.rb +29 -0
  63. data/spec/dummy/config/environments/production.rb +80 -0
  64. data/spec/dummy/config/environments/test.rb +36 -0
  65. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  66. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  67. data/spec/dummy/config/initializers/inflections.rb +16 -0
  68. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  69. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  70. data/spec/dummy/config/initializers/session_store.rb +3 -0
  71. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  72. data/spec/dummy/config/locales/en.yml +23 -0
  73. data/spec/dummy/config/mongoid.yml +13 -0
  74. data/spec/dummy/config/routes.rb +4 -0
  75. data/spec/dummy/config.ru +4 -0
  76. data/spec/dummy/log/test.log +2111 -0
  77. data/spec/dummy/public/404.html +58 -0
  78. data/spec/dummy/public/422.html +58 -0
  79. data/spec/dummy/public/500.html +57 -0
  80. data/spec/dummy/public/favicon.ico +0 -0
  81. data/spec/fabricators/city_fabricator.rb +6 -0
  82. data/spec/fabricators/hood_fabricator.rb +6 -0
  83. data/spec/fabricators/nation_fabricator.rb +4 -0
  84. data/spec/fabricators/region_fabricator.rb +5 -0
  85. data/spec/models/city_spec.rb +98 -0
  86. data/spec/models/hood_spec.rb +16 -0
  87. data/spec/models/nation_spec.rb +12 -0
  88. data/spec/models/region_spec.rb +12 -0
  89. data/spec/spec_helper.rb +54 -0
  90. metadata +198 -42
  91. data/README.rdoc +0 -3
  92. data/app/controllers/geopolitical/countries_controller.rb +0 -10
  93. data/app/models/country.rb +0 -20
  94. data/app/models/province.rb +0 -17
  95. data/app/views/geopolitical/cities/edit.html.haml +0 -1
  96. data/app/views/geopolitical/cities/new.html.haml +0 -1
  97. data/app/views/geopolitical/countries/_country.html.haml +0 -11
  98. data/app/views/geopolitical/countries/edit.html.haml +0 -7
  99. data/app/views/geopolitical/countries/index.html.haml +0 -28
  100. data/app/views/geopolitical/countries/new.html.haml +0 -5
  101. data/app/views/geopolitical/countries/show.html.haml +0 -10
  102. data/app/views/geopolitical/provinces/_province.html.haml +0 -7
  103. data/app/views/geopolitical/provinces/edit.html.haml +0 -7
  104. data/app/views/geopolitical/provinces/index.html.haml +0 -18
  105. data/app/views/geopolitical/provinces/new.html.haml +0 -5
  106. 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
@@ -1,4 +1,4 @@
1
- Copyright 2012 YOURNAME
1
+ Copyright 2013 YOURNAME
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
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
- begin
8
- require 'rdoc/task'
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("../test/dummy/Rakefile", __FILE__)
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
- // the compiled file.
8
+ // compiled file.
9
9
  //
10
- // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
- // GO AFTER THE REQUIRES BELOW.
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 .
@@ -10,4 +10,4 @@
10
10
  *
11
11
  *= require_self
12
12
  *= require_tree .
13
- */
13
+ */
@@ -1,10 +1,11 @@
1
1
  module Geopolitical
2
- class CitiesController < ApplicationController
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], params[:page]) # @cc.country.cities
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
- @provinces = Province.only(:name).map {|e| [e.name,e.id]}
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 < ApplicationController
3
- # before_filter :require_
2
+ class GeopoliticalController < ActionController::Base
3
+
4
+ layout 'geopolitical'
4
5
 
5
6
  def index
6
- @provinces = Province.all
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 < ApplicationController
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.search(params[:search], params[:page])
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 ProvincesController < ApplicationController
2
+ class RegionsController < GeopoliticalController
3
3
  inherit_resources
4
4
  before_filter :get_relatives, :only => [:new, :edit]
5
5
 
6
6
  def collection
7
- @provinces = Province.ordered.page(params[:page])
7
+ @regions = Region.ordered.page(params[:page])
8
8
  end
9
9
 
10
10
  private
11
11
 
12
12
  def get_relatives
13
- @countries = Country.all
13
+ @nations = Nation.all
14
14
  end
15
+
15
16
  end
16
17
  end
@@ -0,0 +1,12 @@
1
+ module Geopolitical
2
+ class ZonesController < GeopoliticalController
3
+ inherit_resources
4
+
5
+ def collection
6
+ @zones = Zone.ordered.page(params[:page])
7
+ end
8
+
9
+ private
10
+
11
+ end
12
+ 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
- # include GeoHelper
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
- field :slug
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
- # index [[ :geom, Mongo::GEO2D ]], min: 200, max: 200
16
- index :slug
17
- spatial_index :geom
17
+ attr_writer :x, :y, :z
18
18
 
19
- belongs_to :province
20
- belongs_to :country, index: true
19
+ belongs_to :region
20
+ belongs_to :nation
21
21
  has_many :hoods
22
22
 
23
- before_validation :set_defaults
24
23
 
25
- validates :name, :country, presence: true
26
- validates_uniqueness_of :name, :scope => :province_id
24
+ index name: 1
27
25
 
28
- index [[:name, 1]]
26
+ scope :ordered, order_by(name: 1)
29
27
 
30
- scope :ordered, order_by(:name, 1)
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.country ||= province.try(:country)
38
- self.slug ||= name.try(:downcase) # don't use slugize
37
+ self.nation ||= region.try(:nation)
39
38
  end
40
39
 
41
- def self.search(search, page)
42
- cities = search ? where(:field => /#{search}/i) : all
43
- cities.page(page)
40
+ def abbr
41
+ region ? region.abbr : nation.abbr
44
42
  end
45
43
 
46
- def self.drop_down
47
- ordered.map{|c| [c.name, c.id]}
44
+ def self.search txt
45
+ where(slug: /#{txt}/i)
48
46
  end
49
47
 
50
48
  def <=> other
51
- self.name <=> other.name
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 :name
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, index: true
11
+ belongs_to :city
12
12
 
13
- validates :name, :city, presence: true
13
+ validates :city, :name, presence: true
14
14
 
15
- def self.search(search, page)
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 to_param
21
- "#{id}-#{name}"
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
@@ -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
@@ -0,0 +1,9 @@
1
+ class ZoneMember
2
+ include Mongoid::Document
3
+
4
+ belongs_to :zone
5
+ belongs_to :member, polymorphic: true
6
+
7
+
8
+
9
+ end
@@ -1,20 +1,22 @@
1
- #mainbody-panel.mainbodypanel-typography-retro
2
- #mainbodypanel-title.mainbodypanel-alignment-center
3
- %span.headline
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.white.shadow
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
- .forms_buttons
15
+ .forms_btns
14
16
  .citydata
15
17
  .field{"data-role" => "fieldcontain"}
16
- = f.label :province
17
- = f.select :province_id, @provinces
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
- = save_or_cancel f
29
+ = f.submit
28
30
  .grid_8
29
31
  #map=# gmaps(@map, false, false)
30
- .clear
@@ -1,31 +1,33 @@
1
- -#= js "places"
2
- -# #rt-utility
3
- -# .inner
4
- -# - if @markers
5
- -# = gmaps({"markers" => { "data" => @markers, "options" => { "marker_picture" => "foo", "marker_width" => 22, "marker_length" => 32 }}}, false, false)
6
- .block
7
- .top
8
- %h2 Cidades
9
- %table{:class => :table}
10
- %thead
11
- %tr
12
- %th{:sort => 'name'} Nome
13
- %th{:sort => 'province'} Province
14
- %th{:sort => 'country', :colspan => 2} Pais
15
- %tbody
16
- - for city in @cities
17
- %tr{:class => cycle('par','impar')}
18
- %td= link_to city.name , city
19
- %td= city.province.name if city.province
20
- %td= city.country.name
21
- %td{:align => 'right'}
22
- = link_to 'Edit', edit_city_path(city)
23
- = link_to 'Destroy', city, :confirm => 'Destroy city?', :method => :delete
24
-
25
- .inner
26
- .actions-bar
27
- .actions
28
- .pagination=# paginate @cidades
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
- #showcase-panel.showcasepanel-typography-retro
2
- #showcasepanel-title.showcasepanel-alignment-center
3
- %span.headline
4
- = @city.name
5
- .container_16
6
- .box.white
7
- .grid_2
8
- = link_to t(:edit), edit_city_path(@city), :class => "icon edit"
9
-
10
- %p
11
- = @city.province.name if @city.province
12
- %p
13
- = @city.country.name
14
- %p
15
- Souls:
16
- %em= @city.souls
17
- -# %p= @city.x
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"