Skip to content

Commit

Permalink
Town6: Make deleting a link more accessible.
Browse files Browse the repository at this point in the history
TYPE: Bugfix
LINK: OGC-739
  • Loading branch information
cyrillkuettel authored Jan 30, 2025
1 parent 08e795f commit 4d318fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/onegov/org/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ def __call__(

return Markup(tostring(a, encoding=str)) # noqa: RUF035

def __repr__(self) -> str:
return f'<Link {self.text}>'


class QrCodeLink(BaseLink):
""" Implements a qr code link that shows a modal with the QrCode.
Expand Down
3 changes: 2 additions & 1 deletion src/onegov/org/views/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,10 @@ def handle_edit_page(

if self.page.deletable and self.page.trait == 'link':
edit_links = self.page.get_edit_links(request)
layout.editbar_links = list(filter(
links = layout.editmode_links + list(filter(
lambda link: getattr(link, 'text', '') == _('Delete'), edit_links
))
layout.editmode_links = links

if form.submitted(request):
form.populate_obj(self.page)
Expand Down
3 changes: 3 additions & 0 deletions tests/onegov/town6/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def test_links(client):
assert "Sie wurden nicht automatisch weitergeleitet" in link
assert 'https://www.google.ch' in link

edit_page = link.click('Bearbeiten')
assert edit_page.pyquery('.delete-link').text() == 'Löschen'

client.get('/auth/logout')

root_page = client.get(root_url)
Expand Down

0 comments on commit 4d318fc

Please sign in to comment.