Add add-on type to breadcrumb; bug 560413
This commit is contained in:
Родитель
2c4c203570
Коммит
e738501c20
|
@ -506,6 +506,13 @@ class AddonType(amo.models.ModelBase):
|
|||
def __unicode__(self):
|
||||
return unicode(self.name)
|
||||
|
||||
def get_url_path(self):
|
||||
try:
|
||||
type = amo.ADDON_SLUGS[self.id]
|
||||
except KeyError:
|
||||
return None
|
||||
return reverse('browse.%s' % type)
|
||||
|
||||
|
||||
class AddonUser(caching.CachingMixin, models.Model):
|
||||
AUTHOR_CHOICES = amo.AUTHOR_CHOICES.items()
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
{% block bodyclass %}inverse{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{{ breadcrumbs() }}
|
||||
{{ breadcrumbs([(addon.type.get_url_path(), amo.ADDON_TYPES[addon.type_id])]) }}
|
||||
|
||||
{% set version = addon.current_version %}
|
||||
{% set previews = addon.previews.all() %}
|
||||
|
|
|
@ -130,7 +130,7 @@ ADDON_TYPES = {
|
|||
ADDON_ANY: _(u'Any'),
|
||||
ADDON_EXTENSION: _(u'Extensions'),
|
||||
ADDON_THEME: _(u'Themes'),
|
||||
ADDON_DICT: _(u'Dictionaries & Language Packs'),
|
||||
ADDON_DICT: _(u'Dictionaries'),
|
||||
ADDON_SEARCH: _(u'Search Tools'),
|
||||
ADDON_PLUGIN: _(u'Plugins'),
|
||||
ADDON_LPAPP: _(u'Language Packs (Application)'),
|
||||
|
|
|
@ -164,7 +164,7 @@ def page_title(context, title):
|
|||
@jinja2.contextfunction
|
||||
def breadcrumbs(context, items=list(), add_default=True):
|
||||
"""
|
||||
show a list of breadcrumbs.
|
||||
show a list of breadcrumbs. If url is None, it won't be a link.
|
||||
Accepts: [(url, label)]
|
||||
"""
|
||||
if add_default:
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
{% if breadcrumbs %}
|
||||
<ol class="breadcrumbs">
|
||||
{% for target, label in breadcrumbs %}
|
||||
<li><a href="{{ target }}">{{ label }}</a></li>
|
||||
{% if target %}
|
||||
<li><a href="{{ target }}">{{ label }}</a></li>
|
||||
{% else %}
|
||||
<li>{{ label }}</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ol>
|
||||
{% endif %}
|
||||
|
|
Загрузка…
Ссылка в новой задаче