- add bower for rails
- add "wildhoney_leaflet_freedraw" bower vendor - remove api_carto
This commit is contained in:
parent
fd9061abdf
commit
eadb42af93
16 changed files with 106 additions and 56 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -16,8 +16,6 @@
|
||||||
!/log/.keep
|
!/log/.keep
|
||||||
/tmp
|
/tmp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Ignore Intellij files
|
# Ignore Intellij files
|
||||||
.idea/
|
.idea/
|
||||||
*.iml
|
*.iml
|
||||||
|
@ -28,4 +26,5 @@ bin/*
|
||||||
config/initializers/token.rb
|
config/initializers/token.rb
|
||||||
doc/*.svg
|
doc/*.svg
|
||||||
rubocop.html
|
rubocop.html
|
||||||
config/france_connect.yml
|
config/france_connect.yml
|
||||||
|
vendor/**/*
|
2
Gemfile
2
Gemfile
|
@ -49,6 +49,8 @@ gem 'carrierwave'
|
||||||
|
|
||||||
gem 'pg'
|
gem 'pg'
|
||||||
|
|
||||||
|
gem "bower-rails", "~> 0.10.0"
|
||||||
|
|
||||||
gem 'rgeo-geojson'
|
gem 'rgeo-geojson'
|
||||||
gem 'leaflet-rails'
|
gem 'leaflet-rails'
|
||||||
gem 'leaflet-markercluster-rails', '~> 0.7.0'
|
gem 'leaflet-markercluster-rails', '~> 0.7.0'
|
||||||
|
|
|
@ -62,6 +62,7 @@ GEM
|
||||||
bootstrap-sass (3.3.5)
|
bootstrap-sass (3.3.5)
|
||||||
autoprefixer-rails (>= 5.0.0.1)
|
autoprefixer-rails (>= 5.0.0.1)
|
||||||
sass (>= 3.2.19)
|
sass (>= 3.2.19)
|
||||||
|
bower-rails (0.10.0)
|
||||||
builder (3.2.2)
|
builder (3.2.2)
|
||||||
byebug (5.0.0)
|
byebug (5.0.0)
|
||||||
columnize (= 0.9.0)
|
columnize (= 0.9.0)
|
||||||
|
@ -377,6 +378,7 @@ PLATFORMS
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
bootstrap-datepicker-rails
|
bootstrap-datepicker-rails
|
||||||
bootstrap-sass (~> 3.3.5)
|
bootstrap-sass (~> 3.3.5)
|
||||||
|
bower-rails (~> 0.10.0)
|
||||||
byebug
|
byebug
|
||||||
capybara
|
capybara
|
||||||
carrierwave
|
carrierwave
|
||||||
|
@ -422,3 +424,6 @@ DEPENDENCIES
|
||||||
unicorn
|
unicorn
|
||||||
web-console (~> 2.0)
|
web-console (~> 2.0)
|
||||||
webmock
|
webmock
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
1.10.6
|
||||||
|
|
|
@ -18,4 +18,9 @@
|
||||||
//= require bootstrap-sprockets
|
//= require bootstrap-sprockets
|
||||||
//= require bootstrap-datepicker/core
|
//= require bootstrap-datepicker/core
|
||||||
//= require bootstrap-datepicker/locales/bootstrap-datepicker.fr.js
|
//= require bootstrap-datepicker/locales/bootstrap-datepicker.fr.js
|
||||||
//= require leaflet
|
//= require leaflet
|
||||||
|
//= require d3
|
||||||
|
//= require evispa-timo-jsclipper
|
||||||
|
//= require concavehull
|
||||||
|
//= require graham_scan
|
||||||
|
//= require wildhoney_leaflet_freedraw
|
||||||
|
|
|
@ -1,10 +1,30 @@
|
||||||
//récupération de la position de l'entreprise
|
//récupération de la position de l'entreprise
|
||||||
|
|
||||||
function get_position(){
|
function initCarto() {
|
||||||
|
OSM = L.tileLayer("http://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png", {
|
||||||
|
attribution: '© Openstreetmap France | © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||||
|
});
|
||||||
|
|
||||||
|
position = get_position();
|
||||||
|
|
||||||
|
var map = L.map("map", {
|
||||||
|
center: new L.LatLng(position.lat, position.lon),
|
||||||
|
zoom: 13,
|
||||||
|
layers: [OSM]
|
||||||
|
});
|
||||||
|
|
||||||
|
freeDraw = new L.FreeDraw({
|
||||||
|
mode: L.FreeDraw.MODES.CREATE
|
||||||
|
});
|
||||||
|
|
||||||
|
map.addLayer(freeDraw);
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_position() {
|
||||||
var position;
|
var position;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/users/dossiers/'+dossier_id+'/carte/position',
|
url: '/users/dossiers/' + dossier_id + '/carte/position',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
async: false
|
async: false
|
||||||
}).done(function (data) {
|
}).done(function (data) {
|
||||||
|
@ -14,7 +34,7 @@ function get_position(){
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_ref_dossier (){
|
function get_ref_dossier() {
|
||||||
$.post("http://apicarto.coremaps.com/api/v1/datastore", {
|
$.post("http://apicarto.coremaps.com/api/v1/datastore", {
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
|
|
|
@ -5,6 +5,19 @@
|
||||||
table {
|
table {
|
||||||
font-size: 13;
|
font-size: 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#map.mode-create {
|
||||||
|
cursor: crosshair;
|
||||||
|
}
|
||||||
|
|
||||||
|
svg.tracer {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
padding: 6px 8px;
|
padding: 6px 8px;
|
||||||
font: 14px/16px Arial, Helvetica, sans-serif;
|
font: 14px/16px Arial, Helvetica, sans-serif;
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
%div#sources_CSS_api_carto
|
|
||||||
%link{:href => "https://leaflet.github.io/Leaflet.draw/leaflet.draw.css", :rel => "stylesheet", :type => "text/css"}
|
|
||||||
|
|
||||||
%link{:href => "https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css", :rel => "stylesheet"}
|
|
||||||
%link{:href => "https://cdn.rawgit.com/CliffCloud/Leaflet.EasyButton/dd04bbf160aa33c44aa63e8a744b3632c162c340/src/easy-button.css", :rel => "stylesheet"}
|
|
|
@ -1,11 +0,0 @@
|
||||||
%script{type: 'text/javascript'}
|
|
||||||
="var dossier_id =#{@dossier.id}"
|
|
||||||
|
|
||||||
%div#sources_JS_api_carto
|
|
||||||
|
|
||||||
%script{:src => "https://leaflet.github.io/Leaflet.draw/leaflet.draw.js"}
|
|
||||||
%script{:src => "https://cdnjs.cloudflare.com/ajax/libs/spin.js/2.0.1/spin.min.js"}
|
|
||||||
%script{:src => "https://cdn.rawgit.com/CliffCloud/Leaflet.EasyButton/14332b70b18bdec80f4cce86c643372883bf90aa/src/easy-button.bar.js"}
|
|
||||||
%script{:src => "https://cdn.rawgit.com/CliffCloud/Leaflet.EasyButton/14332b70b18bdec80f4cce86c643372883bf90aa/src/easy-button.button.js"}
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
%script{type: 'text/javascript'}
|
|
||||||
="var dossier_id =#{@dossier.id}"
|
|
||||||
="var ref_dossier=#{@dossier.ref_dossier_carto}"
|
|
||||||
|
|
||||||
%div#sources_JS_api_carto_backend
|
|
||||||
|
|
||||||
%script{:src => "https://leaflet.github.io/Leaflet.draw/leaflet.draw.js"}
|
|
||||||
%script{:src => "https://cdnjs.cloudflare.com/ajax/libs/spin.js/2.0.1/spin.min.js"}
|
|
||||||
%script{:src => "https://cdn.rawgit.com/CliffCloud/Leaflet.EasyButton/14332b70b18bdec80f4cce86c643372883bf90aa/src/easy-button.bar.js"}
|
|
||||||
%script{:src => "https://cdn.rawgit.com/CliffCloud/Leaflet.EasyButton/14332b70b18bdec80f4cce86c643372883bf90aa/src/easy-button.button.js"}
|
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,26 @@
|
||||||
='Localisation de votre demande'
|
='Localisation de votre demande'
|
||||||
%br
|
%br
|
||||||
|
|
||||||
=render partial: 'carte_sources_CSS'
|
.content{style:'margin-bottom:60px'}
|
||||||
|
%button.btn.btn-sm.btn-success{type:'button', disabled: 'disabled'} Nouveau
|
||||||
|
\-
|
||||||
|
%button.btn.btn-sm.btn-info{type:'button', disabled: 'disabled'} Editer
|
||||||
|
\-
|
||||||
|
%button.btn.btn-sm.btn-danger{type:'button', disabled: 'disabled'} Supprimer
|
||||||
|
|
||||||
.content
|
|
||||||
#map_qp{style: 'height:600px; width: 100%;'}
|
|
||||||
|
|
||||||
= form_tag(url_for({controller: :carte, action: :save_ref_api_carto, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST') do
|
|
||||||
%br
|
%br
|
||||||
%input{type: 'hidden', value: '', name: 'ref_dossier', id: 'ref_dossier'}
|
%br
|
||||||
|
#map{style: 'height:600px; width: 100%;'}
|
||||||
|
|
||||||
-if @dossier.draft?
|
= form_tag(url_for({controller: :carte, action: :save_ref_api_carto, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST') do
|
||||||
=render partial: '/layouts/etape_suivante'
|
%br
|
||||||
-else
|
%input{type: 'hidden', value: '', name: 'ref_dossier', id: 'ref_dossier'}
|
||||||
=render partial: '/layouts/modifications_terminees'
|
|
||||||
|
|
||||||
=render partial: 'carte_sources_JS'
|
-if @dossier.draft?
|
||||||
|
=render partial: '/layouts/etape_suivante'
|
||||||
|
-else
|
||||||
|
=render partial: '/layouts/modifications_terminees'
|
||||||
|
|
||||||
|
%script{type: 'text/javascript'}
|
||||||
|
="var dossier_id =#{@dossier.id}"
|
||||||
|
initCarto();
|
15
bower.json
Normal file
15
bower.json
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"lib": {
|
||||||
|
"name": "bower-rails generated lib assets",
|
||||||
|
"dependencies": {
|
||||||
|
// "threex" : "git@github.com:rharriso/threex.git",
|
||||||
|
// "gsvpano.js" : "https://github.com/rharriso/GSVPano.js/blob/master/src/GSVPano.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vendor": {
|
||||||
|
"name": "bower-rails generated vendor assets",
|
||||||
|
"dependencies": {
|
||||||
|
"wildhoney_leaflet_freedraw": "https://github.com/Wildhoney/Leaflet.FreeDraw.git"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
config/initializers/bower_rails.rb
Normal file
19
config/initializers/bower_rails.rb
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
BowerRails.configure do |bower_rails|
|
||||||
|
# Tell bower-rails what path should be considered as root. Defaults to Dir.pwd
|
||||||
|
bower_rails.root_path = '/app/'
|
||||||
|
|
||||||
|
# Invokes rake bower:install before precompilation. Defaults to false
|
||||||
|
bower_rails.install_before_precompile = true
|
||||||
|
|
||||||
|
# Invokes rake bower:resolve before precompilation. Defaults to false
|
||||||
|
bower_rails.resolve_before_precompile = true
|
||||||
|
|
||||||
|
# Invokes rake bower:clean before precompilation. Defaults to false
|
||||||
|
bower_rails.clean_before_precompile = true
|
||||||
|
|
||||||
|
# Invokes rake bower:install:deployment instead rake bower:install. Defaults to false
|
||||||
|
bower_rails.use_bower_install_deployment = true
|
||||||
|
#
|
||||||
|
# Invokes rake bower:install and rake bower:install:deployment with -F (force) flag. Defaults to false
|
||||||
|
bower_rails.force_install = true
|
||||||
|
end
|
|
@ -16,17 +16,9 @@ describe 'users/carte/show.html.haml', type: :view do
|
||||||
it 'le formulaire envoie vers /users/dossiers/:dossier_id/carte en #POST' do
|
it 'le formulaire envoie vers /users/dossiers/:dossier_id/carte en #POST' do
|
||||||
expect(rendered).to have_selector("form[action='/users/dossiers/#{dossier_id}/carte'][method=post]")
|
expect(rendered).to have_selector("form[action='/users/dossiers/#{dossier_id}/carte'][method=post]")
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'la page des sources CSS de l\'API carto est chargée' do
|
|
||||||
expect(rendered).to have_selector('#sources_CSS_api_carto')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'la page des sources JS de l\'API carto est chargée' do
|
|
||||||
expect(rendered).to have_selector('#sources_JS_api_carto')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'la carte est bien présente' do
|
it 'la carte est bien présente' do
|
||||||
expect(rendered).to have_selector('#map_qp')
|
expect(rendered).to have_selector('#map')
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'présence des inputs hidden' do
|
context 'présence des inputs hidden' do
|
||||||
|
|
0
vendor/assets/javascripts/.keep
vendored
0
vendor/assets/javascripts/.keep
vendored
0
vendor/assets/stylesheets/.keep
vendored
0
vendor/assets/stylesheets/.keep
vendored
Loading…
Reference in a new issue