TT#180600 release_dashboard: introduce templatetags

* we can't use '.' at html if attribute

Change-Id: I15b94aeb8200ea24853ac9dfa92df8f179d0bd37
pull/7/head
Victor Seva 3 years ago
parent dd26740524
commit 653f0e629b

@ -1,5 +1,6 @@
{% extends "release_dashboard/base.html" %}
{% load static %}
{% load rd_extras %}
{% block title %}Build release{% endblock %}
{% block navlist %}
<li><a href="{% url 'release_dashboard:index'%}">Release Dashboard</a></li>
@ -16,7 +17,7 @@
{% for base, data_list in releases_list %}
{% if base != 'master' %}
<li role="presentation">
<a href="#{{base|cut:'.'}}" aria-controls="{{base|cut:'.'}}"
<a href="#{{base|replace_dots:'_'}}" aria-controls="{{base|replace_dots:'_'}}"
role="tab" data-toggle="tab">{{base}}</a>
</li>
{% endif %}
@ -25,7 +26,7 @@
<div class="tab-content col-md-8">
{% for base, data_list in releases_list %}
{% if base != 'master' %}
<div role="tabpanel" class="tab-pane" id="{{base|cut:'.'}}">
<div role="tabpanel" class="tab-pane" id="{{base|replace_dots:'_'}}">
<ul class="list-group row">
{% for data in data_list %}
<li class="list-group-item col-xs-2 {% if data.release in builds %}list-group-item-info{% endif %}">

@ -0,0 +1,25 @@
# Copyright (C) 2022 The Sipwise Team - http://sipwise.com
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter
@stringfilter
def replace_dots(value, arg):
"""Replaces all values of '.' to arg from the given string"""
return value.replace(".", arg)
Loading…
Cancel
Save