Radomir Dopieralski be56f53588 Fix JS warnings when $ is not available
The construction ($ || addHorizonLoadEvent) complains when $ is not
defined. Using (window.$ || window.addHorizonLoadEvent) instead solves
this problem.

Change-Id: Ied5db7398f6ca1d25906c84d5e40a4bae6c01f39
2013-10-21 12:43:19 +02:00

44 lines
1.4 KiB
HTML

{% extends 'horizon/common/_data_table.html' %}
{% load i18n %}
{% block table_columns %}
{% if not table.is_browser_table %}
<tr>
{% for column in columns %}
<th {{ column.attr_string|safe }}><span
{% if column.name in table.get_required_columns %}
class="required"
{% endif %}
>{{ column }}</span></th>
{% endfor %}
</tr>
{% endif %}
{% endblock table_columns %}
{% block table %}
{% with table.get_formset as formset %}
{{ formset.management_form }}
{% if formset.non_field_errors %}
<div class="alert alert-error">
{{ formset.non_field_errors }}
</div>
{% endif %}
{% endwith %}
{{ block.super }}
<script type="text/javascript">
(window.$ || window.addHorizonLoadEvent)(function () {
// prepare the js-enabled parts of the formset data table
var prefix = '{{ table.name|escapejs }}';
var empty_row_html = '{% filter escapejs %}{% include "formset_table/_row.html" with row=table.get_empty_row %}{% endfilter %}';
{% if table.formset_class.extra %}
var add_label = '{% filter escapejs %}{% trans "Add a row" %}{% endfilter %}';
{% else %}
var add_label = '';
{% endif %}
tuskar.formset_table.init(prefix, empty_row_html, add_label);
});
</script>
{% endblock table %}