Commit e97101bb authored by fred's avatar fred

don't allow focus on soundfiles without a type

parent 5253438b
...@@ -95,13 +95,13 @@ def set_focus_url(object): ...@@ -95,13 +95,13 @@ def set_focus_url(object):
@register.filter @register.filter
def can_focus(object): def can_focus(object):
if isinstance(object, NewsItem): if isinstance(object, NewsItem):
return True return bool(object.category and object.image)
elif isinstance(object, Emission): elif isinstance(object, Emission):
return True return True
elif isinstance(object, Episode): elif isinstance(object, Episode):
return True return True
elif isinstance(object, SoundFile): elif isinstance(object, SoundFile):
return True return bool(object.format)
return False return False
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block manage-focus %} {% block manage-focus %}
{% if object|can_focus %} {% if object|can_focus or object|has_focus %}
{% if perms.emissions.add_focus %} {% if perms.emissions.add_focus %}
{% if object|has_focus %} {% if object|has_focus %}
<a class="icon-pushpin" href="{{ object|unset_focus_url }}">Retirer le focus</a> <a class="icon-pushpin" href="{{ object|unset_focus_url }}">Retirer le focus</a>
......
...@@ -100,7 +100,9 @@ Tags : ...@@ -100,7 +100,9 @@ Tags :
{% if soundfile.has_focus %} {% if soundfile.has_focus %}
<a class="icon-pushpin" href="{{ soundfile|unset_focus_url }}">retirer</a> <a class="icon-pushpin" href="{{ soundfile|unset_focus_url }}">retirer</a>
{% else %} {% else %}
<a class="icon-pushpin" href="{{ soundfile|set_focus_url }}">mettre</a> {% if soundfile.format %}
<a class="icon-pushpin" href="{{ soundfile|set_focus_url }}">mettre</a>
{% endif %}
{% endif %} {% endif %}
</td> </td>
{% endif %} {% endif %}
......
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