uclouvain/osis-dissertation

View on GitHub
templates/manager_proposition_dissertations_list.html

Summary

Maintainability
Test Coverage
{% extends "layout.html" %}
{% load static %}
{% load i18n %}

{% comment "License" %}
 * OSIS stands for Open Student Information System. It's an application
 * designed to manage the core business of higher education institutions,
 * such as universities, faculties, institutes and professional schools.
 * The core business involves the administration of students, teachers,
 * courses, programs and so on.
 *
 * Copyright (C) 2015-2019 Université catholique de Louvain (http://www.uclouvain.be)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * A copy of this license - GNU General Public License - is available
 * at the root of the source code of this program.  If not,
 * see http://www.gnu.org/licenses/.
{% endcomment %}

{% block breadcrumb %}
    <li><a href="{% url 'studies' %}" id="lnk_studies">{% trans "Students' path" %}</a></li>
    <li id="lnk_cohorts_management"><a href="{% url 'cohorts_management' %}">{% trans "Cohorts management" %}</a></li>
    <li><a href="{% url 'dissertations' %}" id="lnk_dissertations">{% trans 'Dissertations' %}</a></li>
    <li class="active">{% trans 'Dissertation subjects' %}</li>
{% endblock %}
{% block content %}
  <div class="page-header">
    <h2>{% trans 'Dissertation subjects' %}</h2>
  </div>
  <ul class="nav nav-tabs">
    <li class="active"><a href="{% url 'manager_proposition_dissertations'%}">{% trans 'All subjects' %}</a></li>
  </ul>
  <div class="panel panel-default">
    <div class="panel-body">
      <form method="get" action="{% url 'manager_proposition_dissertations'%}">
        <div class="row">
          <div class="col-md-10">
            <input class="form-control" id="txt_search" placeholder="{% trans 'Search' %}" name="search"
            value="{{ request.GET.search }}">
          </div>
          <div class="col-md-2">
            <button type="submit" id="bt_submit_proposition_dissertation_search" class="btn btn-primary" role="button"
            title="{% trans 'Search dissertation subject' %}"><span class="glyphicon glyphicon-search"
            aria-hidden="true"></span></button>
            <button type="submit" id="bt_submit_manager_proposition_dissertation_xlsx" class="btn btn-default no_spinner" role="button"
            title="{% trans 'Export search as XLS' %}" name="bt_xlsx" value="bt_xlsx"><span class="glyphicon glyphicon-download-alt"
            aria-hidden="true" ></span></button>

            <a href="{% url 'manager_proposition_dissertation_new' %}" id="lnk_manager_proposition_dissertation_new" class="btn btn-default"
            role="button" title="{% trans 'Add dissertation subject'%}" style="margin-left:1em;"><span class="glyphicon glyphicon-plus"
            aria-hidden="true"></span></a>
          </div>
        </div>
      </form>
      </div>
          {% if propositions_dissertations|length == 0 %}
            <br>
            <label class="alert alert-info" style="margin-left:10%;width:80%;text-align:center;">{% trans 'No result' %}</label>
          {% else %}
            <table class="table table-hover" id="tb_proposition">
              <thead>
                <th>{% trans 'Title' context 'dissertation' %}</th>
                <th>{% trans 'Promotor'%}</th>
                <th>{% trans 'Created by'%}</th>
                <th>{% trans 'Maximum number of student'%}</th>
                <th>{% trans 'Number of places remaining' %}</th>
                <th>{% trans 'Visibility'%}</th>
                <th>{% trans 'Programs'%}</th>
              </thead>
              {% for proposition_dissertation in propositions_dissertations %}
                <tr>
                  <td><a href="{% url 'manager_proposition_dissertation_detail' pk=proposition_dissertation.pk %}">{{ proposition_dissertation.title }}</a></td>
                  <td>{{ proposition_dissertation.author }}</td>
                  <td>{{ proposition_dissertation.creator }}</td>
                  <td>{{ proposition_dissertation.max_number_student }}</td>
                  {% if proposition_dissertation.remaining_places > 0 %}
                  <td> {{ proposition_dissertation.remaining_places }}</td>
                  {% else %}
                  <td> 0 </td>
                  {% endif %}
                  <td>
                      {% if proposition_dissertation.visibility == True %}
                      <span class="label label-success">{% trans 'Visible' %}</span>
                      {% else %}
                      <span class="label label-warning">{% trans 'Invisible' %}</span>
                      {% endif %}
                  </td>
                  <td>
                      {% for offer_proposition in proposition_dissertation.offer_propositions.all %}
                        <span class="label label-default" >
                          {{ offer_proposition.last_acronym }}
                        </span>
                        &nbsp;
                      {% endfor %}
                  </td>
                </tr>
              {% endfor %}
            </table>
          {% endif %}
    </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()
    {
        $('#tb_proposition').DataTable(
            {
                "paging" : true,
                "ordering" : true,
                "info"  : false,
                "searching" : false,
                "language":
                {
                    "sProcessing":     "{% trans 'Processing...'%}",
                    "sSearch":         "{% trans 'Search:'%}",
                    "sLengthMenu":     "&nbsp;&nbsp;&nbsp;_MENU_ &eacute;l&eacute;ments",
                    "sInfo":           "{% trans 'Showing _START_ to _END_ of _TOTAL_ entries'%}",
                    "sInfoEmpty":      "{% trans 'Showing 0 to 0 of 0 entries'%}",
                    "sInfoFiltered":   "{% trans '(filtered from _MAX_ total entries)'%}",
                    "sInfoPostFix":    "{% trans 'datatable_infopostfix'%}",
                    "sLoadingRecords": "{% trans 'Loading...'%}",
                    "sZeroRecords":    "{% trans 'No matching records found'%}",
                    "sEmptyTable":     "{% trans 'No data available in table'%}",
                "oPaginate": {
                    "sFirst":      "{% trans 'First'%}",
                    "sPrevious":   "{% trans 'Previous'%}",
                    "sNext":       "{% trans 'Next'%}",
                    "sLast":       "{% trans 'Last'%}"
                            },
            "oAria": {
                    "sSortAscending":  "{% trans ': activate to sort column ascending'%}",
                    "sSortDescending": "{% trans ': activate to sort column descending'%}",
                    }
                }
            });
    });

</script>
{% endblock %}