- 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
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -16,8 +16,6 @@
|
|||
!/log/.keep
|
||||
/tmp
|
||||
|
||||
|
||||
|
||||
# Ignore Intellij files
|
||||
.idea/
|
||||
*.iml
|
||||
|
@ -29,3 +27,4 @@ config/initializers/token.rb
|
|||
doc/*.svg
|
||||
rubocop.html
|
||||
config/france_connect.yml
|
||||
vendor/**/*
|
2
Gemfile
2
Gemfile
|
@ -49,6 +49,8 @@ gem 'carrierwave'
|
|||
|
||||
gem 'pg'
|
||||
|
||||
gem "bower-rails", "~> 0.10.0"
|
||||
|
||||
gem 'rgeo-geojson'
|
||||
gem 'leaflet-rails'
|
||||
gem 'leaflet-markercluster-rails', '~> 0.7.0'
|
||||
|
|
|
@ -62,6 +62,7 @@ GEM
|
|||
bootstrap-sass (3.3.5)
|
||||
autoprefixer-rails (>= 5.0.0.1)
|
||||
sass (>= 3.2.19)
|
||||
bower-rails (0.10.0)
|
||||
builder (3.2.2)
|
||||
byebug (5.0.0)
|
||||
columnize (= 0.9.0)
|
||||
|
@ -377,6 +378,7 @@ PLATFORMS
|
|||
DEPENDENCIES
|
||||
bootstrap-datepicker-rails
|
||||
bootstrap-sass (~> 3.3.5)
|
||||
bower-rails (~> 0.10.0)
|
||||
byebug
|
||||
capybara
|
||||
carrierwave
|
||||
|
@ -422,3 +424,6 @@ DEPENDENCIES
|
|||
unicorn
|
||||
web-console (~> 2.0)
|
||||
webmock
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.6
|
||||
|
|
|
@ -19,3 +19,8 @@
|
|||
//= require bootstrap-datepicker/core
|
||||
//= require bootstrap-datepicker/locales/bootstrap-datepicker.fr.js
|
||||
//= 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
|
||||
|
||||
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;
|
||||
|
||||
$.ajax({
|
||||
url: '/users/dossiers/'+dossier_id+'/carte/position',
|
||||
url: '/users/dossiers/' + dossier_id + '/carte/position',
|
||||
dataType: 'json',
|
||||
async: false
|
||||
}).done(function (data) {
|
||||
|
@ -14,7 +34,7 @@ function get_position(){
|
|||
return position;
|
||||
}
|
||||
|
||||
function get_ref_dossier (){
|
||||
function get_ref_dossier() {
|
||||
$.post("http://apicarto.coremaps.com/api/v1/datastore", {
|
||||
contentType: "application/json",
|
||||
dataType: 'json',
|
||||
|
|
|
@ -5,6 +5,19 @@
|
|||
table {
|
||||
font-size: 13;
|
||||
}
|
||||
|
||||
#map.mode-create {
|
||||
cursor: crosshair;
|
||||
}
|
||||
|
||||
svg.tracer {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.info {
|
||||
padding: 6px 8px;
|
||||
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,12 +2,18 @@
|
|||
='Localisation de votre demande'
|
||||
%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%;'}
|
||||
%br
|
||||
%br
|
||||
#map{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
|
||||
= form_tag(url_for({controller: :carte, action: :save_ref_api_carto, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST') do
|
||||
%br
|
||||
%input{type: 'hidden', value: '', name: 'ref_dossier', id: 'ref_dossier'}
|
||||
|
||||
|
@ -16,4 +22,6 @@
|
|||
-else
|
||||
=render partial: '/layouts/modifications_terminees'
|
||||
|
||||
=render partial: 'carte_sources_JS'
|
||||
%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
|
|
@ -17,16 +17,8 @@ describe 'users/carte/show.html.haml', type: :view do
|
|||
expect(rendered).to have_selector("form[action='/users/dossiers/#{dossier_id}/carte'][method=post]")
|
||||
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
|
||||
expect(rendered).to have_selector('#map_qp')
|
||||
expect(rendered).to have_selector('#map')
|
||||
end
|
||||
|
||||
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