Skip to content

Commit

Permalink
chg: dev: netloc and tag link
Browse files Browse the repository at this point in the history
  • Loading branch information
rachmadaniHaryono committed Jul 18, 2018
1 parent e6144f8 commit a37f576
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions bukuserver/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ def _list_entry(self, context, model, name):
netloc, scheme = parsed_url.netloc, parsed_url.scheme
is_scheme_valid = scheme in ('http', 'https')
tag_text = []
tag_tmpl = '<a class="btn btn-default" href="#">{0}</a>'
tag_tmpl = '<a class="btn btn-default" href="{1}">{0}</a>'
for tag in model.tags.split(','):
if tag:
tag_text.append(tag_tmpl.format(tag))
tag_text.append(tag_tmpl.format(tag, url_for(
'bookmark.index_view', flt2_tags_contain=tag)))
if not netloc:
return Markup("""\
{0.title}<br/>{2}<br/>{1}{0.description}
Expand All @@ -100,13 +101,21 @@ def _list_entry(self, context, model, name):
else:
res += title
if self.url_render_mode == 'netloc':
res += ' ({})'.format(netloc)
res += ' (<a href="{1}">{0}</a>)'.format(
netloc,
url_for('bookmark.index_view', flt2_url_netloc_match=netloc)
)
res += '<br/>'
if not is_scheme_valid:
res += model.url
elif self.url_render_mode is None or self.url_render_mode == 'full':
res += '<a href="{0.url}">{0.url}</a>'.format(model)
res += '<br/>'
if self.url_render_mode != 'netloc':
res += tag_tmpl.format(
'netloc:{}'.format(netloc),
url_for('bookmark.index_view', flt2_url_netloc_match=netloc)
)
res += ''.join(tag_text)
description = model.description
if description:
Expand Down

0 comments on commit a37f576

Please sign in to comment.