mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Passage par flags plutôt que par valeurs
This commit is contained in:
parent
fa6614adb5
commit
2ee17b370b
4 changed files with 14 additions and 6 deletions
|
@ -87,7 +87,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</li>
|
</li>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
<li>
|
<li>
|
||||||
{% history_button facture text='History' html_class=''%}
|
{% history_button facture text=True html_class=False%}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -36,8 +36,16 @@ def classname(obj):
|
||||||
|
|
||||||
|
|
||||||
@register.inclusion_tag('buttons/history.html')
|
@register.inclusion_tag('buttons/history.html')
|
||||||
def history_button(instance, text=None, html_class=None):
|
def history_button(instance, text=False, html_class=True):
|
||||||
"""Creates the correct history button for an instance."""
|
"""Creates the correct history button for an instance.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
instance: The instance of which you want to get history buttons.
|
||||||
|
text: Flag stating if a 'History' text should be displayed.
|
||||||
|
html_class: Flag stating if the link should have the html classes
|
||||||
|
allowing it to be displayed as a button.
|
||||||
|
|
||||||
|
"""
|
||||||
return {
|
return {
|
||||||
'application': instance._meta.app_label,
|
'application': instance._meta.app_label,
|
||||||
'name': instance._meta.model_name,
|
'name': instance._meta.model_name,
|
||||||
|
|
|
@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<a class="{{ class |default_if_none:"btn btn-info btn-sm"}}" role="button" title="Historique" href="{% url 'logs:history' application name id %}">
|
<a {% if class%}class="btn btn-info btn-sm"{% endif %} role="button" title="Historique" href="{% url 'logs:history' application name id %}">
|
||||||
<i class="fa fa-history"></i> {% if text %}{% trans text %}{% endif %}
|
<i class="fa fa-history"></i> {% if text %}{% trans 'History' %}{% endif %}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
Gérer les groupes
|
Gérer les groupes
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button users text="History" %}
|
{% history_button users text=True %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
Loading…
Reference in a new issue