go_geography 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/app/controllers/geography/cities_controller.rb +8 -7
- data/app/controllers/geography/states_controller.rb +4 -2
- data/app/views/geography/cities/_collection.html.erb +2 -2
- data/app/views/geography/cities/_form.html.erb +2 -2
- data/app/views/geography/cities/new.html.erb +1 -1
- data/app/views/geography/cities/show.html.erb +4 -4
- data/app/views/geography/states/_collection.html.erb +1 -1
- data/app/views/geography/states/edit.html.erb +1 -1
- data/app/views/geography/states/index.html.erb +1 -1
- data/app/views/geography/states/new.html.erb +1 -1
- data/app/views/geography/states/show.html.erb +3 -3
- data/config/routes.rb +4 -0
- data/lib/go_geography/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9f0a4a3ee7b7e01cad47a5980ca37279f81db2f
|
4
|
+
data.tar.gz: b903caedbba8f5d409555f270d74fb562780e303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 431d332f0577bf94b35be4a8c19c4e9d587db321fd63e806a319d2b9d2dc4f565af3ed61f8c614ab34f2e9adfc265cf81ac294ce1e1fa4473dae1e3160d4eecb
|
7
|
+
data.tar.gz: ca63684ff293d42523975124673ab33133d15358248ef24f7114f8eeeda17de1696b860b572585366f5b1d60482be0404171b156fc7cdc45468b7262a1093694
|
@@ -2,17 +2,18 @@ module Geography
|
|
2
2
|
class CitiesController < ApplicationController
|
3
3
|
before_action :set_city, only: [:show, :edit, :update, :destroy]
|
4
4
|
before_action :authenticate_user!
|
5
|
-
|
6
|
-
add_breadcrumb '
|
7
|
-
add_breadcrumb '
|
5
|
+
load_and_authorize_resource except: [:create]
|
6
|
+
#add_breadcrumb 'Cidades', :cities_path
|
7
|
+
#add_breadcrumb 'Criar nova cidade', '', :only => [:new, :create]
|
8
|
+
#add_breadcrumb 'Editar nova cidade', '', :only => [:edit, :update]
|
8
9
|
# GET /cities
|
9
10
|
def index
|
10
|
-
@cities = City.all.page(params[:page])
|
11
|
+
@cities = City.all.order(:name).page(params[:page])
|
11
12
|
end
|
12
13
|
|
13
14
|
# GET /cities/1
|
14
15
|
def show
|
15
|
-
|
16
|
+
# add_breadcrumb @city.name, ''
|
16
17
|
end
|
17
18
|
|
18
19
|
# GET /cities/new
|
@@ -26,8 +27,8 @@ module Geography
|
|
26
27
|
|
27
28
|
# POST /cities
|
28
29
|
def create
|
30
|
+
authorize! :create, @city
|
29
31
|
@city = City.new(city_params)
|
30
|
-
|
31
32
|
if @city.save
|
32
33
|
redirect_to @city, notice: 'City was successfully created.'
|
33
34
|
else
|
@@ -58,7 +59,7 @@ module Geography
|
|
58
59
|
|
59
60
|
# Only allow a trusted parameter "white list" through.
|
60
61
|
def city_params
|
61
|
-
params.require(:
|
62
|
+
params.require(:geography_city).permit(:name, :cdg_ibge, :state_id, :population_2010, :demographic_density, :gentle, :area)
|
62
63
|
end
|
63
64
|
end
|
64
65
|
end
|
@@ -2,10 +2,11 @@ module Geography
|
|
2
2
|
class StatesController < ApplicationController
|
3
3
|
before_action :set_state, only: [:show, :edit, :update, :destroy]
|
4
4
|
before_action :authenticate_user!
|
5
|
+
load_and_authorize_resource except: [:create]
|
5
6
|
|
6
7
|
# GET /states
|
7
8
|
def index
|
8
|
-
@states = State.all
|
9
|
+
@states = State.all.order(:name)
|
9
10
|
end
|
10
11
|
|
11
12
|
# GET /states/1
|
@@ -23,6 +24,7 @@ module Geography
|
|
23
24
|
|
24
25
|
# POST /states
|
25
26
|
def create
|
27
|
+
authorize! :create, @state
|
26
28
|
@state = State.new(state_params)
|
27
29
|
|
28
30
|
if @state.save
|
@@ -55,7 +57,7 @@ module Geography
|
|
55
57
|
|
56
58
|
# Only allow a trusted parameter "white list" through.
|
57
59
|
def state_params
|
58
|
-
params.require(:
|
60
|
+
params.require(:geography_state).permit(:name, :initials)
|
59
61
|
end
|
60
62
|
end
|
61
63
|
end
|
@@ -5,14 +5,14 @@
|
|
5
5
|
<td><%= resource.state_id %></td>
|
6
6
|
<td><%= resource.population_2010 %></td>
|
7
7
|
<td><%= resource.demographic_density %></td>
|
8
|
-
<td><%= resource.
|
8
|
+
<td><%= resource.gentile %></td>
|
9
9
|
<td><%= resource.area %></td>
|
10
10
|
|
11
11
|
<td class="text-center">
|
12
12
|
<%= link_to resource, data: {toggle: 'tooltip', original_title: I18n.t('views.misc.actions.show')}, title: '', class: "btn btn-xs btn-default" do %>
|
13
13
|
<i class="fa fa-list"></i>
|
14
14
|
<% end %>
|
15
|
-
<%= link_to
|
15
|
+
<%= link_to edit_geography_city_path(resource), data: {toggle: 'tooltip', original_title: I18n.t('views.misc.actions.edit')}, title: '', class: "btn btn-xs btn-default" do %>
|
16
16
|
<i class="fa fa-pencil"></i>
|
17
17
|
<% end %>
|
18
18
|
|
@@ -27,7 +27,7 @@
|
|
27
27
|
|
28
28
|
<p>
|
29
29
|
<strong><%= I18n.t 'activerecord.attributes.city.gentle' %>:</strong>
|
30
|
-
<%= @city.
|
30
|
+
<%= @city.gentile %>
|
31
31
|
</p>
|
32
32
|
|
33
33
|
<p>
|
@@ -37,7 +37,7 @@
|
|
37
37
|
|
38
38
|
|
39
39
|
|
40
|
-
<%= link_to I18n.t('views.misc.actions.back'),
|
41
|
-
<%= link_to I18n.t('views.misc.actions.edit'),
|
42
|
-
<%= link_to I18n.t('views.misc.actions.destroy'),
|
40
|
+
<%= link_to I18n.t('views.misc.actions.back'), geography_cities_path, class: 'btn btn-sm btn-square btn-default' %>
|
41
|
+
<%= link_to I18n.t('views.misc.actions.edit'),edit_geography_city_path(@city), class: 'btn btn-sm btn-square btn-default' %>
|
42
|
+
<%= link_to I18n.t('views.misc.actions.destroy'),geography_cities_path(@city), method: :destroy, data: {confirm: I18n.t('views.misc.actions.confirm') }, class: 'btn btn-sm btn-square btn-default' %>
|
43
43
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<%= link_to resource, data: {toggle: 'tooltip', original_title: I18n.t('views.misc.actions.show')}, title: '', class: "btn btn-xs btn-default" do %>
|
8
8
|
<i class="fa fa-list"></i>
|
9
9
|
<% end %>
|
10
|
-
<%= link_to
|
10
|
+
<%= link_to edit_geography_state_path(resource), data: {toggle: 'tooltip', original_title: I18n.t('views.misc.actions.edit')}, title: '', class: "btn btn-xs btn-default" do %>
|
11
11
|
<i class="fa fa-pencil"></i>
|
12
12
|
<% end %>
|
13
13
|
|
@@ -5,5 +5,5 @@
|
|
5
5
|
|
6
6
|
<br>
|
7
7
|
<%= link_to I18n.t('views.misc.actions.show'), @state ,class: 'btn btn-sm btn-square btn-default'%> |
|
8
|
-
<%= link_to I18n.t('views.misc.actions.back'),
|
8
|
+
<%= link_to I18n.t('views.misc.actions.back'), geography_states_path, class: 'btn btn-sm btn-square btn-default' %>
|
9
9
|
|
@@ -14,8 +14,8 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
<%= link_to I18n.t('views.misc.actions.back'),
|
18
|
-
<%= link_to I18n.t('views.misc.actions.edit'),
|
19
|
-
<%= link_to I18n.t('views.misc.actions.destroy'),
|
17
|
+
<%= link_to I18n.t('views.misc.actions.back'), geography_states_path, class: 'btn btn-sm btn-square btn-default' %>
|
18
|
+
<%= link_to I18n.t('views.misc.actions.edit'),edit_geography_state_path(@state), class: 'btn btn-sm btn-square btn-default' %>
|
19
|
+
<%= link_to I18n.t('views.misc.actions.destroy'),geography_states_path(@state), method: :destroy, data: {confirm: I18n.t('views.misc.actions.confirm') }, class: 'btn btn-sm btn-square btn-default' %>
|
20
20
|
|
21
21
|
|
data/config/routes.rb
CHANGED
data/lib/go_geography/version.rb
CHANGED