Skip to content

Introduce template block for nav_pills #15406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 32 additions & 30 deletions weblate/templates/accounts/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,38 @@
{% endcompress %}
{% endblock extra_script %}

{% block nav_pills %}
<ul class="nav nav-pills">
<li class="active">
<a data-toggle="tab" href="#languages">{% translate "Languages" %}</a>
</li>
<li>
<a data-toggle="tab" href="#preferences">{% translate "Preferences" %}</a>
</li>
<li>
<a data-toggle="tab" href="#notifications">{% translate "Notifications" %}</a>
</li>
<li>
<a data-toggle="tab" href="#account">{% translate "Account" %}</a>
</li>
<li>
<a data-toggle="tab" href="#profile">{% translate "Profile" %}</a>
</li>
<li>
<a data-toggle="tab" href="#teams">{% translate "Teams" %}</a>
</li>
<li>
<a data-toggle="tab" href="#licenses">{% translate "Licenses" %}</a>
</li>
<li>
<a data-toggle="tab" href="#audit">{% translate "Audit log" %}</a>
</li>
<li>
<a data-toggle="tab" href="#api">{% translate "API access" %}</a>
</li>
</ul>
{% endblock nav_pills %}

{% block breadcrumbs %}
<li>
<a href="{% url 'profile' %}">{% translate "Your profile" %}</a>
Expand All @@ -27,36 +59,6 @@
{% csrf_token %}
<input type="hidden" id="form-activetab" name="activetab" value="" />

<ul class="nav nav-pills">
<li class="active">
<a data-toggle="tab" href="#languages">{% translate "Languages" %}</a>
</li>
<li>
<a data-toggle="tab" href="#preferences">{% translate "Preferences" %}</a>
</li>
<li>
<a data-toggle="tab" href="#notifications">{% translate "Notifications" %}</a>
</li>
<li>
<a data-toggle="tab" href="#account">{% translate "Account" %}</a>
</li>
<li>
<a data-toggle="tab" href="#profile">{% translate "Profile" %}</a>
</li>
<li>
<a data-toggle="tab" href="#teams">{% translate "Teams" %}</a>
</li>
<li>
<a data-toggle="tab" href="#licenses">{% translate "Licenses" %}</a>
</li>
<li>
<a data-toggle="tab" href="#audit">{% translate "Audit log" %}</a>
</li>
<li>
<a data-toggle="tab" href="#api">{% translate "API access" %}</a>
</li>
</ul>

<div class="tab-content">

<div class="tab-pane active" id="languages">
Expand Down
20 changes: 11 additions & 9 deletions weblate/templates/addons/addon_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

{% load crispy_forms_tags i18n permissions translations %}

{% block nav_pills %}
<ul class="nav nav-pills">
<li class="active">
<a href="#addons" data-toggle="tab">{% translate "Add-ons" %}</a>
</li>
<li>
<a href="#history" data-toggle="tab">{% translate "History" %}</a>
</li>
</ul>
{% endblock nav_pills %}

{% block breadcrumbs %}
{% if object %}
{% path_object_breadcrumbs object %}
Expand All @@ -20,15 +31,6 @@

{% block content %}

<ul class="nav nav-pills">
<li class="active">
<a href="#addons" data-toggle="tab">{% translate "Add-ons" %}</a>
</li>
<li>
<a href="#history" data-toggle="tab">{% translate "History" %}</a>
</li>
</ul>

<div class="tab-content">

<div class="tab-pane active" id="addons">
Expand Down
18 changes: 10 additions & 8 deletions weblate/templates/addons/webhook_log.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{% load i18n translations %}

{% if details %}
<ul class="nav nav-pills">
<li role="presentation" class="active">
<a href="#response-{{ activity.id }}" data-toggle="tab">{% translate "HTTP Response" %} <span class="badge">{{ details.response.status_code }}</span></a>
</li>
<li role="presentation">
<a href="#request-{{ activity.id }}" data-toggle="tab">{% translate "HTTP Request" %}</a>
</li>
</ul>
{% block nav_pills %}
<ul class="nav nav-pills">
<li role="presentation" class="active">
<a href="#response-{{ activity.id }}" data-toggle="tab">{% translate "HTTP Response" %} <span class="badge">{{ details.response.status_code }}</span></a>
</li>
<li role="presentation">
<a href="#request-{{ activity.id }}" data-toggle="tab">{% translate "HTTP Request" %}</a>
</li>
</ul>
{% endblock nav_pills %}

<div class="tab-content">
<div class="tab-pane active" id="response-{{ activity.id }}">
Expand Down
35 changes: 20 additions & 15 deletions weblate/templates/auth/team.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

{% load crispy_forms_tags humanize i18n icons permissions translations %}

{% block nav_pills %}
{% perm "meta:team.users" object as user_can_edit_team_users %}

<ul class="nav nav-pills">
<li role="presentation" class="active">
<a href="#basic" role="tab" data-toggle="tab">{% translate "Settings" %}</a>
</li>
{% if form %}
<li role="presentation">
<a href="#auto" role="tab" data-toggle="tab">{% translate "Automatic assignments" %}</a>
</li>
{% endif %}
{% if user_can_edit_team_users %}
<li role="presentation">
<a href="#users" role="tab" data-toggle="tab">{% translate "Members" %}</a>
</li>
{% endif %}
</ul>
{% endblock nav_pills %}

{% block breadcrumbs %}
{% if object.defining_project %}
<li>
Expand All @@ -28,21 +48,6 @@

<form method="post">
{% csrf_token %}
<ul class="nav nav-pills">
<li role="presentation" class="active">
<a href="#basic" role="tab" data-toggle="tab">{% translate "Settings" %}</a>
</li>
{% if form %}
<li role="presentation">
<a href="#auto" role="tab" data-toggle="tab">{% translate "Automatic assignments" %}</a>
</li>
{% endif %}
{% if user_can_edit_team_users %}
<li role="presentation">
<a href="#users" role="tab" data-toggle="tab">{% translate "Members" %}</a>
</li>
{% endif %}
</ul>

<div class="tab-content">
<div class="tab-pane active" id="basic">
Expand Down
3 changes: 3 additions & 0 deletions weblate/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,9 @@ <h1>
{% include 'snippets/menu.html' %}
{% endif %}

{% block nav_pills %}
{% endblock nav_pills %}

{% block content %}{% endblock %}

</div>
Expand Down
15 changes: 9 additions & 6 deletions weblate/templates/category-language.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

{% load crispy_forms_tags i18n metrics translations %}

{% block breadcrumbs %}
{% path_object_breadcrumbs path_object %}
{% endblock breadcrumbs %}

{% block content %}

{% block nav_pills %}
<ul class="nav nav-pills">
<li class="active">
<a href="#translation" data-toggle="tab">{% translate "Translation" %}</a>
Expand Down Expand Up @@ -70,6 +65,14 @@
</li>
{% include "snippets/watch-dropdown.html" with project=category.project %}
</ul>
{% endblock nav_pills %}

{% block breadcrumbs %}
{% path_object_breadcrumbs path_object %}
{% endblock breadcrumbs %}

{% block content %}


<div class="tab-content">

Expand Down
37 changes: 21 additions & 16 deletions weblate/templates/category.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,7 @@

{% load crispy_forms_tags i18n metrics permissions translations %}

{% block breadcrumbs %}
{% path_object_breadcrumbs path_object %}

<a class="pull-right flip" href="{{ object.get_widgets_url }}">
<img src="{% url 'widget-image' path=object.project.get_url_path widget='svg' color='badge' extension='svg' %}?native=1" />
</a>
{% endblock breadcrumbs %}

{% block content %}

{% announcements project=object.project %}

{% include "snippets/project/state.html" with object=object.project %}

{% include "snippets/watch-dropdown.html" with project=object.project %}

{% block nav_pills %}
{% perm 'project.edit' object as user_can_edit_project %}
{% perm 'reports.view' object as user_can_view_reports %}

Expand Down Expand Up @@ -121,6 +106,26 @@
</li>
{% include "snippets/share-menu.html" with object=object.project %}
</ul>
{% endblock nav_pills %}

{% block breadcrumbs %}
{% path_object_breadcrumbs path_object %}

<a class="pull-right flip" href="{{ object.get_widgets_url }}">
<img src="{% url 'widget-image' path=object.project.get_url_path widget='svg' color='badge' extension='svg' %}?native=1" />
</a>
{% endblock breadcrumbs %}

{% block content %}

{% announcements project=object.project %}

{% include "snippets/project/state.html" with object=object.project %}

{% include "snippets/watch-dropdown.html" with project=object.project %}

{% perm 'project.edit' object as user_can_edit_project %}
{% perm 'reports.view' object as user_can_view_reports %}

<div class="tab-content">
<div class="tab-pane" id="components">
Expand Down
18 changes: 10 additions & 8 deletions weblate/templates/component-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@

{% load crispy_forms_tags humanize i18n metrics translations %}

{% block breadcrumbs %}
<li>
<a href="{{ object.get_absolute_url }}">{{ object }}</a>
</li>
{% endblock breadcrumbs %}

{% block content %}

{% block nav_pills %}
<ul class="nav nav-pills">
<li class="active">
<a href="#overview" data-toggle="tab">{% translate "Components" %}</a>
Expand All @@ -29,6 +22,15 @@
</ul>
</li>
</ul>
{% endblock nav_pills %}

{% block breadcrumbs %}
<li>
<a href="{{ object.get_absolute_url }}">{{ object }}</a>
</li>
{% endblock breadcrumbs %}

{% block content %}

<div class="tab-content">

Expand Down
39 changes: 23 additions & 16 deletions weblate/templates/component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,7 @@

{% load compress crispy_forms_tags i18n metrics permissions static translations %}

{% block breadcrumbs %}
{% path_object_breadcrumbs path_object %}

<a class="pull-right flip" href="{{ object.get_widgets_url }}">
<img src="{% url 'widget-image' path=object.get_url_path widget='svg' color='badge' extension='svg' %}?native=1" />
</a>
{% endblock breadcrumbs %}

{% block content %}

{% announcements component=object %}

{% include "snippets/component/state.html" %}

{% include "snippets/watch-dropdown.html" with project=object.project component=object %}

{% block nav_pills %}
{% perm 'meta:vcs.status' object as user_can_see_repository_status %}
{% perm 'project.permissions' object as user_can_manage_acl %}
{% perm 'reports.view' object as user_can_view_reports %}
Expand Down Expand Up @@ -165,7 +150,29 @@
</li>
{% include "snippets/share-menu.html" with object=object %}
</ul>
{% endblock nav_pills %}

{% block breadcrumbs %}
{% path_object_breadcrumbs path_object %}

<a class="pull-right flip" href="{{ object.get_widgets_url }}">
<img src="{% url 'widget-image' path=object.get_url_path widget='svg' color='badge' extension='svg' %}?native=1" />
</a>
{% endblock breadcrumbs %}

{% block content %}

{% announcements component=object %}

{% include "snippets/component/state.html" %}

{% include "snippets/watch-dropdown.html" with project=object.project component=object %}

{% perm 'meta:vcs.status' object as user_can_see_repository_status %}
{% perm 'project.permissions' object as user_can_manage_acl %}
{% perm 'reports.view' object as user_can_view_reports %}
{% perm 'translation.add' object as user_can_add_translation %}
{% perm 'component.edit' object as user_can_edit_component %}

<div class="tab-content">
<div class="tab-pane active" id="translations">
Expand Down
20 changes: 11 additions & 9 deletions weblate/templates/fonts/font_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

{% load crispy_forms_tags i18n permissions translations %}

{% block nav_pills %}
<ul class="nav nav-pills">
<li class="active">
<a href="#groups" data-toggle="tab" id="tab_groups">{% translate "Font groups" %}</a>
</li>
<li>
<a href="#fonts" data-toggle="tab" id="tab_fonts">{% translate "Fonts" %}</a>
</li>
</ul>
{% endblock nav_pills %}

{% block breadcrumbs %}
<li>
<a href="{{ object.get_absolute_url }}">{{ object }}</a>
Expand All @@ -13,15 +24,6 @@

{% block content %}

<ul class="nav nav-pills">
<li class="active">
<a href="#groups" data-toggle="tab" id="tab_groups">{% translate "Font groups" %}</a>
</li>
<li>
<a href="#fonts" data-toggle="tab" id="tab_fonts">{% translate "Fonts" %}</a>
</li>
</ul>

<div class="tab-content">
<div class="tab-pane active" id="groups">

Expand Down
Loading
Loading