Move edit action into the saved-places dropdown
CI / Lint (pull_request) Successful in 51s
CI / Test (pull_request) Successful in 1m9s
Release Drafter / Update release notes draft (pull_request) Successful in 41s

The edit form only changes the saved entry's title and description, not the
OSM data, so surface it under the Save dropdown as "Edit saved place"
instead of a standalone action button.

This also keeps the actions row to Save and Share with even padding, so the
earlier equal-width row layout is no longer needed.
This commit is contained in:
raucao committed 2026-11-16 13:01:11 +04:00
1 parent 53b5c2d2a4
commit 509fc08268
4 files changed
+83 -14

No files matched your search

+1 -13
View File
@@ -581,6 +581,7 @@ export default class PlaceDetails extends Component {
<PlaceListsManager
@place={{this.saveablePlace}}
@onClose={{this.closeLists}}
@onEdit={{this.startEditing}}
@isSaved={{this.isSaved}}
/>
{{/if}}
@@ -608,19 +609,6 @@ export default class PlaceDetails extends Component {
{{/if}}
</div>
{{/if}}
{{#if this.isSaved}}
<button
type="button"
class="btn btn-outline"
title="Edit"
disabled={{this.isEditing}}
{{on "click" this.startEditing}}
>
<Icon @name="edit" @color="var(--link-color)" />
Edit
</button>
{{/if}}
</div>
<PlacePaymentMethods @tags={{this.tags}} />
+15
View File
@@ -6,6 +6,7 @@ import { on } from '@ember/modifier';
import { fn } from '@ember/helper';
import { htmlSafe } from '@ember/template';
import onClickOutside from '../modifiers/on-click-outside';
import Icon from './icon';
export default class PlaceListsManager extends Component {
@service storage;
@@ -94,6 +95,12 @@ export default class PlaceListsManager extends Component {
}
}
@action
editPlace() {
this.args.onClose?.();
this.args.onEdit?.();
}
<template>
<div class="place-lists-manager" {{onClickOutside @onClose}}>
<div class="list-item master-toggle">
@@ -130,6 +137,14 @@ export default class PlaceListsManager extends Component {
</div>
{{/each}}
</div>
{{#if this.isSaved}}
<div class="divider"></div>
<button type="button" class="edit-item" {{on "click" this.editPlace}}>
<Icon @name="edit" />
<span class="list-name">Edit saved place</span>
</button>
{{/if}}
</div>
</template>
}
+19
View File
@@ -1831,6 +1831,25 @@ button.create-place {
background: var(--hover-bg);
}
.place-lists-manager .edit-item {
padding: 0.5rem 1rem;
display: flex;
align-items: center;
gap: 0.75rem;
width: 100%;
background: none;
border: none;
text-align: left;
font-family: inherit;
font-size: 0.95rem;
color: var(--body-text-color);
cursor: pointer;
}
.place-lists-manager .edit-item:hover {
background: var(--hover-bg);
}
.place-lists-manager label {
display: flex;
align-items: center;
@@ -723,7 +723,8 @@ module('Integration | Component | place-details', function (hooks) {
assert.dom('.share-button-wrapper').exists();
await click('button[title="Edit"]');
await click('.save-button-wrapper button');
await click('.place-lists-manager .edit-item');
assert.dom('.share-button-wrapper').doesNotExist();
});
@@ -759,4 +760,50 @@ module('Integration | Component | place-details', function (hooks) {
assert.dom('.place-share-menu').includesText('Copy link');
assert.dom('.place-share-menu').includesText('Copy coordinates');
});
test('it opens the edit form from the saved-place dropdown', async function (assert) {
class SavedStorage extends Service {
lists = [];
isPlaceSaved() {
return true;
}
}
this.owner.register('service:storage', SavedStorage);
const place = {
id: 'saved-1',
title: 'Saved Spot',
lat: 40,
lon: 40,
createdAt: '2023-01-01',
};
await render(<template><PlaceDetails @place={{place}} /></template>);
assert.dom('.place-lists-manager').doesNotExist();
assert.dom('.edit-form').doesNotExist();
await click('.save-button-wrapper button');
assert.dom('.place-lists-manager .edit-item').exists();
assert
.dom('.place-lists-manager .edit-item')
.includesText('Edit saved place');
await click('.place-lists-manager .edit-item');
assert.dom('.place-lists-manager').doesNotExist();
assert.dom('.edit-form').exists();
});
test('it does not offer the edit item for an unsaved place', async function (assert) {
const place = { title: 'New Spot', lat: 41, lon: 41 };
await render(<template><PlaceDetails @place={{place}} /></template>);
await click('.save-button-wrapper button');
assert.dom('.place-lists-manager').exists();
assert.dom('.place-lists-manager .edit-item').doesNotExist();
});
});