Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open
Commits
dd4160ab
Commit
dd4160ab
authored
Mar 07, 2018
by
Daniel W Bond
Browse files
use the autocomplete select library used by django for schedule selection
parent
43d26a96
Pipeline
#2173
canceled with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
whats-open/api/templates/bulk_schedules_intermediate.html
View file @
dd4160ab
{% 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 %}
{% block title %}
Set main schedule for multiple facilities
{{ block.super }}
...
...
@@ -17,12 +29,14 @@ Set main schedule for multiple facilities
{% block content %}
<form
action=
""
method=
"post"
>
{% csrf_token %}
<label>
Schedule
</label>
<select
name=
"schedule"
>
{% for schedule in schedules %}
<option
value=
{{
schedule.pk
}}
>
{{ schedule }}
</option>
{% endfor %}
</select>
<label
for=
"id_label_single"
>
Schedule
<select
name=
"schedule"
class=
"select2-basic-single"
id=
"id_label_single"
>
{% for schedule in schedules %}
<option
value=
{{
schedule.pk
}}
>
{{ schedule }}
</option>
{% endfor %}
</select>
</label>
<p>
Set this as the main schedule for all of these facilities?
</p>
<ul>
...
...
@@ -34,4 +48,23 @@ Set main schedule for multiple facilities
<input
type=
"hidden"
name=
"action"
value=
"assign_bulk_schedules"
/>
<input
type=
"submit"
name=
"bulk_schedule"
value=
"Yes, I'm sure"
/>
</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 %}
whats-open/api/templates/bulk_special_schedules_intermediate.html
View file @
dd4160ab
{% 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 %}
{% block title %}
Add special schedule to multiple facilities
{{ block.super }}
...
...
@@ -17,12 +28,14 @@ Add special schedule to multiple facilities
{% block content %}
<form
action=
""
method=
"post"
>
{% csrf_token %}
<label>
Special Schedule
</label>
<select
name=
"special_schedule"
>
{% for schedule in schedules %}
<option
value=
{{
schedule.pk
}}
>
{{ schedule }}
</option>
{% endfor %}
</select>
<label
for=
"id_label_single"
>
Special Schedule
<select
name=
"special_schedule"
class=
"select2-basic-single"
id=
"id_label_single"
>
{% for schedule in schedules %}
<option
value=
{{
schedule.pk
}}
>
{{ schedule }}
</option>
{% endfor %}
</select>
</label>
<p>
Add this special schedule to all of these facilities?
</p>
<ul>
...
...
@@ -34,4 +47,11 @@ Add special schedule to multiple facilities
<input
type=
"hidden"
name=
"action"
value=
"assign_bulk_special_schedules"
/>
<input
type=
"submit"
name=
"bulk_special_schedule"
value=
"Yes, I'm sure"
/>
</form>
<script>
$
(
document
).
ready
(
function
()
{
$
(
'
.select2-basic-single
'
).
select2
({
});
});
</script>
{% endblock %}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment