diff --git a/weblate/templates/addons/addon_detail.html b/weblate/templates/addons/addon_detail.html index 42794697c39e..6a50894e952d 100644 --- a/weblate/templates/addons/addon_detail.html +++ b/weblate/templates/addons/addon_detail.html @@ -5,8 +5,7 @@ {% load permissions %} {% block breadcrumbs %} -
  • {{ object.project }}
  • -{% include "snippets/component-breadcrumb.html" %} +{% path_object_breadcrumbs object %}
  • {% trans "Add-ons" %}
  • {% if instance %} diff --git a/weblate/templates/addons/addon_list.html b/weblate/templates/addons/addon_list.html index 931d7bdb9d2f..db69e00e1175 100644 --- a/weblate/templates/addons/addon_list.html +++ b/weblate/templates/addons/addon_list.html @@ -5,8 +5,7 @@ {% load permissions %} {% block breadcrumbs %} -
  • {{ object.project }}
  • -{% include "snippets/component-breadcrumb.html" %} +{% path_object_breadcrumbs object %}
  • {% trans "Add-ons" %}
  • {% endblock %} diff --git a/weblate/templates/browse.html b/weblate/templates/browse.html index 9b84be97102f..f8e1b45c087f 100644 --- a/weblate/templates/browse.html +++ b/weblate/templates/browse.html @@ -15,11 +15,8 @@ {% endblock %} {% block breadcrumbs %} -
  • {{ project }}
  • -{% if object.component.slug != "-" %} -{% include "snippets/component-breadcrumb.html" with object=object.component %} -{% endif %} -{% include "snippets/translation-breadcrumb.html" %} +{% path_object_breadcrumbs object %} +
  • {% trans "Browse" %}
  • diff --git a/weblate/templates/component-progress.html b/weblate/templates/component-progress.html index bf318c94b1a1..311597f605ba 100644 --- a/weblate/templates/component-progress.html +++ b/weblate/templates/component-progress.html @@ -4,8 +4,8 @@ {% load permissions %} {% block breadcrumbs %} -
  • {{ object.project }}
  • -{% include "snippets/component-breadcrumb.html" %} +{% path_object_breadcrumbs object %} +
  • {% trans "Progress" %}
  • {% endblock %} diff --git a/weblate/templates/component-settings.html b/weblate/templates/component-settings.html index 6abadf56d931..ff9478660894 100644 --- a/weblate/templates/component-settings.html +++ b/weblate/templates/component-settings.html @@ -4,8 +4,7 @@ {% load crispy_forms_tags %} {% block breadcrumbs %} -
  • {{ object.project }}
  • -{% include "snippets/component-breadcrumb.html" %} +{% path_object_breadcrumbs object %}
  • {% trans "Settings" %}
  • {% endblock %} diff --git a/weblate/templates/component.html b/weblate/templates/component.html index 613ccde3a437..52985bc998dc 100644 --- a/weblate/templates/component.html +++ b/weblate/templates/component.html @@ -6,8 +6,7 @@ {% load metrics %} {% block breadcrumbs %} -
  • {{ object.project }}
  • -{% include "snippets/component-breadcrumb.html" %} +{% path_object_breadcrumbs path_object %} diff --git a/weblate/templates/contributor-agreement.html b/weblate/templates/contributor-agreement.html index 06c52921a1d9..9dd3f57abcd0 100644 --- a/weblate/templates/contributor-agreement.html +++ b/weblate/templates/contributor-agreement.html @@ -4,8 +4,7 @@ {% load crispy_forms_tags %} {% block breadcrumbs %} -
  • {{ object.project }}
  • -{% include "snippets/component-breadcrumb.html" %} +{% path_object_breadcrumbs object %}
  • {% trans "Contributor agreement" %}
  • {% endblock %} diff --git a/weblate/templates/guide.html b/weblate/templates/guide.html index 5b403d1312fb..d5743f6f9955 100644 --- a/weblate/templates/guide.html +++ b/weblate/templates/guide.html @@ -5,8 +5,7 @@ {% load icons %} {% block breadcrumbs %} -
  • {{ object.project }}
  • -{% include "snippets/component-breadcrumb.html" %} +{% path_object_breadcrumbs path_object %}
  • {% trans "Community localization checklist" %}
  • diff --git a/weblate/templates/matrix.html b/weblate/templates/matrix.html index 102b16f07db1..3761ce3a687f 100644 --- a/weblate/templates/matrix.html +++ b/weblate/templates/matrix.html @@ -4,8 +4,7 @@ {% load icons %} {% block breadcrumbs %} -
  • {{ object.project }}
  • -{% include "snippets/component-breadcrumb.html" %} +{% path_object_breadcrumbs object %}
  • {% trans "Matrix" %}
  • {% endblock %} diff --git a/weblate/templates/new-language.html b/weblate/templates/new-language.html index cd84d511bbe8..03c053eb0adf 100644 --- a/weblate/templates/new-language.html +++ b/weblate/templates/new-language.html @@ -5,8 +5,7 @@ {% load crispy_forms_tags %} {% block breadcrumbs %} -
  • {{ object.project }}
  • -{% include "snippets/component-breadcrumb.html" %} +{% path_object_breadcrumbs path_object %} {% endblock %} {% block content %} diff --git a/weblate/templates/project.html b/weblate/templates/project.html index 2b8e8d37b8d8..a3546c8e17c7 100644 --- a/weblate/templates/project.html +++ b/weblate/templates/project.html @@ -6,7 +6,7 @@ {% load metrics %} {% block breadcrumbs %} -
  • {{ object }}
  • +{% path_object_breadcrumbs path_object %} diff --git a/weblate/templates/replace.html b/weblate/templates/replace.html index cc490a5dacc3..1c33dbf56c3e 100644 --- a/weblate/templates/replace.html +++ b/weblate/templates/replace.html @@ -4,18 +4,7 @@ {% load icons %} {% block breadcrumbs %} -
  • {{ project.name }}
  • -{% if component %} -{% include "snippets/component-breadcrumb.html" with object=component %} -{% if translation %} -{% include "snippets/translation-breadcrumb.html" with object=translation %} -{% endif %} -{% elif language %} -
  • - {{ language }} -
  • - -{% endif %} +{% path_object_breadcrumbs path_object %}
  • {% trans "Search and replace" %}
  • {% endblock %} diff --git a/weblate/templates/screenshots/screenshot_detail.html b/weblate/templates/screenshots/screenshot_detail.html index a0ae2bd7ec60..267294fe45f2 100644 --- a/weblate/templates/screenshots/screenshot_detail.html +++ b/weblate/templates/screenshots/screenshot_detail.html @@ -6,8 +6,7 @@ {% load icons %} {% block breadcrumbs %} -
  • {{ object.translation.component.project }}
  • -{% include "snippets/component-breadcrumb.html" with object=object.translation.component %} +{% path_object_breadcrumbs object.translation.component %}
  • {% trans "Screenshots" %}
  • {{ object.name }}
  • {% endblock %} diff --git a/weblate/templates/screenshots/screenshot_list.html b/weblate/templates/screenshots/screenshot_list.html index cc67e17b6ac1..35f4fcac8e30 100644 --- a/weblate/templates/screenshots/screenshot_list.html +++ b/weblate/templates/screenshots/screenshot_list.html @@ -6,8 +6,7 @@ {% load icons %} {% block breadcrumbs %} -
  • {{ object.project }}
  • -{% include "snippets/component-breadcrumb.html" %} +{% path_object_breadcrumbs object %}
  • {% trans "Screenshots" %}
  • {% endblock %} diff --git a/weblate/templates/snippets/component-breadcrumb.html b/weblate/templates/snippets/component-breadcrumb.html deleted file mode 100644 index 74abb65753e5..000000000000 --- a/weblate/templates/snippets/component-breadcrumb.html +++ /dev/null @@ -1,6 +0,0 @@ -
  • - - {% include "snippets/component-glossary-badge.html" %} - {{ object.name }} - -
  • diff --git a/weblate/templates/snippets/translation-breadcrumb.html b/weblate/templates/snippets/translation-breadcrumb.html deleted file mode 100644 index c186248fe4b6..000000000000 --- a/weblate/templates/snippets/translation-breadcrumb.html +++ /dev/null @@ -1,9 +0,0 @@ -{% load icons %} -
  • - - {{ object.language }} - {% if object.is_source %} - {% icon "source.svg" %} - {% endif %} - -
  • diff --git a/weblate/templates/translate.html b/weblate/templates/translate.html index 07adc0ca6693..e4fc45d71410 100644 --- a/weblate/templates/translate.html +++ b/weblate/templates/translate.html @@ -19,14 +19,7 @@ {% endblock %} {% block breadcrumbs %} -
  • {{ project }}
  • -{% if object.component.slug != "-" %} -{% include "snippets/component-breadcrumb.html" with object=object.component %} -{% endif %} -{% include "snippets/translation-breadcrumb.html" %} -{% if object.component.slug == "-" %} -
  • {{ unit.translation.component.name }}
  • -{% endif %} +{% path_object_breadcrumbs path_object %}
  • {% trans "Translate" %}
  • diff --git a/weblate/templates/translation.html b/weblate/templates/translation.html index fc831fddd78d..e3ecf39b3819 100644 --- a/weblate/templates/translation.html +++ b/weblate/templates/translation.html @@ -7,9 +7,8 @@ {% load metrics %} {% block breadcrumbs %} -
  • {{ object.component.project }}
  • -{% include "snippets/component-breadcrumb.html" with object=object.component %} -{% include "snippets/translation-breadcrumb.html" %} +{% path_object_breadcrumbs path_object %} + diff --git a/weblate/templates/zen.html b/weblate/templates/zen.html index 20eef06bf6d3..132deba76e8a 100644 --- a/weblate/templates/zen.html +++ b/weblate/templates/zen.html @@ -18,11 +18,7 @@ {% endblock %} {% block breadcrumbs %} -
  • {{ project }}
  • -{% if object.component.slug != "-" %} -{% include "snippets/component-breadcrumb.html" with object=object.component %} -{% endif %} -{% include "snippets/translation-breadcrumb.html" %} +{% path_object_breadcrumbs path_object %}
  • {% trans "Zen" %}
  • diff --git a/weblate/trans/views/basic.py b/weblate/trans/views/basic.py index 152131ccc629..8ef478ae21fc 100644 --- a/weblate/trans/views/basic.py +++ b/weblate/trans/views/basic.py @@ -141,6 +141,7 @@ def show_engage(request, path): { "allow_index": True, "object": obj, + "path_object": obj, "project": project, "full_stats": obj.stats, "languages": stats_obj.languages, @@ -211,6 +212,7 @@ def show_project(request, obj): { "allow_index": True, "object": obj, + "path_object": obj, "project": obj, "last_changes": last_changes, "last_announcements": last_announcements, @@ -272,6 +274,7 @@ def show_component(request, obj): { "allow_index": True, "object": obj, + "path_object": obj, "project": obj.project, "component": obj, "translations": translations, @@ -358,6 +361,7 @@ def show_translation(request, obj): "translation.html", { "allow_index": True, + "path_object": obj, "object": obj, "project": project, "component": obj.component, @@ -484,6 +488,7 @@ def new_language(request, path): "new-language.html", { "object": obj, + "path_object": obj, "project": obj.project, "component": obj, "form": form, @@ -526,6 +531,7 @@ def guide(request, path): "guide.html", { "object": obj, + "path_object": obj, "project": obj.project, "component": obj, "guidelines": obj.guidelines, diff --git a/weblate/trans/views/edit.py b/weblate/trans/views/edit.py index 3970df133ffe..77c08ab8d09d 100644 --- a/weblate/trans/views/edit.py +++ b/weblate/trans/views/edit.py @@ -632,6 +632,7 @@ def translate(request, path): # noqa: C901 request, "translate.html", { + "path_object": obj, "this_unit_url": this_unit_url, "first_unit_url": base_unit_url + "1", "last_unit_url": base_unit_url + str(num_results), @@ -901,6 +902,7 @@ def load_zen(request, path): "zen-units.html", { "object": obj, + "path_object": obj, "project": project, "component": obj.component if not isinstance(obj, ProjectLanguage) @@ -1032,6 +1034,7 @@ def browse(request, path): "browse.html", { "object": obj, + "path_object": obj, "project": project, "component": getattr(obj, "component", None), "units": units, diff --git a/weblate/utils/views.py b/weblate/utils/views.py index f18cde6faa0a..c768a4de0ae0 100644 --- a/weblate/utils/views.py +++ b/weblate/utils/views.py @@ -219,7 +219,7 @@ def parse_path( def parse_path_units(request, path: list[str], types: tuple[Any]): obj = parse_path(request, path, types) - context = {"components": None} + context = {"components": None, "path_object": obj} if isinstance(obj, Translation): unit_set = obj.unit_set.all() context["translation"] = obj