overlays
default geomtype, permission fix, name fix, remove ungrouped header, fix id filter
This commit is contained in:
parent
13cf207ee6
commit
934aa60be4
10 changed files with 96 additions and 41 deletions
|
@ -422,6 +422,7 @@ def create_editor_form(editor_model):
|
|||
'color_ground_fill', 'color_obstacles_default_fill', 'color_obstacles_default_border',
|
||||
'stroke_color', 'stroke_width', 'fill_color', 'interactive', 'point_icon', 'extra_data',
|
||||
'show_label', 'show_geometry', 'external_url',
|
||||
'show_label', 'show_geometry', 'external_url', 'default_geomtype',
|
||||
]
|
||||
field_names = [field.name for field in editor_model._meta.get_fields()
|
||||
if not field.one_to_many and not isinstance(field, ManyToManyRel)]
|
||||
|
|
|
@ -1370,6 +1370,7 @@ editor = {
|
|||
}
|
||||
form.addClass('creation-lock');
|
||||
const geomtypes = form.attr('data-geomtype').split(',');
|
||||
const default_geomtype = form.attr('data-default-geomtype');
|
||||
|
||||
const startGeomEditing = (geomtype) => {
|
||||
editor._creating_type = geomtype;
|
||||
|
@ -1387,6 +1388,8 @@ editor = {
|
|||
}
|
||||
}
|
||||
|
||||
let selected_geomtype = geomtypes[0];
|
||||
|
||||
if (geomtypes.length > 1) {
|
||||
const selector = $('<select id="geomtype-selector"></select>');
|
||||
const geomtypeNames = {
|
||||
|
@ -1395,13 +1398,18 @@ editor = {
|
|||
point: 'Point'
|
||||
}; // TODO: translations
|
||||
for(const geomtype of geomtypes) {
|
||||
selector.append(`<option value="${geomtype}">${geomtypeNames[geomtype]}</option>`);
|
||||
const option = $(`<option value="${geomtype}">${geomtypeNames[geomtype]}</option>`);
|
||||
if (geomtype === default_geomtype) {
|
||||
option.attr('selected', true);
|
||||
selected_geomtype = geomtype;
|
||||
}
|
||||
selector.append(option);
|
||||
}
|
||||
|
||||
selector.on('change', e => startGeomEditing(e.target.value));
|
||||
form.prepend(selector);
|
||||
}
|
||||
startGeomEditing(geomtypes[0]);
|
||||
startGeomEditing(selected_geomtype);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
{% endif %}
|
||||
</h3>
|
||||
{% bootstrap_messages %}
|
||||
<form action="{{ path }}" method="post" {% if nozoom %}data-nozoom {% endif %}data-onbeforeunload {% if new %}data-new="{{ model_name }}" data-geomtype="{{ geomtype }}"{% else %}data-editing="{{ model_name }}-{{ pk }}"{% endif %}{% if access_restriction_select %} data-access-restriction-select{% endif %}>
|
||||
<form action="{{ path }}" method="post" {% if nozoom %}data-nozoom {% endif %}data-onbeforeunload {% if new %}data-new="{{ model_name }}" data-geomtype="{{ geomtype }}" {% if default_geomtype %}data-default-geomtype="{{ default_geomtype }}{% endif %}"{% else %}data-editing="{{ model_name }}-{{ pk }}"{% endif %}{% if access_restriction_select %} data-access-restriction-select{% endif %}>
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
{% buttons %}
|
||||
|
|
|
@ -130,6 +130,7 @@ def overlay_feature_edit(request, level=None, overlay=None, pk=None):
|
|||
'title': obj.title if obj else None,
|
||||
'geometry_url': geometry_url,
|
||||
'geomtype': 'polygon,linestring,point',
|
||||
'default_geomtype': overlay.default_geomtype,
|
||||
}
|
||||
|
||||
space_id = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue