hobo/hobo/environment/templates/environment/variables.html

46 lines
1.4 KiB
HTML

{% extends "hobo/base.html" %}
{% load i18n %}
{% block appbar %}
<h2>{% trans 'Variables' %}</h2>
{% endblock %}
{% block breadcrumb %}
{{ block.super }}
<a href="{% url 'environment-variables' %}">{% trans 'Variables' %}</a>
{% endblock %}
{% block content %}
<form class="small">
{% for variable in variables %}
<p class="variable">
<label data-variable-id="{{ variable.id }}">{{ variable.get_field_label }}</label>
<input type="text" size="80" value="{{ variable.value }}" readonly>
<a rel="popup" class="update-variable" href="{% url 'update-variable' pk=variable.id %}" title="{% trans 'Update variable' %}">{% trans 'edit' %}</a>
<a rel="popup" class="icon-remove-sign" href="{% url 'delete-variable' pk=variable.id %}" title="{% trans 'Delete variable' %}"></a>
</p>
{% endfor %}
<a rel="popup" class="button" href="{% url 'new-variable' %}">{% trans 'Add new variable' %}</a>
</form>
{% endblock %}
{% block page-end %}
<script>
$(function() {
$('a.update-variable').hide();
$('p.variable label, p.variable input').click(function() {
$(this).parent().find('a.update-variable').click();
});
$('button.enable-on-change').each(function(index, element) {
var button = $(element);
$(element).parent('form').find('input').on('change keydown',
function() { $(button).prop('disabled', null); });
});
});
</script>
{% endblock %}