mirror of
https://github.com/umap-project/umap.git
synced 2025-05-04 21:51:50 +02:00
Compare commits
No commits in common. "dc35e7df6d64b7370da228a382cd9a04642633a1" and "5f2e104eec762bc674bbbd0a45bfbcdfe06496fc" have entirely different histories.
dc35e7df6d
...
5f2e104eec
8 changed files with 34 additions and 50 deletions
|
@ -146,13 +146,14 @@ class Feature {
|
|||
}
|
||||
|
||||
onCommit() {
|
||||
this.pullGeometry(false)
|
||||
// When the layer is a remote layer, we don't want to sync the creation of the
|
||||
// points via the websocket, as the other peers will get them themselves.
|
||||
const oldGeoJSON = this._just_married ? null : Utils.CopyJSON(this.toGeoJSON())
|
||||
this.pullGeometry(false)
|
||||
if (this.datalayer?.isRemoteLayer()) return
|
||||
if (this._needs_upsert) {
|
||||
if (this._just_married) {
|
||||
this.sync.upsert(this.toGeoJSON(), null)
|
||||
this._needs_upsert = false
|
||||
this._just_married = false
|
||||
} else {
|
||||
this.sync.update('geometry', this.geometry, this._geometry_bk)
|
||||
}
|
||||
|
|
|
@ -808,10 +808,9 @@ Fields.IconUrl = class extends Fields.BlurInput {
|
|||
}
|
||||
|
||||
addCategory(items, name) {
|
||||
const hidden = name ? '' : ' hidden'
|
||||
const [parent, { grid }] = Utils.loadTemplateWithRefs(`
|
||||
<div class="umap-pictogram-category">
|
||||
<h6${hidden}>${name}</h6>
|
||||
<h6 hidden=${!name}>${name}</h6>
|
||||
<div class="umap-pictogram-grid" data-ref=grid></div>
|
||||
</div>
|
||||
`)
|
||||
|
|
|
@ -8,20 +8,18 @@ import { AutocompleteCommunes } from './communesfr.js'
|
|||
const TEMPLATE = `
|
||||
<h3>Cadastre</h3>
|
||||
<p>Importer les données cadastrales d’une commune française.</p>
|
||||
<div class="formbox">
|
||||
<select name="theme">
|
||||
<option value="batiments">Bâtiments</option>
|
||||
<option value="communes">Communes</option>
|
||||
<option value="feuilles">Feuilles</option>
|
||||
<option value="lieux_dits">Lieux dits</option>
|
||||
<option value="parcelles" selected>Parcelles</option>
|
||||
<option value="prefixes_sections">Préfixes sections</option>
|
||||
<option value="sections">Sections</option>
|
||||
<option value="subdivisions_fiscales">Subdivisions fiscales</option>
|
||||
</select>
|
||||
<label id="boundary">
|
||||
</label>
|
||||
</div>
|
||||
<select name="theme">
|
||||
<option value="batiments">Bâtiments</option>
|
||||
<option value="communes">Communes</option>
|
||||
<option value="feuilles">Feuilles</option>
|
||||
<option value="lieux_dits">Lieux dits</option>
|
||||
<option value="parcelles" selected>Parcelles</option>
|
||||
<option value="prefixes_sections">Préfixes sections</option>
|
||||
<option value="sections">Sections</option>
|
||||
<option value="subdivisions_fiscales">Subdivisions fiscales</option>
|
||||
</select>
|
||||
<label id="boundary">
|
||||
</label>
|
||||
`
|
||||
|
||||
export class Importer {
|
||||
|
|
|
@ -16,17 +16,15 @@ const BOUNDARY_TYPES = {
|
|||
const TEMPLATE = `
|
||||
<h3>GeoDataMine</h3>
|
||||
<p>${translate('GeoDataMine: thematic data from OpenStreetMap')}.</p>
|
||||
<div class="formbox">
|
||||
<select name="theme">
|
||||
<option value="">${translate('Choose a theme')}</option>
|
||||
</select>
|
||||
<label>
|
||||
<input type="checkbox" name="aspoint" />
|
||||
${translate('Simplify all geometries to points')}
|
||||
</label>
|
||||
<label id="boundary">
|
||||
</label>
|
||||
</div>
|
||||
<select name="theme">
|
||||
<option value="">${translate('Choose a theme')}</option>
|
||||
</select>
|
||||
<label>
|
||||
<input type="checkbox" name="aspoint" />
|
||||
${translate('Symplify all geometries to points')}
|
||||
</label>
|
||||
<label id="boundary">
|
||||
</label>
|
||||
`
|
||||
|
||||
class Autocomplete extends SingleMixin(BaseAjax) {
|
||||
|
|
|
@ -629,7 +629,7 @@ U.Editable = L.Editable.extend({
|
|||
const line = new U.LineString(this._umap, datalayer, {
|
||||
geometry: { type: 'LineString', coordinates: [] },
|
||||
})
|
||||
line._needs_upsert = true
|
||||
line._just_married = true
|
||||
return line.ui
|
||||
},
|
||||
|
||||
|
@ -638,7 +638,7 @@ U.Editable = L.Editable.extend({
|
|||
const poly = new U.Polygon(this._umap, datalayer, {
|
||||
geometry: { type: 'Polygon', coordinates: [] },
|
||||
})
|
||||
poly._needs_upsert = true
|
||||
poly._just_married = true
|
||||
return poly.ui
|
||||
},
|
||||
|
||||
|
@ -647,7 +647,7 @@ U.Editable = L.Editable.extend({
|
|||
const point = new U.Point(this._umap, datalayer, {
|
||||
geometry: { type: 'Point', coordinates: [latlng.lng, latlng.lat] },
|
||||
})
|
||||
point._needs_upsert = true
|
||||
point._just_married = true
|
||||
return point.ui
|
||||
},
|
||||
|
||||
|
|
|
@ -325,7 +325,6 @@ ul.photon-autocomplete {
|
|||
}
|
||||
.umap-edit-enabled .photon-autocomplete li.on .search-result-tools {
|
||||
display: flex;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,15 +32,9 @@ FIXTURES = Path(__file__).parent.parent / "fixtures"
|
|||
@pytest.fixture
|
||||
def pictos():
|
||||
path = FIXTURES / "star.svg"
|
||||
Pictogram(
|
||||
name="star", pictogram=ContentFile(path.read_text(), path.name), category="cat1"
|
||||
).save()
|
||||
Pictogram(name="star", pictogram=ContentFile(path.read_text(), path.name)).save()
|
||||
path = FIXTURES / "circle.svg"
|
||||
Pictogram(
|
||||
name="circle",
|
||||
pictogram=ContentFile(path.read_text(), path.name),
|
||||
category="cat2",
|
||||
).save()
|
||||
Pictogram(name="circle", pictogram=ContentFile(path.read_text(), path.name)).save()
|
||||
|
||||
|
||||
def test_can_change_picto_at_map_level(openmap, live_server, page, pictos):
|
||||
|
@ -63,8 +57,6 @@ def test_can_change_picto_at_map_level(openmap, live_server, page, pictos):
|
|||
define.click()
|
||||
# No picto defined yet, so recent should not be visible
|
||||
expect(page.get_by_text("Recent")).to_be_hidden()
|
||||
expect(page.get_by_text("cat1")).to_be_visible()
|
||||
expect(page.get_by_text("cat2")).to_be_visible()
|
||||
symbols = page.locator(".umap-pictogram-body .umap-pictogram-choice")
|
||||
expect(symbols).to_have_count(2)
|
||||
search = page.locator(".umap-pictogram-body input")
|
||||
|
|
|
@ -1047,15 +1047,12 @@ class MapDelete(DeleteView):
|
|||
if not self.object.can_delete(self.request):
|
||||
return HttpResponseForbidden(_("Only its owner can delete the map."))
|
||||
self.object.move_to_trash()
|
||||
if self.request.user.is_authenticated:
|
||||
redirect_url = reverse("user_dashboard")
|
||||
else:
|
||||
redirect_url = reverse("home")
|
||||
home_url = reverse("home")
|
||||
messages.info(self.request, _("Map successfully deleted."))
|
||||
if is_ajax(self.request):
|
||||
return simple_json_response(redirect=redirect_url)
|
||||
return simple_json_response(redirect=home_url)
|
||||
else:
|
||||
return HttpResponseRedirect(form.data.get("next") or redirect_url)
|
||||
return HttpResponseRedirect(form.data.get("next") or home_url)
|
||||
|
||||
|
||||
class MapClone(PermissionsMixin, View):
|
||||
|
|
Loading…
Reference in a new issue