-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change school_select_form selects to select2
- Loading branch information
Showing
1 changed file
with
31 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,18 @@ | ||
{% load i18n %} | ||
|
||
{% block head %} | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" rel="stylesheet" /> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script> | ||
{% endblock head %} | ||
|
||
{% block styles %} | ||
<style> | ||
.select2-container { | ||
width: 100% !important; | ||
} | ||
</style> | ||
{% endblock styles %} | ||
|
||
{% for suffix, opts, selected in options %} | ||
<p> | ||
<select name="{{ attr.name }}{{ suffix }}" id="{{ attr.id }}{{ suffix }}"> | ||
|
@@ -10,8 +24,20 @@ | |
</select> | ||
</p> | ||
{% endfor %} | ||
{% if show_add_new %} | ||
{% blocktrans %} | ||
If you can not find your school on the list, please <button type="submit" class="btn btn-xs btn-link" name="_add_school">add it</button>. | ||
{% endblocktrans %} | ||
{% endif %} | ||
{% blocktrans %} | ||
If you cannot find your school on the list, please contact the organiser. | ||
{% endblocktrans %} | ||
|
||
{% block script %} | ||
<script> | ||
$(document).ready(function() { | ||
$('#id_school_province').select2(); | ||
}); | ||
$(document).ready(function() { | ||
$('#id_school_city').select2(); | ||
}); | ||
$(document).ready(function() { | ||
$('#id_school').select2(); | ||
}); | ||
</script> | ||
{% endblock script %} |