Commit 9a99479b authored by Daniel W Bond's avatar Daniel W Bond

use django's built-in js library, and abstracted static information out to new template

parent 6e3fcd8b
{% extends "admin/base_site.html" %}
{% load static %}
{% block extrahead %}
<link href="{% static "admin/css/vendor/select2/select2.min.css" %}" type="text/css" media="screen" rel="stylesheet" />
<link href="{% static "admin/css/autocomplete.css" %}" type="text/css" media="screen" rel="stylesheet" />
<script type="text/javascript" src="{% static "admin/js/vendor/jquery/jquery.min.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/vendor/select2/select2.full.min.js" %}"></script>
<!-- Django changes jQuery to django.jQuery in case the version bundled with Django is not the version
you want to use in your app -->
<script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/cancel.js" %}"></script>
<script>
/**
Django's admin inferface uses select2 for its new autocompletion selects
Unfortunately, use of that specific widget and the associated support attributes
are limited to admin.ModelAdmin change views
You need instead to use it manually
See
https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.autocomplete_fields
https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#reversing-admin-urls
https://select2.org/getting-started/basic-usage
for more information
**/
(function($) {
$(document).ready(function() {
$('.select2-basic-single').select2();
});
})(django.jQuery);
</script>
{{ block.super }}
{% endblock %}
{% block extrastyle %}
{{ block.super }}
<link href="{% static "admin/css/forms.css" %}" type="text/css" rel="stylesheet" />
<style type="text/css">
a.button.cancel-link {
display: inline-block;
vertical-align: middle;
height: 15px;
line-height: 15px;
background: #ddd;
border-radius: 4px;
padding: 10px 15px;
color: #333;
margin: 0 0 0 10px;
}
a.button.cancel-link:active,
a.button.cancel-link:focus,
a.button.cancel-link:hover {
background: #ccc;
}
</style>
{% endblock %}
{% extends "admin/base_site.html" %}
{% block extrahead %}
{{ block.super }}
<!-- neither jQuery proper nor Django's version is loaded by default on this page -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
{% endblock %}
{% block extrastyle %}
{{ block.super }}
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
{% endblock %}
{% extends "base_bulk_schedules_intermediate.html" %}
{% block title %}
Set main schedule for multiple facilities
......@@ -47,24 +35,7 @@ Set main schedule for multiple facilities
</ul>
<input type="hidden" name="action" value="assign_bulk_schedules" />
<input type="submit" name="bulk_schedule" value="Yes, I'm sure" />
<a href="#" class="button cancel-link">No, take me back</a>
</form>
<script>
/**
Django's admin inferface uses this library for its new autocompletion selects
Unfortunately, use of that specific widget and the associated support attributes
are limited to admin.ModelAdmin change views
See
https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.autocomplete_fields
https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#reversing-admin-urls
for more information
**/
$(document).ready(function() {
$('.select2-basic-single').select2({
});
});
</script>
{% endblock %}
{% extends "admin/base_site.html" %}
{% block extrahead %}
{{ block.super }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
{% endblock %}
{% block extrastyle %}
{{ block.super }}
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
{% endblock %}
{% extends "base_bulk_schedules_intermediate.html" %}
{% block title %}
Add special schedule to multiple facilities
......@@ -46,12 +35,7 @@ Add special schedule to multiple facilities
</ul>
<input type="hidden" name="action" value="assign_bulk_special_schedules" />
<input type="submit" name="bulk_special_schedule" value="Yes, I'm sure" />
<a href="#" class="button cancel-link">No, take me back</a>
</form>
<script>
$(document).ready(function() {
$('.select2-basic-single').select2({
});
});
</script>
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment