parent
a2f27a6e3f
commit
4761dc8bf6
@ -0,0 +1,3 @@
|
||||
ActiveAdmin.register Lug do
|
||||
permit_params :name, :department, :url, :city
|
||||
end
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
// Place all the styles related to the cities controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
@ -1,3 +0,0 @@
|
||||
// Place all the styles related to the regions controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
@ -0,0 +1,69 @@
|
||||
body {
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
font-family: verdana, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
p, ol, ul, td {
|
||||
font-family: verdana, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: #eee;
|
||||
padding: 10px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #000;
|
||||
&:visited {
|
||||
color: #666;
|
||||
}
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background-color: #000;
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
&.field, &.actions {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
#notice {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.field_with_errors {
|
||||
padding: 2px;
|
||||
background-color: red;
|
||||
display: table;
|
||||
}
|
||||
|
||||
#error_explanation {
|
||||
width: 450px;
|
||||
border: 2px solid red;
|
||||
padding: 7px;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 20px;
|
||||
background-color: #f0f0f0;
|
||||
h2 {
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
padding: 5px 5px 5px 15px;
|
||||
font-size: 12px;
|
||||
margin: -7px;
|
||||
margin-bottom: 0px;
|
||||
background-color: #c00;
|
||||
color: #fff;
|
||||
}
|
||||
ul li {
|
||||
font-size: 12px;
|
||||
list-style: square;
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
class CitiesController < InheritedResources::Base
|
||||
protected
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def permitted_params
|
||||
params.permit city: [:name, :majname, :postalcode, :inseecode, :regioncode, :latitude, :longitude]
|
||||
end
|
||||
end
|
@ -1,2 +0,0 @@
|
||||
class RegionsController < InheritedResources::Base
|
||||
end
|
@ -0,0 +1,2 @@
|
||||
module LugsHelper
|
||||
end
|
@ -1,2 +1,7 @@
|
||||
class City < ActiveRecord::Base
|
||||
end
|
||||
|
||||
#
|
||||
# def permitted_params
|
||||
# params.permit city: [:name, :majname, :postalcode, :inseecode, :regioncode, :latitude, :longitude]
|
||||
# end
|
||||
|
@ -0,0 +1,3 @@
|
||||
class Lug < ActiveRecord::Base
|
||||
belongs_to :region, foreign_key: 'region'
|
||||
end
|
@ -1,31 +0,0 @@
|
||||
= form_for @city do |f|
|
||||
- if @city.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@city.errors.count, "error")} prohibited this city from being saved:"
|
||||
%ul
|
||||
- @city.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
|
||||
.field
|
||||
= f.label :name
|
||||
= f.text_field :name
|
||||
.field
|
||||
= f.label :majname
|
||||
= f.text_field :majname
|
||||
.field
|
||||
= f.label :postalcode
|
||||
= f.number_field :postalcode
|
||||
.field
|
||||
= f.label :inseecode
|
||||
= f.number_field :inseecode
|
||||
.field
|
||||
= f.label :regioncode
|
||||
= f.number_field :regioncode
|
||||
.field
|
||||
= f.label :latitude
|
||||
= f.text_field :latitude
|
||||
.field
|
||||
= f.label :longitude
|
||||
= f.text_field :longitude
|
||||
.actions
|
||||
= f.submit 'Save'
|
@ -1,7 +0,0 @@
|
||||
%h1 Editing city
|
||||
|
||||
= render 'form'
|
||||
|
||||
= link_to 'Show', @city
|
||||
\|
|
||||
= link_to 'Back', cities_path
|
@ -1,31 +0,0 @@
|
||||
%h1 Listing cities
|
||||
|
||||
%table
|
||||
%tr
|
||||
%th Name
|
||||
%th Majname
|
||||
%th Postalcode
|
||||
%th Inseecode
|
||||
%th Regioncode
|
||||
%th Latitude
|
||||
%th Longitude
|
||||
%th
|
||||
%th
|
||||
%th
|
||||
|
||||
- @cities.each do |city|
|
||||
%tr
|
||||
%td= city.name
|
||||
%td= city.majname
|
||||
%td= city.postalcode
|
||||
%td= city.inseecode
|
||||
%td= city.regioncode
|
||||
%td= city.latitude
|
||||
%td= city.longitude
|
||||
%td= link_to 'Show', city
|
||||
%td= link_to 'Edit', edit_city_path(city)
|
||||
%td= link_to 'Destroy', city, :method => :delete, :data => { :confirm => 'Are you sure?' }
|
||||
|
||||
%br
|
||||
|
||||
= link_to 'New City', new_city_path
|
@ -1,4 +0,0 @@
|
||||
json.array!(@cities) do |city|
|
||||
json.extract! city, :name, :majname, :postalcode, :inseecode, :regioncode, :latitude, :longitude
|
||||
json.url city_url(city, format: :json)
|
||||
end
|
@ -1,5 +0,0 @@
|
||||
%h1 New city
|
||||
|
||||
= render 'form'
|
||||
|
||||
= link_to 'Back', cities_path
|
@ -1,27 +0,0 @@
|
||||
%p#notice= notice
|
||||
|
||||
%p
|
||||
%b Name:
|
||||
= @city.name
|
||||
%p
|
||||
%b Majname:
|
||||
= @city.majname
|
||||
%p
|
||||
%b Postalcode:
|
||||
= @city.postalcode
|
||||
%p
|
||||
%b Inseecode:
|
||||
= @city.inseecode
|
||||
%p
|
||||
%b Regioncode:
|
||||
= @city.regioncode
|
||||
%p
|
||||
%b Latitude:
|
||||
= @city.latitude
|
||||
%p
|
||||
%b Longitude:
|
||||
= @city.longitude
|
||||
|
||||
= link_to t('Edit'), edit_city_path(@city)
|
||||
\|
|
||||
= link_to t('Back'), cities_path
|
@ -1 +0,0 @@
|
||||
json.extract! @city, :name, :majname, :postalcode, :inseecode, :regioncode, :latitude, :longitude, :created_at, :updated_at
|
@ -1,13 +0,0 @@
|
||||
= form_for @region do |f|
|
||||
- if @region.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@region.errors.count, "error")} prohibited this region from being saved:"
|
||||
%ul
|
||||
- @region.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
|
||||
.field
|
||||
= f.label :name
|
||||
= f.text_field :name
|
||||
.actions
|
||||
= f.submit 'Save'
|
@ -1,7 +0,0 @@
|
||||
%h1 Editing region
|
||||
|
||||
= render 'form'
|
||||
|
||||
= link_to 'Show', @region
|
||||
\|
|
||||
= link_to 'Back', regions_path
|
@ -1,19 +0,0 @@
|
||||
%h1 Listing regions
|
||||
|
||||
%table
|
||||
%tr
|
||||
%th Name
|
||||
%th
|
||||
%th
|
||||
%th
|
||||
|
||||
- @regions.each do |region|
|
||||
%tr
|
||||
%td= region.name
|
||||
%td= link_to 'Show', region
|
||||
%td= link_to 'Edit', edit_region_path(region)
|
||||
%td= link_to 'Destroy', region, :method => :delete, :data => { :confirm => 'Are you sure?' }
|
||||
|
||||
%br
|
||||
|
||||
= link_to 'New Region', new_region_path
|
@ -1,4 +0,0 @@
|
||||
json.array!(@regions) do |region|
|
||||
json.extract! region, :name
|
||||
json.url region_url(region, format: :json)
|
||||
end
|
@ -1,5 +0,0 @@
|
||||
%h1 New region
|
||||
|
||||
= render 'form'
|
||||
|
||||
= link_to 'Back', regions_path
|
@ -1,9 +0,0 @@
|
||||
%p#notice= notice
|
||||
|
||||
%p
|
||||
%b Name:
|
||||
= @region.name
|
||||
|
||||
= link_to 'Edit', edit_region_path(@region)
|
||||
\|
|
||||
= link_to 'Back', regions_path
|
@ -1 +0,0 @@
|
||||
json.extract! @region, :name, :created_at, :updated_at
|
@ -1,49 +0,0 @@
|
||||
require 'test_helper'
|
||||
|
||||
class CitiesControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@city = cities(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:cities)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create city" do
|
||||
assert_difference('City.count') do
|
||||
post :create, city: { inseecode: @city.inseecode, latitude: @city.latitude, longitude: @city.longitude, majname: @city.majname, name: @city.name, postalcode: @city.postalcode, regioncode: @city.regioncode }
|
||||
end
|
||||
|
||||
assert_redirected_to city_path(assigns(:city))
|
||||
end
|
||||
|
||||
test "should show city" do
|
||||
get :show, id: @city
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @city
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update city" do
|
||||
patch :update, id: @city, city: { inseecode: @city.inseecode, latitude: @city.latitude, longitude: @city.longitude, majname: @city.majname, name: @city.name, postalcode: @city.postalcode, regioncode: @city.regioncode }
|
||||
assert_redirected_to city_path(assigns(:city))
|
||||
end
|
||||
|
||||
test "should destroy city" do
|
||||
assert_difference('City.count', -1) do
|
||||
delete :destroy, id: @city
|
||||
end
|
||||
|
||||
assert_redirected_to cities_path
|
||||
end
|
||||
end
|
@ -1,49 +0,0 @@
|
||||
require 'test_helper'
|
||||
|
||||
class RegionsControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@region = regions(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:regions)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create region" do
|
||||
assert_difference('Region.count') do
|
||||
post :create, region: { name: @region.name }
|
||||
end
|
||||
|
||||
assert_redirected_to region_path(assigns(:region))
|
||||
end
|
||||
|
||||
test "should show region" do
|
||||
get :show, id: @region
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @region
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update region" do
|
||||
patch :update, id: @region, region: { name: @region.name }
|
||||
assert_redirected_to region_path(assigns(:region))
|
||||
end
|
||||
|
||||
test "should destroy region" do
|
||||
assert_difference('Region.count', -1) do
|
||||
delete :destroy, id: @region
|
||||
end
|
||||
|
||||
assert_redirected_to regions_path
|
||||
end
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
region: region_one
|
||||
department: 1
|
||||
name: MyString
|
||||
url: MyString
|
||||
city: MyString
|
||||
|
||||
two:
|
||||
region: region_one
|
||||
department: 1
|
||||
name: MyString
|
||||
url: MyString
|
||||
city: MyString
|
@ -1,7 +1,7 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
region_one:
|
||||
name: MyString
|
||||
|
||||
two:
|
||||
region_two:
|
||||
name: MyString
|
||||
|
@ -0,0 +1,4 @@
|
||||
require 'test_helper'
|
||||
|
||||
class LugsHelperTest < ActionView::TestCase
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class LugTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
Reference in new issue