more editor.js refactoring (get_features)
This commit is contained in:
parent
65759805ea
commit
249f67bb19
2 changed files with 15 additions and 10 deletions
|
@ -96,12 +96,7 @@ editor = {
|
||||||
|
|
||||||
$('.leaflet-levels').on('click', 'a', function (e) {
|
$('.leaflet-levels').on('click', 'a', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (editor._creating !== null || editor._editing !== null) return;
|
editor.set_current_level($(this).attr('name'));
|
||||||
editor.level_layers[editor._level].remove();
|
|
||||||
editor._level = $(this).attr('name');
|
|
||||||
editor.level_layers[editor._level].addTo(editor.map);
|
|
||||||
$('.leaflet-levels .current').removeClass('current');
|
|
||||||
$(this).addClass('current');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var level;
|
var level;
|
||||||
|
@ -116,6 +111,14 @@ editor = {
|
||||||
editor.level_layers[editor._level].addTo(editor.map);
|
editor.level_layers[editor._level].addTo(editor.map);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
set_current_level: function(name) {
|
||||||
|
if (editor._creating !== null || editor._editing !== null) return;
|
||||||
|
editor.level_layers[editor._level].remove();
|
||||||
|
editor._level = $(this).attr('name');
|
||||||
|
editor.level_layers[editor._level].addTo(editor.map);
|
||||||
|
$('.leaflet-levels .current').removeClass('current');
|
||||||
|
$('.leaflet-levels a[name='+name+']').addClass('current');
|
||||||
|
},
|
||||||
|
|
||||||
init_drawing: function () {
|
init_drawing: function () {
|
||||||
// Add drawing new features
|
// Add drawing new features
|
||||||
|
@ -151,9 +154,11 @@ editor = {
|
||||||
|
|
||||||
$('#mapeditdetail').on('click', '#btn_editing_cancel', editor.cancel_editing)
|
$('#mapeditdetail').on('click', '#btn_editing_cancel', editor.cancel_editing)
|
||||||
.on('submit', 'form', editor.submit_editing);
|
.on('submit', 'form', editor.submit_editing);
|
||||||
|
|
||||||
|
editor.get_features();
|
||||||
},
|
},
|
||||||
|
|
||||||
reload_features: function (feature_type) {
|
get_features: function () {
|
||||||
$('.start-drawing').prop('disabled', false);
|
$('.start-drawing').prop('disabled', false);
|
||||||
$('#mapeditcontrols').addClass('list');
|
$('#mapeditcontrols').addClass('list');
|
||||||
},
|
},
|
||||||
|
@ -223,7 +228,7 @@ editor = {
|
||||||
editor._creating = null;
|
editor._creating = null;
|
||||||
$('#mapeditcontrols').removeClass('detail');
|
$('#mapeditcontrols').removeClass('detail');
|
||||||
$('#mapeditdetail').html('');
|
$('#mapeditdetail').html('');
|
||||||
editor.reload_features();
|
editor.get_features();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
submit_editing: function(e) {
|
submit_editing: function(e) {
|
||||||
|
@ -240,7 +245,7 @@ editor = {
|
||||||
} else {
|
} else {
|
||||||
editor._editing = null;
|
editor._editing = null;
|
||||||
editor._creating = null;
|
editor._creating = null;
|
||||||
editor.reload_features();
|
editor.get_features();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
<div id="mapeditcontrols" class="list">
|
<div id="mapeditcontrols">
|
||||||
<div id="mapeditlist"></div>
|
<div id="mapeditlist"></div>
|
||||||
<div id="mapeditdetail"></div>
|
<div id="mapeditdetail"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue