mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
pedagogy: simpler user interface for autumn and spring search
This commit is contained in:
parent
cbcd84c931
commit
6f8ec4740c
@ -6,7 +6,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form action="{{ url('pedagogy:guide') }}" method="get">
|
||||
<form id="search_form" action="{{ url('pedagogy:guide') }}" method="get">
|
||||
<p>
|
||||
<input type="text" name="search">
|
||||
<button>{% trans %}Details{% endtrans %}</button>
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
<input type="checkbox" name="semester" value="AUTUMN">A
|
||||
<input type="checkbox" name="semester" value="SPRING">P
|
||||
<input type="checkbox" name="semester" value="AUTUMN_AND_SPRING">
|
||||
</p>
|
||||
</form>
|
||||
{% if can_create_uv(user) %}
|
||||
@ -66,5 +67,30 @@
|
||||
formStates[$(this).attr("name")] = $(this).attr("value");
|
||||
}
|
||||
});
|
||||
|
||||
var autumn_and_spring = $("input[value='AUTUMN_AND_SPRING']").first();
|
||||
var autumn = $("input[value='AUTUMN']").first();
|
||||
var spring = $("input[value='SPRING']").first();
|
||||
|
||||
// Make autumn and spring hidden if js is enabled
|
||||
autumn_and_spring.hide();
|
||||
|
||||
// Set correctly state of what is checked
|
||||
if (autumn_and_spring.prop("checked")){
|
||||
autumn.prop("checked", true);
|
||||
spring.prop("checked", true);
|
||||
autumn_and_spring.prop("checked", false);
|
||||
}
|
||||
|
||||
// Handle submit here and modify autumn and spring here
|
||||
$("#search_form").submit(function(e) {
|
||||
e.preventDefault();
|
||||
if (autumn.prop("checked") && spring.prop("checked")){
|
||||
autumn_and_spring.prop("checked", true);
|
||||
autumn.prop("checked", false);
|
||||
spring.prop("checked", false);
|
||||
}
|
||||
this.submit();
|
||||
});
|
||||
</script>
|
||||
{% endblock content %}
|
Loading…
Reference in New Issue
Block a user