uclouvain/osis-dissertation

View on GitHub
templates/dissertation/offerproposition_filter.html

Summary

Maintainability
Test Coverage
{% extends "layout.html" %}    
{% load static %}    
{% load bootstrap3 i18n %}    
{% block content %}
    <div class="page-header">    
        <h2>{% trans 'Dissertation Manager' %} - <label>{% for acronym in managed_entities_acronym %}{{ acronym }}    
            {% if not forloop.last %} - {% endif %}{% endfor %}</label></h2>    
    </div>    
    <div class="panel panel-default">    
        <div class="panel-body">    
            <br>    
            <div class="row">    
                <form method="get">    
                    <div class="col-md-3">    
                        {% bootstrap_field filter.form.education_group__educationgroupyear__acronym %}    
                    </div>    
                    <div class="col-md-4">    
                        {% bootstrap_field filter.form.education_group__facultyadviser__adviser %}    
                    </div>    
                    <div class="col-md-1">    
                        <br>    
                        <button type="submit" id="bt_submit_pgm_manager_search" class="btn btn-primary" role="button">    
                            <span class="fa fa-search" aria-hidden="true"></span>    
                        </button>    
                    </div>    
                </form>    
            </div>    
            <div class="row">    
                <div class="col-md-5">    
                    <table class="table table-striped table-hover" id="tb_pgms">    
                        <tr>    
                            <th> {% trans 'Filter by education group'%}</th>
                        </tr>    
                        <form action="{% url 'adviser_list' %}" id='form_offer_prop' method="get">    
                            {% for obj in object_list %}    
                                <tr>    
                                    <td><input type="checkbox" name="offer_proposition" value="{{ obj.pk }}"    
                                               onclick="load_faculty_advisers()"> {{ obj.last_acronym }}</td>    
                                </tr>    
                            {% endfor %}    
                        </form>    
                    </table>    
                </div>    
                <div class="col-md-7" id="tb_faculty_adviser">    

                </div>    
            </div>    
        </div>    
    </div>    

{% endblock %}    
{% block script %}    
    <script type="text/javascript" src="{% static 'js/jquery.dataTables.min.js' %}"></script>    
    <script type="text/javascript" src="{% static 'js/dataTables.bootstrap.min.js' %}"></script>    
    <script>    
        $(document).ready(function () {    
            load_faculty_advisers();    
        });    
        function load_faculty_advisers() {    
            let form = $("#form_offer_prop");    
            $("#tb_faculty_adviser").load(form.attr('action'), form.serialize());    
        }    
    </script>    
{% endblock %}