mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
recipedetail: don't show homepage as link if not URL
Sometimes people put values that aren't URLs into the HOMEPAGE variable. If that's the case, then we should not turn that value into a link which will be invalid. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
d5b0d578a6
commit
7ddf8f58d6
|
@ -292,6 +292,12 @@ class Recipe(models.Model):
|
||||||
else:
|
else:
|
||||||
return self.filename.split('_')[0]
|
return self.filename.split('_')[0]
|
||||||
|
|
||||||
|
def homepage_url_only(self):
|
||||||
|
if '://' in self.homepage:
|
||||||
|
return self.homepage
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return os.path.join(self.filepath, self.filename)
|
return os.path.join(self.filepath, self.filename)
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,13 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Homepage</th>
|
<th>Homepage</th>
|
||||||
<td>{% if recipe.homepage %}<a href="{{ recipe.homepage }}">{{ recipe.homepage }}</a>{% endif %}</td>
|
<td>
|
||||||
|
{% if recipe.homepage_url_only %}
|
||||||
|
<a href="{{ recipe.homepage }}">{{ recipe.homepage }}</a>
|
||||||
|
{% elif recipe.homepage %}
|
||||||
|
{{ recipe.homepage }}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if recipe.bugtracker %}
|
{% if recipe.bugtracker %}
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user