chore: change edit button order

This commit is contained in:
Yohan Boniface 2024-03-13 11:42:51 +01:00
parent e4ecb1a847
commit 2a2f38e3cd
9 changed files with 72 additions and 46 deletions

View file

@ -274,11 +274,13 @@ input[type="file"] + .error {
margin-top: 0;
}
.fieldset {
border: 1px solid #222;
margin-bottom: 5px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.dark .fieldset {
border: 1px solid #222;
}
.fieldset .fields {
visibility: hidden;
opacity: 0;
@ -296,7 +298,7 @@ input[type="file"] + .error {
text-align: left;
display: block;
cursor: pointer;
background-color: #eee;
background-color: var(--color-lightGray);
height: 30px;
line-height: 30px;
margin: 0;
@ -976,6 +978,7 @@ input:invalid {
bottom: initial;
width: 390px;
border-radius: 5px;
border: 1px solid var(--color-lightGray);
}
}
@media all and (orientation:portrait) {

View file

@ -57,8 +57,8 @@
</g>
<path id="path1286" d="m24.352 6.3088h0.03307v-3.6125h-3.7796v3.6125h0.03307zm-3.9787-4.1591h4.2439c0.06157 0 0.12062 0.024461 0.16417 0.068002s0.068 0.1026 0.068 0.16417v4.2439c0 0.061569-0.02445 0.12062-0.068 0.16417-0.04355 0.04355-0.1026 0.067998-0.16417 0.067998h-4.2439c-0.06158 0-0.12063-0.024447-0.16417-0.067998-0.04354-0.04355-0.068-0.10261-0.068-0.16417v-4.2439c0-0.061577 0.02446-0.12063 0.068-0.16417 0.04354-0.043541 0.1026-0.068002 0.16417-0.068002z" fill="#f2f2f2" stroke="#999" stroke-width=".065719"/>
</g>
<g id="info" transform="matrix(.33073 0 0 .33073 -11.642 -255.84)" stroke-width=".8">
<path id="path3762" d="m108 838.36a8 8 0 0 0-8 8 8 8 0 0 0 8 8 8 8 0 0 0 8-8 8 8 0 0 0-8-8zm0 2.5a1.5 1.5 0 0 1 1.5 1.5 1.5 1.5 0 0 1-1.5 1.5 1.5 1.5 0 0 1-1.5-1.5 1.5 1.5 0 0 1 1.5-1.5zm-1 4.5h2v6h-2v-6z" fill="#f2f2f2" stroke="#999" stroke-width=".2"/>
<g id="info" transform="matrix(.33073 0 0 .33073 -11.906 -256.1)" stroke-width=".8">
<path id="path3762" d="m108 838.36a8 8 0 0 0-8 8 8 8 0 0 0 8 8 8 8 0 0 0 8-8 8 8 0 0 0-8-8zm0 2.5a1.5 1.5 0 0 1 1.5 1.5 1.5 1.5 0 0 1-1.5 1.5 1.5 1.5 0 0 1-1.5-1.5 1.5 1.5 0 0 1 1.5-1.5zm-1 4.5h2v6h-2z" fill="#f2f2f2" stroke="#999" stroke-width=".2"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -2,7 +2,7 @@
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg width="180" height="180" viewBox="0 0 47.624994 47.624994" version="1.1" id="svg2876" inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)" sodipodi:docname="24-white.svg" inkscape:export-filename="../24-white.svg" inkscape:export-xdpi="7.52" inkscape:export-ydpi="7.52" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview id="namedview2878" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:showpageshadow="2" inkscape:pageopacity="0.0" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:document-units="px" showgrid="true" showguides="true" inkscape:zoom="8.2673128" inkscape:cx="89.509133" inkscape:cy="93.077402" inkscape:window-width="1920" inkscape:window-height="1011" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="layer1">
<sodipodi:namedview id="namedview2878" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:showpageshadow="2" inkscape:pageopacity="0.0" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:document-units="px" showgrid="true" showguides="true" inkscape:zoom="8.2673128" inkscape:cx="89.569612" inkscape:cy="93.077402" inkscape:window-width="1920" inkscape:window-height="1011" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="layer1">
<inkscape:grid type="xygrid" id="grid2997" empspacing="4" originx="0" originy="0" spacingy="0.2645833" spacingx="0.2645833" units="px" visible="true" />
<sodipodi:guide position="9.525,47.625" orientation="-1,0" id="guide3404" inkscape:locked="false" inkscape:label="" inkscape:color="rgb(0,134,229)" />
<sodipodi:guide position="0,38.099995" orientation="0,1" id="guide3408" inkscape:locked="false" inkscape:label="" inkscape:color="rgb(0,134,229)" />
@ -78,8 +78,8 @@
</g>
<path d="m 24.352274,6.3088036 h 0.03307 v -0.033073 -3.5463449 -0.033073 h -0.03307 -3.713451 -0.03307 v 0.033073 3.5463449 0.033073 h 0.03307 z m -3.978696,-4.1590643 h 4.24394 c 0.06157,0 0.120624,0.024461 0.164174,0.068002 0.04355,0.043541 0.068,0.102595 0.068,0.1641723 v 4.2439399 c 0,0.061569 -0.02445,0.1206236 -0.068,0.164174 -0.04355,0.04355 -0.102605,0.067998 -0.164174,0.067998 h -4.24394 c -0.06158,0 -0.120631,-0.024447 -0.164172,-0.067998 -0.04354,-0.04355 -0.068,-0.1026054 -0.068,-0.164174 v -4.2439399 c 0,-0.061577 0.02446,-0.1206315 0.068,-0.1641723 0.04354,-0.043541 0.102595,-0.068002 0.164172,-0.068002 z" fill="#f2f2f2" stroke="#999999" stroke-width="0.0657188" id="path1286" />
</g>
<g id="info" transform="matrix(0.33072916,0,0,0.33072916,-11.641666,-255.83957)" style="stroke-width:0.8">
<path id="path3762" style="fill:#f2f2f2;fill-opacity:1;stroke:#999999;stroke-width:0.19999998;stroke-opacity:1;stroke-dasharray:none" d="M 107.99999 838.36217 A 8 8 0 0 0 99.999992 846.36217 A 8 8 0 0 0 107.99999 854.36217 A 8 8 0 0 0 115.99999 846.36217 A 8 8 0 0 0 107.99999 838.36217 z M 107.99999 840.86217 A 1.5 1.5 0 0 1 109.49999 842.36217 A 1.5 1.5 0 0 1 107.99999 843.86217 A 1.5 1.5 0 0 1 106.49999 842.36217 A 1.5 1.5 0 0 1 107.99999 840.86217 z M 106.99999 845.36217 L 108.99999 845.36217 L 108.99999 851.36217 L 106.99999 851.36217 L 106.99999 845.36217 z " />
<g id="info" transform="matrix(0.33072916,0,0,0.33072916,-11.906249,-256.10415)" style="stroke-width:0.8">
<path id="path3762" style="fill:#f2f2f2;fill-opacity:1;stroke:#999999;stroke-width:0.2;stroke-dasharray:none;stroke-opacity:1" d="m 107.99999,838.36217 a 8,8 0 0 0 -7.999998,8 8,8 0 0 0 7.999998,8 8,8 0 0 0 8,-8 8,8 0 0 0 -8,-8 z m 0,2.5 a 1.5,1.5 0 0 1 1.5,1.5 1.5,1.5 0 0 1 -1.5,1.5 1.5,1.5 0 0 1 -1.5,-1.5 1.5,1.5 0 0 1 1.5,-1.5 z m -1,4.5 h 2 v 6 h -2 z" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View file

@ -29,11 +29,23 @@ U.ImportAction = U.BaseAction.extend({
},
})
U.EditCaptionAction = U.BaseAction.extend({
options: {
helpMenu: true,
className: 'umap-control-caption dark',
tooltip: L._('Edit map name and caption'),
},
addHooks: function () {
this.map.editCaption()
},
})
U.EditPropertiesAction = U.BaseAction.extend({
options: {
helpMenu: true,
className: 'update-map-settings dark',
tooltip: L._('Edit map properties'),
tooltip: L._('Map advanced properties'),
},
addHooks: function () {
@ -268,12 +280,8 @@ U.ContinueLineAction = U.BaseVertexAction.extend({
})
// Leaflet.Toolbar doesn't allow twice same toolbar class…
U.SettingsToolbar = L.Toolbar.Control.extend({
addTo: function (map) {
if (map.options.editMode !== 'advanced') return
L.Toolbar.Control.prototype.addTo.call(this, map)
},
})
U.ImportToolbar = L.Toolbar.Control.extend({})
U.SettingsToolbar = L.Toolbar.Control.extend({})
U.DrawToolbar = L.Toolbar.Control.extend({
initialize: function (options) {
L.Toolbar.Control.prototype.initialize.call(this, options)
@ -512,13 +520,12 @@ U.DataLayersControl = L.Control.Button.extend({
U.CaptionControl = L.Control.Button.extend({
options: {
position: 'topright',
className: 'umap-control-caption',
className: 'umap-control-caption hide-on-edit',
title: L._('About'),
},
onClick: function () {
if (this.map.editEnabled) this.map.editCaption()
else this.map.displayCaption()
this.map.displayCaption()
},
})
@ -532,14 +539,25 @@ U.DataLayer.include({
renderToolbox: function (container) {
L.DomUtil.element(
'i',
{ className: 'umap-icon-16 drag-handle show-on-edit', title: L._('Drag to reorder') },
{
className: 'umap-icon-16 drag-handle show-on-edit',
title: L._('Drag to reorder'),
},
container
)
const toggle = L.DomUtil.create('i', 'umap-icon-16 layer-toggle', container),
zoomTo = L.DomUtil.create('i', 'umap-icon-16 layer-zoom_to', container),
edit = L.DomUtil.create('i', 'umap-icon-16 layer-edit show-on-edit', container),
table = L.DomUtil.create('i', 'umap-icon-16 layer-table-edit show-on-edit', container),
remove = L.DomUtil.create('i', 'umap-icon-16 layer-delete show-on-edit', container)
table = L.DomUtil.create(
'i',
'umap-icon-16 layer-table-edit show-on-edit',
container
),
remove = L.DomUtil.create(
'i',
'umap-icon-16 layer-delete show-on-edit',
container
)
zoomTo.title = L._('Zoom to layer extent')
toggle.title = L._('Show/hide layer')
edit.title = L._('Edit')

View file

@ -329,16 +329,19 @@ U.Map = L.Map.extend({
if (this.hasEditMode() && !this.options.noControl) {
new U.EditControl(this).addTo(this)
new U.DrawToolbar({ map: this }).addTo(this)
const editActions = [
U.ImportAction,
U.EditCaptionAction,
U.EditPropertiesAction,
U.ChangeTileLayerAction,
U.UpdateExtentAction,
U.UpdatePermsAction,
]
if (this.options.editMode === 'advanced') {
new U.SettingsToolbar({ actions: editActions }).addTo(this)
new U.ImportToolbar({ actions: [U.ImportAction] }).addTo(this)
}
new U.DrawToolbar({ map: this }).addTo(this)
}
this._controls.zoom = new L.Control.Zoom({
zoomInTitle: L._('Zoom in'),
@ -1537,7 +1540,7 @@ U.Map = L.Map.extend({
if (this.options.editMode !== 'advanced') return
const container = L.DomUtil.create('div', 'umap-edit-container')
const title = L.DomUtil.create('h3', '', container)
title.textContent = L._('Edit map properties')
title.textContent = L._('Map advanced properties')
this._editControls(container)
this._editShapeProperties(container)
this._editDefaultProperties(container)

View file

@ -287,8 +287,8 @@ ul.photon-autocomplete {
.leaflet-control-toolbar > li > .leaflet-toolbar-icon,
.umap-toolbar a,
.umap-toolbar a:hover {
height: 40px;
width: 40px;
height: 36px;
width: 36px;
display: none;
margin-top: 0;
vertical-align: top;
@ -922,21 +922,20 @@ ul.photon-autocomplete {
.umap-edit-enabled .show-on-edit.block {
display: block!important;
}
.umap-edit-enabled .hide-on-edit {
display: none!important;
}
/* ********************************* */
/* Browser panel */
/* ********************************* */
.umap-control-caption [type="button"],
.umap-control-browse [type="button"] {
background-image: url('./img/24.svg');
width: 40px;
height: 40px;
background-position: -34px -70px;
background-size: 180px;
background-position: -36px -72px;
}
a.umap-control-caption,
.umap-control-caption [type="button"] {
background-position: -70px -70px;
background-position: -72px -72px;
}
.umap-edit-enabled .umap-control-caption [type="button"],
.umap-edit-enabled .umap-control-browse [type="button"] {
@ -981,7 +980,7 @@ i.drag-handle {
border: 1px solid #d3d3d3;
}
.umap-browser.dark .datalayer ul {
border: 1px solid #2c3233;
border: 1px solid #232729;
}
.umap-browser h5, .umap-facet-search h5 {
margin-bottom: 0;
@ -993,7 +992,7 @@ i.drag-handle {
color: #666;
}
.umap-browser.dark h5 {
background-color: #2c3233;
background-color: #232729;
color: white;
}
.umap-browser h5 span {
@ -1025,6 +1024,9 @@ i.drag-handle {
text-align: center;
margin-left: 5px;
}
.umap-browser.dark .datalayer i.feature-color {
box-shadow: 0 0 2px 0 #999 inset;
}
.umap-browser .datalayer .feature-color img {
width: 24px;
}

View file

@ -34,7 +34,7 @@ def test_map_load_with_owner(anonymap, live_server, owner_session):
expect(save).to_be_visible()
add_marker = owner_session.get_by_title("Draw a marker")
expect(add_marker).to_be_visible()
edit_settings = owner_session.get_by_title("Edit map properties")
edit_settings = owner_session.get_by_title("Map advanced properties")
expect(edit_settings).to_be_visible()
edit_permissions = owner_session.get_by_title("Update permissions and editors")
expect(edit_permissions).to_be_visible()
@ -65,7 +65,7 @@ def test_map_load_with_anonymous_but_editable_layer(
expect(save).to_be_visible()
add_marker = page.get_by_title("Draw a marker")
expect(add_marker).to_be_visible()
edit_settings = page.get_by_title("Edit map properties")
edit_settings = page.get_by_title("Map advanced properties")
expect(edit_settings).to_be_hidden()
edit_permissions = page.get_by_title("Update permissions and editors")
expect(edit_permissions).to_be_hidden()

View file

@ -22,7 +22,7 @@ def test_map_update_with_owner(map, live_server, login):
expect(save).to_be_visible()
add_marker = page.get_by_title("Draw a marker")
expect(add_marker).to_be_visible()
edit_settings = page.get_by_title("Edit map properties")
edit_settings = page.get_by_title("Map advanced properties")
expect(edit_settings).to_be_visible()
edit_permissions = page.get_by_title("Update permissions and editors")
expect(edit_permissions).to_be_visible()
@ -49,7 +49,7 @@ def test_map_update_with_anonymous_but_editable_datalayer(
enable.click()
add_marker = page.get_by_title("Draw a marker")
expect(add_marker).to_be_visible()
edit_settings = page.get_by_title("Edit map properties")
edit_settings = page.get_by_title("Map advanced properties")
expect(edit_settings).to_be_hidden()
edit_permissions = page.get_by_title("Update permissions and editors")
expect(edit_permissions).to_be_hidden()
@ -97,7 +97,7 @@ def test_map_update_with_editor(map, live_server, login, user):
expect(save).to_be_visible()
add_marker = page.get_by_title("Draw a marker")
expect(add_marker).to_be_visible()
edit_settings = page.get_by_title("Edit map properties")
edit_settings = page.get_by_title("Map advanced properties")
expect(edit_settings).to_be_visible()
edit_permissions = page.get_by_title("Update permissions and editors")
expect(edit_permissions).to_be_visible()
@ -126,7 +126,7 @@ def test_permissions_form_with_editor(map, datalayer, live_server, login, user):
def test_owner_has_delete_map_button(map, live_server, login):
page = login(map.owner)
page.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
settings = page.get_by_title("Edit map properties")
settings = page.get_by_title("Map advanced properties")
expect(settings).to_be_visible()
settings.click()
advanced = page.get_by_text("Advanced actions")
@ -154,7 +154,7 @@ def test_editor_do_not_have_delete_map_button(map, live_server, login, user):
map.save()
page = login(user)
page.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
settings = page.get_by_title("Edit map properties")
settings = page.get_by_title("Map advanced properties")
expect(settings).to_be_visible()
settings.click()
advanced = page.get_by_text("Advanced actions")

View file

@ -44,7 +44,7 @@ def test_can_change_picto_at_map_level(openmap, live_server, page, pictos):
expect(marker).to_have_count(1)
# Should have default img
expect(marker).to_have_attribute("src", "/static/umap/img/marker.svg")
edit_settings = page.get_by_title("Edit map properties")
edit_settings = page.get_by_title("Map advanced properties")
expect(edit_settings).to_be_visible()
edit_settings.click()
shape_settings = page.get_by_text("Default shape properties")
@ -152,7 +152,7 @@ def test_can_use_remote_url_as_picto(openmap, live_server, page, pictos):
expect(marker).to_have_count(1)
# Should have default img
expect(marker).to_have_attribute("src", "/static/umap/img/marker.svg")
edit_settings = page.get_by_title("Edit map properties")
edit_settings = page.get_by_title("Map advanced properties")
expect(edit_settings).to_be_visible()
edit_settings.click()
shape_settings = page.get_by_text("Default shape properties")
@ -191,7 +191,7 @@ def test_can_use_char_as_picto(openmap, live_server, page, pictos):
marker = page.locator(".umap-div-icon span")
# Should have default img, so not a span
expect(marker).to_have_count(0)
edit_settings = page.get_by_title("Edit map properties")
edit_settings = page.get_by_title("Map advanced properties")
expect(edit_settings).to_be_visible()
edit_settings.click()
shape_settings = page.get_by_text("Default shape properties")