Skip to content

Commit

Permalink
fix(BookmarkModelView): dont render tag with netloc when no netloc
Browse files Browse the repository at this point in the history
  • Loading branch information
rachmadaniHaryono committed Jan 21, 2022
1 parent 715d0c9 commit ea6fdd8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bukuserver/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,22 @@ def _list_entry(self, context: Any, model: Namespace, name: str) -> Markup:
)
title = model.title if model.title else "<EMPTY TITLE>"
open_in_new_tab = current_app.config.get("BUKUSERVER_OPEN_IN_NEW_TAB", False)
url_for_index_view_netloc = get_index_view_url(flt2_url_netloc_match=netloc)
url_for_index_view_netloc = None
if netloc:
url_for_index_view_netloc = get_index_view_url(flt2_url_netloc_match=netloc)
if parsed_url.scheme and not open_in_new_tab:
target = 'target="_blank"' if open_in_new_tab else ""
res.append(f'<a href="{model.url}"{target}>{title}</a>')
else:
res.append(title)
if self.url_render_mode == "netloc":
if self.url_render_mode == "netloc" and url_for_index_view_netloc:
res.append(f'(<a href="{url_for_index_view_netloc}">{netloc}</a>)')
res.append(br_tag)
if not parsed_url.scheme:
res.extend((model.url, br_tag))
elif self.url_render_mode is None or self.url_render_mode == "full":
res.extend((f'<a href="{model.url}">{model.url}</a>', br_tag))
if self.url_render_mode != "netloc":
if self.url_render_mode != "netloc" and url_for_index_view_netloc:
res.append(
f'<a class="btn btn-default" href="{url_for_index_view_netloc}">netloc:{netloc}</a>'
)
Expand Down

0 comments on commit ea6fdd8

Please sign in to comment.