Skip to content

[BUGFIX] "Home" link in the breadcrumb redirects to the "Services" page #588

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

Merged
Merged
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
7 changes: 2 additions & 5 deletions promgen/templates/promgen/farm_detail.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% load promgen %}

{% block content %}

Expand All @@ -12,11 +13,7 @@ <h1>
</h1>
</div>

<ol class="breadcrumb" v-pre>
<li><a href="{% url 'service-list' %}">Home</a></li>
<li><a href="{% url 'farm-list' %}">Farms</a></li>
<li class="active"><a href="{% url 'farm-detail' farm.id %}">{{ farm.name }}</a></li>
</ol>
{% breadcrumb farm %}

<div class="row" v-pre>

Expand Down
6 changes: 2 additions & 4 deletions promgen/templates/promgen/farm_duplicate.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{% extends "base.html" %}
{% load promgen %}

{% block content %}

<ol class="breadcrumb">
<li><a href="{% url 'service-list' %}">Home</a></li>
<li class="active">Convert Farm</li>
</ol>
{% breadcrumb label="Convert Farm" %}

<div class="panel panel-warning" v-pre>
<div class="panel-heading">Error converting farm. Duplicate detected</div>
Expand Down
8 changes: 2 additions & 6 deletions promgen/templates/promgen/farm_form.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{% extends "base.html" %}
{% load promgen %}

{% block content %}

<div class="page-header" v-pre>
<h1>Project: {{ project.name }}</h1>
</div>

<ol class="breadcrumb" v-pre>
<li><a href="{% url 'service-list' %}">Home</a></li>
<li><a href="{% url 'service-detail' project.service.id %}">{{ project.service.name }}</a></li>
<li><a href="{% url 'project-detail' project.id %}">{{ project.name }}</a></li>
<li class="active">{{ view.button_label }}</li>
</ol>
{% breadcrumb project view.button_label %}

<form method="post" v-pre>{% csrf_token %}
{{ form.as_p }}
Expand Down
6 changes: 2 additions & 4 deletions promgen/templates/promgen/host_404.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "base.html" %}
{% load promgen %}

{% block title %}No hosts found for {{ slug }}{% endblock %}

Expand All @@ -7,10 +8,7 @@
<h1>Host: {{ slug }}</h1>
</div>

<ol class="breadcrumb" v-pre>
<li><a href="{% url 'service-list' %}">Home</a></li>
<li class="active">{{ slug }}</li>
</ol>
{% breadcrumb label=slug %}

<div class="alert alert-danger" role="alert" v-pre>
No hosts found for {{ slug }}
Expand Down
6 changes: 2 additions & 4 deletions promgen/templates/promgen/host_detail.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{% extends "base.html" %}
{% load i18n %}
{% load promgen %}
{% block content %}

<div class="page-header" v-pre>
<h1>Host: {{ slug }}</h1>
</div>

<ol class="breadcrumb" v-pre>
<li><a href="{% url 'service-list' %}">Home</a></li>
<li class="active">{{ slug }}</li>
</ol>
{% breadcrumb label=slug %}

<div style="display:none" data-instance="{{slug}}" class="panel panel-danger promgen-alert">
<div class="panel-heading">Alerts</div>
Expand Down
8 changes: 2 additions & 6 deletions promgen/templates/promgen/host_form.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
{% extends "base.html" %}
{% load i18n %}
{% load promgen %}

{% block content %}

<div class="page-header" v-pre>
<h1>Farm: {{ farm.name }}</h1>
</div>

<ol class="breadcrumb" v-pre>
<li><a href="{% url 'service-list' %}">Home</a></li>
<li><a href="{% url 'service-detail' project.service.id %}">{{ project.service.name }}</a></li>
<li><a href="{% url 'project-detail' project.id %}">{{ project.name }}</a></li>
<li class="active">Add hosts to {{ farm.name }}</li>
</ol>
{% breadcrumb project label="Add hosts to "|add:farm.name %}

<form action="{% url 'hosts-add' farm.id %}" method="post" v-pre>{% csrf_token %}
<table>
Expand Down
7 changes: 3 additions & 4 deletions promgen/templates/promgen/host_list.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{% extends "base.html" %}
{% load promgen %}

{% block content %}

<div class="page-header">
<h1>Hosts</h1>
</div>

<ol class="breadcrumb">
<li><a href="{% url 'service-list' %}">Home</a></li>
<li class="active">All Hosts</li>
</ol>
{% breadcrumb label="All Hosts" %}

{% include "promgen/pagination_short.html" with page_obj=host_groups %}
<div class="panel panel-default">
<table class="table table-bordered table-condensed">
Expand Down
6 changes: 2 additions & 4 deletions promgen/templates/promgen/import_form.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{% extends "base.html" %}
{% load promgen %}

{% block content %}

<div class="page-header">
<h1>Import Configs</h1>
</div>

<ol class="breadcrumb">
<li><a href="{% url 'service-list' %}">Home</a></li>
<li class="active">Import Service</li>
</ol>
{% breadcrumb label="Import Service" %}

<div class="panel panel-default">
<div class="panel-heading">Import Targets</div>
Expand Down
8 changes: 2 additions & 6 deletions promgen/templates/promgen/link_farm.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{% extends "base.html" %}
{% load promgen %}

{% block content %}

<div class="page-header" v-pre>
<h1>Project: {{ project.name }}</h1>
</div>

<ol class="breadcrumb" v-pre>
<li><a href="{% url 'service-list' %}">Home</a></li>
<li><a href="{% url 'service-detail' project.service.id %}">{{ project.service.name }}</a></li>
<li><a href="{% url 'project-detail' project.id %}">{{ project.name }}</a></li>
<li class="active">Link Farm {{ source }}</li>
</ol>
{% breadcrumb project label="Link Farm "|add:source %}

<div class="panel panel-default" v-pre>
<div class="panel-heading">
Expand Down
6 changes: 2 additions & 4 deletions promgen/templates/promgen/rule_import.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{% extends "base.html" %}
{% load promgen %}

{% block content %}

<div class="page-header">
<h1>Import Rules</h1>
</div>

<ol class="breadcrumb">
<li><a href="{% url 'service-list' %}">Home</a></li>
<li class="active">Import Rule</li>
</ol>
{% breadcrumb label="Import Rule" %}

<div class="panel panel-default">
<div class="panel-heading">Import Rules</div>
Expand Down
5 changes: 1 addition & 4 deletions promgen/templates/promgen/rule_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
<h1>Rules</h1>
</div>

<ol class="breadcrumb">
<li><a href="{% url 'service-list' %}">Home</a></li>
<li class="active">List Rules</li>
</ol>
{% breadcrumb label="List Rules" %}
{% include "promgen/pagination_short.html" %}
{% regroup rule_list by content_object as grouped_rule_list %}

Expand Down
6 changes: 2 additions & 4 deletions promgen/templates/promgen/search.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{% extends "base.html" %}
{% load i18n %}
{% load promgen %}
{% block content %}

<div class="page-header">
<h1>Search</h1>
</div>

<ol class="breadcrumb">
<li><a href="{% url 'service-list' %}">Home</a></li>
<li class="active">Search</li>
</ol>
{% breadcrumb label="Search" %}

{% include "promgen/pagination_short.html" %}
{% if service_list %}
Expand Down
8 changes: 2 additions & 6 deletions promgen/templates/promgen/url_form.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{% extends "base.html" %}
{% load promgen %}

{% block content %}

<div class="page-header">
<h1 v-pre>Project: {{ project.name }}</h1>
</div>

<ol class="breadcrumb" v-pre>
<li><a href="{% url 'service-list' %}">Home</a></li>
<li><a href="{% url 'service-detail' project.service.id %}">{{ project.service.name }}</a></li>
<li><a href="{% url 'project-detail' project.id %}">{{ project.name }}</a></li>
<li class="active">Add URL to {{ farm.name }}</li>
</ol>
{% breadcrumb project label="Add URL" %}

<form action="{% url 'url-new' project.id %}" method="post" v-pre>{% csrf_token %}
<table>
Expand Down
8 changes: 7 additions & 1 deletion promgen/templatetags/promgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ def sender(obj):
if obj.content_type.model == "project":
yield from project(obj.content_object)

def farm(obj):
yield reverse("farm-list"), _("Farms")
yield obj.get_absolute_url(), obj.name

def generator():
yield reverse("home"), _("Home")
if isinstance(instance, models.Sender):
Expand All @@ -169,9 +173,11 @@ def generator():
yield from rule(instance)
if isinstance(instance, models.Alert):
yield from alert(instance)
if isinstance(instance, models.Farm):
yield from farm(instance)

def to_tag():
yield '<ol class="breadcrumb">'
yield '<ol class="breadcrumb" v-pre>'
for href, text in generator():
yield format_html('<li><a href="{}">{}</a></li>', mark_safe(href), text)
if label:
Expand Down