Make preview images' titles clickable, taking users straight to the document view.

This commit is contained in:
Roberto Rosario
2015-07-29 21:39:18 -04:00
parent bc71796571
commit 0b109920bb
2 changed files with 12 additions and 1 deletions

View File

@@ -152,6 +152,11 @@
.btn-block {
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
}
.a-caption {
color: white;
}
</style>
{% block stylesheets %}{% endblock %}
@@ -342,6 +347,9 @@
$('.scrollable').scrollview();
$('a.fancybox').fancybox({
beforeShow : function(){
this.title = $(this.element).data('caption');
},
openEffect : 'elastic',
closeEffect : 'elastic',
prevEffect : 'none',

View File

@@ -127,7 +127,10 @@ def document_html_widget(document_page, click_view=None, click_view_arguments=No
)
if title:
title_template = 'title="%s"' % strip_tags(title)
preview_click_link = document.get_absolute_url()
title_template = 'data-caption="<a class=\'a-caption\' href=\'{url}\'>{title}</a>"'.format(
title=strip_tags(title), url=preview_click_link or '#'
)
else:
title_template = ''