New UI for the map

This commit is contained in:
Xavier J 2016-06-14 11:00:57 +02:00
parent 866565495d
commit bbae7214c9
5 changed files with 32 additions and 14 deletions

BIN
app/assets/images/edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -93,22 +93,30 @@ function add_event_freeDraw() {
freeDraw.on('markers', function (e) { freeDraw.on('markers', function (e) {
$("#json_latlngs").val(JSON.stringify(e.latLngs)); $("#json_latlngs").val(JSON.stringify(e.latLngs));
add_event_edit();
get_external_data(e.latLngs); get_external_data(e.latLngs);
}); });
$("#map").on('click', function(){
freeDraw.setMode(L.FreeDraw.MODES.VIEW);
});
$("#new").on('click', function (e) { $("#new").on('click', function (e) {
freeDraw.setMode(L.FreeDraw.MODES.CREATE); freeDraw.setMode(L.FreeDraw.MODES.CREATE);
}); });
$("#edit").on('click', function (e) {
freeDraw.setMode(L.FreeDraw.MODES.EDIT);
});
$("#delete").on('click', function (e) { $("#delete").on('click', function (e) {
freeDraw.setMode(L.FreeDraw.MODES.DELETE); freeDraw.setMode(L.FreeDraw.MODES.DELETE);
}); });
} }
function add_event_edit (){
$(".leaflet-container g path").on('click', function (e) {
setTimeout(function(){freeDraw.setMode(L.FreeDraw.MODES.EDIT | L.FreeDraw.MODES.DELETE)}, 50);
});
}
function get_position() { function get_position() {
var position; var position;
@ -131,7 +139,7 @@ function get_address_point(request) {
}).done(function (data) { }).done(function (data) {
if (data.lat != null) { if (data.lat != null) {
map.setView(new L.LatLng(data.lat, data.lon), data.zoom); map.setView(new L.LatLng(data.lat, data.lon), data.zoom);
L.marker([data.lat, data.lon], {icon: icon}).addTo(map); //L.marker([data.lat, data.lon], {icon: icon}).addTo(map);
} }
}); });
} }

View file

@ -12,12 +12,16 @@ table {
@extend .col-md-12; @extend .col-md-12;
@extend .col-lg-12; @extend .col-lg-12;
margin-left: 15px;
width: 90%;
height: 600px; height: 600px;
} }
#map.qp, #map.cadastre { #map.qp, #map.cadastre {
@extend .col-md-9; @extend .col-md-9;
@extend .col-lg-9; @extend .col-lg-9;
width: 70%;
} }
.list { .list {
@ -35,6 +39,10 @@ table {
} }
} }
.leaflet-container path {
cursor: url('/assets/edit.png'), default !important;
}
#infos_dossier { #infos_dossier {
#map.mini { #map.mini {
height: 300px; height: 300px;
@ -42,8 +50,6 @@ table {
} }
} }
#map section.overlay { #map section.overlay {
position: absolute; position: absolute;
top: 0; top: 0;
@ -56,7 +62,7 @@ table {
} }
#map.mode-create { #map.mode-create {
cursor: crosshair !important; cursor: url('/assets/pencil.png'), crosshair !important;
} }
#map g path.tracer { #map g path.tracer {

View file

@ -1,13 +1,17 @@
%h2 %h2
='Localisation de votre demande' ='Localisation'
%h4.text-primary
Positionnez-vous et dessinez sur la carte la zone d'action de votre demande.
%br %br
.content{style:'margin-bottom:60px'} .content{style:'margin-bottom:60px'}
%button#new.btn.btn-sm.btn-success{type:'button'} Nouveau %button#new.btn.btn-md.btn-success{type:'button'}
\- %i.fa.fa-pencil
%button#edit.btn.btn-sm.btn-info{type:'button'} Editer Ajouter une zone
\- -#\-
%button#delete.btn.btn-sm.btn-danger{type:'button'} Supprimer -#%button#edit.btn.btn-sm.btn-info{type:'button'} Editer
-#\-
-#%button#delete.btn.btn-sm.btn-danger{type:'button'} Supprimer
%span#search_by_address{style: 'margin-left: 20px'} %span#search_by_address{style: 'margin-left: 20px'}
%input.form-control{type: :address, placeholder: 'Rechercher une adresse'} %input.form-control{type: :address, placeholder: 'Rechercher une adresse'}