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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b8c29193934b8609dbca73a15d83d6c47e044c0
4
- data.tar.gz: 7582aa198196ecdbf868200285e3e8d2c49ae9e1
3
+ metadata.gz: a9f0a4a3ee7b7e01cad47a5980ca37279f81db2f
4
+ data.tar.gz: b903caedbba8f5d409555f270d74fb562780e303
5
5
  SHA512:
6
- metadata.gz: 7298a28aa9c8faa90c65e1148c5057e10bd07a8f2ca0520751424e49f29c166fe0e98e73eabaec62259e0cd0b2b70edd47a6ebf354cd6d4a79f3c9b4740ceee3
7
- data.tar.gz: d7eecd6bbdbcfd99a9b5edba0d93c950e404dadcb03b44f8680ef42423ab7875c223aa015decf242e3c74b4cd0535e4caaa2b1c64d94c821cb731edf50905a3d
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
- add_breadcrumb 'Cidades', :cities_path
6
- add_breadcrumb 'Criar nova cidade', '', :only => [:new, :create]
7
- add_breadcrumb 'Editar nova cidade', '', :only => [:edit, :update]
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
- add_breadcrumb @city.name, ''
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(:city).permit(:name, :cdg_ibge, :state_id, :population_2010, :demographic_density, :gentle, :area)
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(:state).permit(:name, :initials)
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.gentle %></td>
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 edit_city_path(resource), data: {toggle: 'tooltip', original_title: I18n.t('views.misc.actions.edit')}, title: '', class: "btn btn-xs btn-default" do %>
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
 
@@ -37,8 +37,8 @@
37
37
  </div>
38
38
 
39
39
  <div class="field">
40
- <%= f.label :gentle %>
41
- <%= f.text_field :gentle %>
40
+ <%= f.label :gentile %>
41
+ <%= f.text_field :gentile %>
42
42
  </div>
43
43
 
44
44
  <div class="field">
@@ -2,5 +2,5 @@
2
2
 
3
3
  <%= render 'form', city: @city %>
4
4
 
5
- <%= link_to I18n.t('views.misc.actions.back'), cities_path, class: 'btn btn-sm btn-square btn-default' %>
5
+ <%= link_to I18n.t('views.misc.actions.back'), geography_cities_path, class: 'btn btn-sm btn-square btn-default' %>
6
6
 
@@ -27,7 +27,7 @@
27
27
 
28
28
  <p>
29
29
  <strong><%= I18n.t 'activerecord.attributes.city.gentle' %>:</strong>
30
- <%= @city.gentle %>
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'), cities_path, class: 'btn btn-sm btn-square btn-default' %>
41
- <%= link_to I18n.t('views.misc.actions.edit'),edit_city_path(@city), class: 'btn btn-sm btn-square btn-default' %>
42
- <%= link_to I18n.t('views.misc.actions.destroy'),cities_path(@city), method: :destroy, data: {confirm: I18n.t('views.misc.actions.confirm') }, class: 'btn btn-sm btn-square btn-default' %>
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 edit_state_path(resource), data: {toggle: 'tooltip', original_title: I18n.t('views.misc.actions.edit')}, title: '', class: "btn btn-xs btn-default" do %>
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'), states_path, class: 'btn btn-sm btn-square btn-default' %>
8
+ <%= link_to I18n.t('views.misc.actions.back'), geography_states_path, class: 'btn btn-sm btn-square btn-default' %>
9
9
 
@@ -19,4 +19,4 @@
19
19
 
20
20
  <br>
21
21
 
22
- <%= link_to 'New State', new_state_path %>
22
+ <%= link_to 'New State', new_geography_state_path %>
@@ -2,5 +2,5 @@
2
2
 
3
3
  <%= render 'form', state: @state %>
4
4
 
5
- <%= link_to I18n.t('views.misc.actions.back'), states_path, class: 'btn btn-sm btn-square btn-default' %>
5
+ <%= link_to I18n.t('views.misc.actions.back'), geography_states_path, class: 'btn btn-sm btn-square btn-default' %>
6
6
 
@@ -14,8 +14,8 @@
14
14
 
15
15
 
16
16
 
17
- <%= link_to I18n.t('views.misc.actions.back'), states_path, class: 'btn btn-sm btn-square btn-default' %>
18
- <%= link_to I18n.t('views.misc.actions.edit'),edit_state_path(@state), class: 'btn btn-sm btn-square btn-default' %>
19
- <%= link_to I18n.t('views.misc.actions.destroy'),states_path(@state), method: :destroy, data: {confirm: I18n.t('views.misc.actions.confirm') }, class: 'btn btn-sm btn-square btn-default' %>
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
@@ -1,2 +1,6 @@
1
1
  Rails.application.routes.draw do
2
+ namespace :geography do
3
+ resources :states
4
+ resources :cities
5
+ end
2
6
  end
@@ -1,3 +1,3 @@
1
1
  module GoGeography
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_geography
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jcottobboni