From 6fb6b1eeb02bf20165c4d595c876b886419c8d1c Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Tue, 13 Oct 2020 10:37:12 -0700 Subject: [PATCH] Add Bookmark.display_name, just like Album. --- etiquette/objects.py | 7 +++++++ frontends/etiquette_flask/templates/bookmarks.html | 6 +----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/etiquette/objects.py b/etiquette/objects.py index 05530aa..38a15b5 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -639,6 +639,13 @@ class Bookmark(ObjectBase): self._uncache() self.deleted = True + @property + def display_name(self): + if self.title: + return self.title + else: + return self.id + @decorators.required_feature('bookmark.edit') @decorators.transaction def edit(self, title=None, url=None): diff --git a/frontends/etiquette_flask/templates/bookmarks.html b/frontends/etiquette_flask/templates/bookmarks.html index dff02a5..70bbd3c 100644 --- a/frontends/etiquette_flask/templates/bookmarks.html +++ b/frontends/etiquette_flask/templates/bookmarks.html @@ -58,11 +58,7 @@ data-editor-placeholder="title (optional)" data-editor-empty-text="{{bookmark.id}}" > - {%- if bookmark.title -%} - {{bookmark.title}} - {%- else -%} - {{bookmark.id}} - {%- endif -%} + {{-bookmark.display_name-}}