mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Rework button tag
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
{% load static %}
|
||||
{% load help_text from filters %}
|
||||
{% load profile_by_index from filters %}
|
||||
{% load button from filters %}
|
||||
|
||||
{% block title %}{% if edit %}Edit{% else %}Create{% endif %} Event Checklist for Event N{{ event.pk|stringformat:"05d" }}{% endblock %}
|
||||
|
||||
@@ -362,11 +363,7 @@
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col-sm-12 text-right">
|
||||
<div class="btn-group">
|
||||
<button type="submit" class="btn btn-primary" title="Save"><i
|
||||
class="fas fa-save"></i> Save
|
||||
</button>
|
||||
</div>
|
||||
{% button 'submit' %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{% load button from filters %}
|
||||
<div class="btn-group py-3">
|
||||
{% button 'event_update' event.pk 'edit' %}
|
||||
{% button 'edit' 'event_update' event.pk %}
|
||||
{% if event.is_rig %}
|
||||
{% button 'event_print' event.pk 'print' %}
|
||||
{% button 'print' 'event_print' event.pk %}
|
||||
{% endif %}
|
||||
{% button 'event_duplicate' event.pk 'duplicate' %}
|
||||
{% button 'duplicate' 'event_duplicate' event.pk %}
|
||||
{% if event.is_rig %}
|
||||
{% if event.internal %}
|
||||
<a class="btn item-add modal-href event-authorise-request
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{% load button from filters %}
|
||||
{% if object.pk != None %}
|
||||
<div class="btn-group">
|
||||
{% button view object.pk 'view' %}
|
||||
{% button edit object.pk 'edit' %}
|
||||
{% button 'view' view object.pk %}
|
||||
{% button 'edit' edit object.pk %}
|
||||
</div>
|
||||
{% if object.reviewed_by %}
|
||||
<span class='badge badge-success py-2'>Reviewed by <a href='{% url 'profile_detail' object.reviewed_by.pk %}'>{{object.reviewed_by}}</a> at {{object.reviewed_at}}</span>
|
||||
|
||||
@@ -189,7 +189,7 @@ def linkornone(attr, namespace, autoescape=True):
|
||||
|
||||
|
||||
@register.inclusion_tag('button.html')
|
||||
def button(url, pk, type, clazz=None, icon=None, text=None):
|
||||
def button(type, url=None, pk=None, clazz=None, icon=None, text=None):
|
||||
if type == 'edit':
|
||||
clazz = "btn-warning"
|
||||
icon = "fa-edit"
|
||||
@@ -206,4 +206,6 @@ def button(url, pk, type, clazz=None, icon=None, text=None):
|
||||
clazz = "btn-primary"
|
||||
icon = "fa-eye"
|
||||
text = "View"
|
||||
elif type == 'submit':
|
||||
return {'submit': True, 'class': 'btn-primary', 'icon': 'fa-save', 'text': 'Save'}
|
||||
return {'target': url, 'id': pk, 'class': clazz, 'icon': icon, 'text': text}
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
{% if submit %}
|
||||
<button type="submit" class="btn {{ class }}" title="{{ text }}"><span class="fas {{ icon }}"></span> <span class="hidden-xs">{{ text }}</span></button>
|
||||
{% else %}
|
||||
<a href="{% url target id %}" class="btn {{ class }}" target="_blank"><span class="fas {{ icon }}"></span> <span class="hidden-xs">{{ text }}</span></a>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user