Commit 987b701a authored by Claude Paroz's avatar Claude Paroz

Display a special icon when documentation is in mallard format

parent efcb057a
......@@ -658,6 +658,16 @@ class Domain(models.Model):
else:
return self.potbase()
def get_type(self, branch):
""" Returns the type of the domain (ui, docbook, mallard) """
if self.dtype == "ui":
return "ui"
else:
if os.access(os.path.join(branch.co_path(), self.directory, "C", "index.page"), os.R_OK):
return "mallard"
else:
return "docbook"
def get_lang_files(self, base_path):
""" Returns a list of language files on filesystem, as tuple (lang, lang_file) -> lang_file with complete path """
flist = []
......
......@@ -23,6 +23,10 @@ def escapeat(value):
"""Replace '@' with '__', accepted sequence in JS ids."""
return value.replace('@', '__')
@register.filter
def domain_type(stat):
return stat.domain.get_type(stat.branch)
class IfLessNode(template.Node):
def __init__(self, val1, val2, nodelist_true, nodelist_false):
self.val1 = val1
......
{# parent template has to define variable modstats #}
{% load i18n %}
{% load i18n stats_extras %}
<table>
<tr>
......@@ -61,6 +61,9 @@
{% for err in stat.info_list %}
<img src="{{ err.get_icon }}" title="{{ err.get_description|striptags }}" alt="{{ err.type }}" />
{% endfor %}
{% if stat|domain_type == "mallard" %}
<img src="{{ MEDIA_URL }}img/mallard.png" width="16" title="{% trans "This document is written in Mallard documentation format" %}" alt="mallard icon"/>
{% endif %}
</td>
<td><span class="branch">{{ branch }}</span></td>
<td><span style="display:none;">{{ stat.tr_percentage }}</span>
......
{% load i18n %}
{% load i18n stats_extras %}
{% for dname, stat in stats.items %}
{% with stat|first as pot_stat %}
<h3>{% trans pot_stat.domain.get_description %}
{% if pot_stat|domain_type == "mallard" %}
<img src="{{ MEDIA_URL }}img/mallard.png" width="20" title="{% trans "This document is written in Mallard documentation format" %}" alt="mallard icon"/>
{% endif %}
{% ifnotequal pot_stat.domain.directory 'help' %}
{% ifnotequal pot_stat.domain.directory 'po' %}
<br />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment