Skip to content

Commit

Permalink
Move back link into breadcrumb container
Browse files Browse the repository at this point in the history
  • Loading branch information
codeinthehole committed Apr 24, 2013
1 parent 3fbda67 commit bdb25e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
17 changes: 9 additions & 8 deletions oscar/templates/oscar/catalogue/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@
</li>
{% endfor %}
<li class="active">{{ product.title }}</li>

{% get_back_button as backbutton %}
{% if backbutton %}
<li class="pull-right">
<a href="{{ backbutton.url }}">
<i class="icon-arrow-left"></i> {{ backbutton.title }}
</a>
</li>
{% endif %}
{% endwith %}
</ul>
{% endblock %}
Expand All @@ -37,16 +46,8 @@
{% endblock header %}

{% block content %}
{% get_back_button as backbutton %}

<article class="product_page"><!-- Start of product page -->
{% if backbutton %}
<a href="{{ backbutton.url }}" class="pull-right">
<i class="icon-arrow-left"></i>
{{ backbutton.title }}
</a>
{% endif %}

{% comment %}
This is a but clunky here. Better to have some kind of JS-driven dashboard menu that
pops out when clicked. A bit like the Django-Debug-Toolbar button
Expand Down
7 changes: 5 additions & 2 deletions oscar/templatetags/history_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ def recently_viewed_products(context):

@register.assignment_tag(takes_context=True)
def get_back_button(context):
"""Show back button, custom title available for different urls, for
"""
Show back button, custom title available for different urls, for
example 'Back to search results', no back button if user came from other
site"""
site
"""
request = context.get('request', None)
if not request:
raise Exception('Cannot get request from context')
Expand All @@ -65,6 +67,7 @@ def get_back_button(context):
except Resolver404:
return None

# This dict can be extended to link back to other browsing pages
titles = {
'search:search': _('Back to search results'),
}
Expand Down

0 comments on commit bdb25e0

Please sign in to comment.