mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-19 14:32:16 +00:00
Initial work on BS4 button templatetag
Newfeatureitis strikes again
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
{% load button from filters %}
|
||||
<div class="btn-group py-3">
|
||||
<a href="{% url 'event_update' event.pk %}" class="btn btn-warning"><span
|
||||
class="fas fa-edit"></span> <span
|
||||
class="hidden-xs">Edit</span></a>
|
||||
{% button 'event_update' event.pk 'edit' %}
|
||||
{% if event.is_rig %}
|
||||
<a href="{% url 'event_print' event.pk %}" target="_blank" class="btn btn-primary"><i
|
||||
class="fas fa-print"></i> <span
|
||||
class="hidden-xs">Print</span></a>
|
||||
{% button 'event_print' event.pk 'print' %}
|
||||
{% endif %}
|
||||
<a href="{% url 'event_duplicate' event.pk %}" class="btn btn-info" title="Duplicate Rig"><span
|
||||
class="fas fa-copy"></span> <span
|
||||
class="hidden-xs">Duplicate</span></a>
|
||||
{% button 'event_duplicate' event.pk 'duplicate' %}
|
||||
{% if event.is_rig %}
|
||||
{% if event.internal %}
|
||||
<a class="btn item-add modal-href event-authorise-request
|
||||
|
||||
@@ -186,3 +186,20 @@ def linkornone(attr, namespace, autoescape=True):
|
||||
return mark_safe("<a href='{}://{}' target='_blank'><span class='overflow-ellipsis'>{}</span></a>".format(namespace, attr, str(attr)))
|
||||
else:
|
||||
return "None"
|
||||
|
||||
|
||||
@register.inclusion_tag('button.html')
|
||||
def button(url, pk, type, clazz=None, icon=None, text=None):
|
||||
if type == 'edit':
|
||||
clazz = "btn-warning"
|
||||
icon = "fa-edit"
|
||||
text = "Edit"
|
||||
elif type == 'print':
|
||||
clazz = "btn-primary"
|
||||
icon = "fa-print"
|
||||
text = "Print"
|
||||
elif type == 'duplicate':
|
||||
clazz = "btn-info"
|
||||
icon = "fa-copy"
|
||||
text = "Duplicate"
|
||||
return {'target': url, 'id': pk, 'class': clazz, 'icon': icon, 'text': text}
|
||||
|
||||
Reference in New Issue
Block a user